Skip to main content

Crate smbmc

Crate smbmc 

Source
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 synchronous blocking::Client.
  • serde: Serialize/Deserialize for 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 blocking feature).

Structs§

Client
Async client for a Supermicro BMC’s web interface.
ClientBuilder
Builder for Client and blocking::Client.
Metrics
Result of metrics(): each field is Some if that kind was requested.
PowerSupply
A power supply reported over PMBus.
PowerSupplyFlag
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.
MetricKind
A category of metrics that can be requested with metrics().
SensorState
Whether a sensor is present, as guessed from the OPTION byte.
SensorType
Sensor type (IPMI 2.0, table 42-3).
SensorUnit
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.XML response into power supplies.
parse_sensors
Parse a SENSOR_INFO.XML response into sensors.

Type Aliases§

Result
Convenience alias for Result<T, smbmc::Error>.