SMBMC
An unofficial interface for obtaining metrics from Supermicro BMCs, for Python and Rust.
The following metrics are accessible:
Sensor: Temperature, Fan, Voltage, etc.
PMBus: Power Consumption, Fan, Temperature, etc.
Note: This library depends on the BMC web-interface being available.
Since 0.4.0 the library is written in Rust. The Python package (smbmc on PyPI) is a thin layer over the Rust crate (smbmc on crates.io) and keeps the 0.3 API; see Changes in 0.4.0.
Installation
# Python (3.10+); prebuilt wheels for Linux, macOS and Windows pip install smbmc # Rust cargo add smbmc # async client (Tokio) cargo add smbmc --features blocking # plus the blocking client
Python Usage
Setup
# smbmc_example.py from smbmc import Client # initialise client with connection details c = Client(IPMI_SERVER, IPMI_USER, IPMI_PASS) # Supermicro BMCs ship with self-signed certificates; to accept them # (trusted networks only): c = Client(IPMI_SERVER, IPMI_USER, IPMI_PASS, verify=False) # retrieve session token (usually lasts 30 minutes) # optional: the library maintains session tokens internally. c.login()
Client also accepts session_timeout (minutes, default 30) and request_timeout (seconds, default 30). Requests release the GIL, so a client can be shared between threads.
Sensor Metrics
# obtain sensor metrics
sensors = c.get_sensor_metrics()
for sensor in sensors:
print(sensor.__dict__)
# output (some removed for brevity)
{'id': 0, 'name': 'System Temp', 'type': <SensorTypeEnum.TEMPERATURE: 1>, 'unit': <SensorUnitEnum.DEGREES_CELSIUS: 1>, 'state': <SensorStateEnum.PRESENT: 1>, 'flags': None, 'reading': 25.0, 'lnr': -9.0, 'lc': -7.0, 'lnc': -5.0, 'unc': 80.0, 'uc': 85.0, 'unr': 90.0}
{'id': 1, 'name': '12VCC', 'type': <SensorTypeEnum.VOLTAGE: 2>, 'unit': <SensorUnitEnum.VOLTS: 4>, 'state': <SensorStateEnum.PRESENT: 1>, 'flags': None, 'reading': 12.192, 'lnr': 10.144, 'lc': 10.272, 'lnc': 10.784, 'unc': 12.96, 'uc': 13.28, 'unr': 13.408}
{'id': 9, 'name': 'FAN1', 'type': <SensorTypeEnum.FAN: 4>, 'unit': <SensorUnitEnum.RPM: 18>, 'state': <SensorStateEnum.PRESENT: 1>, 'flags': None, 'reading': 3400.0, 'lnr': 400.0, 'lc': 600.0, 'lnc': 800.0, 'unc': 25300.0, 'uc': 25400.0, 'unr': 25500.0}
{'id': 10, 'name': 'FAN2', 'type': <SensorTypeEnum.FAN: 4>, 'unit': <SensorUnitEnum.RPM: 18>, 'state': <SensorStateEnum.NOT_PRESENT: 2>, 'flags': None, 'reading': 0.0, 'lnr': 400.0, 'lc': 600.0, 'lnc': 800.0, 'unc': 25300.0, 'uc': 25400.0, 'unr': 25500.0}
{'id': 27, 'name': 'PS2 Status', 'type': <SensorTypeEnum.POWER_SUPPLY: 8>, 'unit': <SensorUnitEnum.UNSPECIFIED: 0>, 'state': <SensorStateEnum.PRESENT: 1>, 'flags': <PowerSupplyFlag.PRESENCE_DETECTED: 1>, 'reading': 0.0, 'lnr': 0.0, 'lc': 0.0, 'lnc': 0.0, 'unc': 0.0, 'uc': 0.0, 'unr': 0.0}
PMBus Metrics
# obtain pmbus metrics
power_supplies = c.get_pmbus_metrics()
for psu in power_supplies:
print(psu.__dict__)
# output
{'id': 0, 'name': '', 'status': 'ff', 'type': '0', 'input_voltage': 0, 'input_current': 0.0, 'input_power': 0, 'output_voltage': 0.0, 'output_current': 0.0, 'output_power': 0, 'temp_1': 0, 'temp_2': 0, 'fan_1': 0, 'fan_2': 0}
{'id': 1, 'name': 'FAKE_PSU_SERIAL', 'status': '1', 'type': '1', 'input_voltage': 239, 'input_current': 0.359, 'input_power': 84, 'output_voltage': 12.1, 'output_current': 5.75, 'output_power': 69, 'temp_1': 40, 'temp_2': 55, 'fan_1': 2894, 'fan_2': 3847}
All Metrics
# obtain all metrics
metrics = c.get_metrics()
print(metrics)
# output
{'pmbus': [], 'sensor': []}
Errors
All errors derive from smbmc.SmbmcError (itself an Exception): AuthenticationError, HTTPError, TLSError, ResponseError, InvalidURLError (also a ValueError) and UnsupportedError (also a NotImplementedError). get_metrics raises ValueError for duplicate or unknown metric names.
Parsing Only
Responses fetched by other means can be parsed with smbmc.parse_sensors(xml) and smbmc.parse_power_supplies(xml).
Rust Usage
use smbmc::{Client, MetricKind};
let client = Client::builder("https://192.168.1.1", "ADMIN", "secret")
.accept_invalid_certs(true) // self-signed BMC certificate
.build()?;
let metrics = client.metrics(&MetricKind::ALL).await?;
for sensor in metrics.sensor.unwrap_or_default() {
println!("{}: {} {:?}", sensor.name, sensor.reading, sensor.unit);
}
See the crate documentation and crates/smbmc/examples/ for more, including the blocking client.
Changes in 0.4.0
Rewritten in Rust; requests and defusedxml are no longer dependencies.
Readings are rounded to three decimal places instead of truncated, which previously could drop 0.001 (e.g. 4.054 instead of 4.055).
Discrete sensors that are not present, or are of a type other than power supply, no longer abort get_sensor_metrics; they are returned with flags set to None.
Unknown sensor types/units become UNKNOWN_<code> enum members instead of raising ValueError.
A session dropped by the BMC (e.g. after a reboot) is renewed automatically, once, instead of producing a parse error.
New exception classes (see Errors); login requires a non-empty session ID; non-2xx HTTP responses are errors.
Client validates the server address on construction and gains request_timeout and verify; it no longer exposes password, _session or initial_call.
New parse_sensors and parse_power_supplies functions.
Development
Requires uv, a Rust toolchain and just.
just test # Python tests (rebuilds the extension when Rust changes) just cargo-test # Rust tests just check # ruff just cargo-check # rustfmt + clippy
Contributing
This library has been tested on a system with the following components:
Chassis: SC846 (unknown revision; possibly 846BA-R920B)
Motherboard: CSE-PTJBOD-CB3
Power Supply: PWS-920P-SQ
Backplane: BPN-SAS2-846EL1
Power Distribution Board: PDB-PT846-2824
If there are any errors or additional functionality for other components, please file an issue with as much detail as you can!
Legal
This library is not associated with Super Micro Computer, Inc.
Supermicro have released some BMC/IPMI code under the GPL, which has been used as a reference. Therefore, this library is licensed as GPLv3.
Metadata
Release files for smbmc 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smbmc-0.4.0.tar.gz | 77.9 kB | Without provenance | Details for smbmc-0.4.0.tar.gz |
Built distributions (wheels)
Total release size: 14.2 MB
Release files / smbmc-0.4.0.tar.gz
| Download URL | smbmc-0.4.0.tar.gz |
|---|---|
| Size | 77.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea11086a306e6ddcdb0270c1c1791f157674604258170b3cfa3ddd0c3700ad4f
|
|
BLAKE2b-256 checksum How to use checksums |
ce1aeb516d1db9eb1405dfc11ce44eaddc8834a30afd692e51cb5ae7e76e7ba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-win_amd64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6672d009201284304b6a7d8cfeffbdd310b996c074ca40bb5935532f4e4df0d2
|
|
BLAKE2b-256 checksum How to use checksums |
b44d2f5c150621fd818004c12e02c40661c97a1cdf7282787b9e30a205e840eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
61dc98eebbe422f27b8217f6613750f2100eae1a7b0722811f841e3b421a1a1d
|
|
BLAKE2b-256 checksum How to use checksums |
a74202923b2d26fb5ab922fe04fd35f2ecc76570f97b3baccaad10850bd8892d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
86d1801a7093a7dbd5f92ac788a8e9e6b9e82e1e850f13ea5e2ba9206b462ebf
|
|
BLAKE2b-256 checksum How to use checksums |
bf4d9200129ccdb548ddf61873b824fad57c324b38fb036181db30c0c2f55eb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fdfdc2408d4ebb291c6450454ecffece230e956fc06e330d6ff05badc37175b6
|
|
BLAKE2b-256 checksum How to use checksums |
a3c3b5a75c37a6ff8ddd3a93db82c0ae61143c9ffaa61a6d51994c8e3007d5a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
8e6ff6cc5649d1fe4f68628eaa9aecd05e4c97276b712bdb40b15cd0efed0614
|
|
BLAKE2b-256 checksum How to use checksums |
5028de758b673c651f71636939925b345575d03790ba8822caa8990f32a20a1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
2d12ed159ccb450ce8ab2b233ad95d0cbd826af394316ca0accd168dd5a2b893
|
|
BLAKE2b-256 checksum How to use checksums |
e92aea1b98b6fa4cd9d1876cf4fa09aa97ae6660d72c6367baecffc3c6855c7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / smbmc-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | smbmc-0.4.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
90608514ce321214c54371e08d40de9952267dceb4146025442e369c0ae1cd00
|
|
BLAKE2b-256 checksum How to use checksums |
2763da37df47788a1e28035f08c183f510273d82a9ab956c82ae04968f469d6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for smbmc 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.