Expand description
An unofficial interface for obtaining metrics from Supermicro BMCs.
The following metrics are accessible:
- Sensor: temperature, fan, voltage, power supply status, etc.
- PMBus: power consumption, fans, temperatures, etc. per power supply.
This library depends on the BMC web interface being available.
§Clients
Client is async (Tokio); enable the blocking feature for
blocking::Client. Both log in on first use and refresh the session
when it expires.
use smbmc::{Client, MetricKind};
let client = Client::new("https://192.168.1.1", "ADMIN", "secret")?;
let metrics = client.metrics(&MetricKind::ALL).await?;
println!("{:#?}", metrics.pmbus);§Features
rustls(default): TLS via rustls.native-tls: TLS via the platform library instead.blocking: the synchronousblocking::Client.serde:Serialize/Deserializefor the models.
§Parsing only
The parsing layer is independent of any HTTP client, so responses obtained
by other means can be decoded with parse_sensors and
parse_power_supplies:
let xml = r#"<?xml version="1.0"?>
<IPMI><SENSOR_INFO>
<SENSOR ID="001" NAME="System Temp" READING="19c000" OPTION="c0"
UNR="5a" UC="55" UNC="50" LNC="fb" LC="f9" LNR="f7" STYPE="01"
RTYPE="01" ERTYPE="01" UNIT1="80" UNIT="01" L="00" M="0100" B="0000" RB="00"/>
</SENSOR_INFO></IPMI>"#;
let sensors = smbmc::parse_sensors(xml)?;
assert_eq!(sensors[0].name, "System Temp");
assert_eq!(sensors[0].reading, 25.0);
assert_eq!(sensors[0].unit, smbmc::SensorUnit::DegreesCelsius);Supermicro have released some BMC/IPMI code under the GPL, which has been used as a reference; this crate is therefore licensed as GPL-3.0-only. It is not associated with Super Micro Computer, Inc.
Modules§
- blocking
- Synchronous client (requires the
blockingfeature).
Structs§
- Client
- Async client for a Supermicro BMC’s web interface.
- Client
Builder - Builder for
Clientandblocking::Client. - Metrics
- Result of
metrics(): each field isSomeif that kind was requested. - Power
Supply - A power supply reported over PMBus.
- Power
Supply Flag - Power supply specific discrete sensor events (IPMI 2.0, table 42-3, sensor type 08h).
- Sensor
- A sensor reported by the BMC.
Enums§
- Error
- Errors produced by this crate.
- Metric
Kind - A category of metrics that can be requested with
metrics(). - Sensor
State - Whether a sensor is present, as guessed from the
OPTIONbyte. - Sensor
Type - Sensor type (IPMI 2.0, table 42-3).
- Sensor
Unit - Unit of a sensor reading (IPMI 2.0, table 43-15).
Constants§
- DEFAULT_
REQUEST_ TIMEOUT - Default timeout for each HTTP request.
- DEFAULT_
SESSION_ TIMEOUT - Default BMC session lifetime (the Supermicro default is 30 minutes).
Functions§
- parse_
power_ supplies - Parse a
Get_PSInfoReadings.XMLresponse into power supplies. - parse_
sensors - Parse a
SENSOR_INFO.XMLresponse into sensors.
Type Aliases§
- Result
- Convenience alias for
Result<T, smbmc::Error>.