1个稳定版本
1.0.0 | 2024年5月5日 |
---|
在命令行工具中排名第1065
14KB
215 行
ipmitool dcmi power reading
为什么这个工具存在
因为你可能自己在问:“我如何获取我的功耗数据”?
网络链接
- https://serverfault.com/questions/736068/how-do-i-get-the-power-consumption-of-a-dell-poweredge-server-on-the-cli
- https://serverfault.com/questions/389224/power-usage-via-ipmi-or-bios-or
所以你似乎有两个选择
- 使用racadm:(https://serverfault.com/a/1070451/336084)
- 使用ipmitool:(https://serverfault.com/a/1141974/336084) - (https://wiki.evolix.org/HowtoIPMI)
我使用了racadm方法多年,我发现它很慢,有时它不起作用,因为一个iDRAC会话是打开的。然后我使用了ipmitool,它做得很好,但需要解析文本输出。
所以,我首先用相同的文本输出编写了相同的工具,并且它工作得很好。原始的C代码可以在这里找到:ipmitool 1.8.19
特别感谢ipmi-rs库,使得这一切成为可能。
使用
A tool to fetch the power reading with ipmi dcmi
Usage: ipmitool-dcmi-power-reading [OPTIONS]
Options:
-c, --connection-uri <CONNECTION_URI>
The connection URI to use [default: file:///dev/ipmi0]
--timeout-ms <TIMEOUT_MS>
How many milliseconds to wait before timing out while waiting for a response [default: 2000]
--format <FORMAT>
The format to output [default: text] [possible values: text, json]
-h, --help
Print help
-V, --version
Print version
示例(文本)
Instantaneous power reading : 212 Watts
Minimum during sampling period : 2 Watts
Maximum during sampling period : 468 Watts
Average power reading over sample period : 184 Watts
IPMI timestamp : 2024-05-05 14:17:17 UTC
Sampling period : 1000 Milliseconds
Power reading state is : activated
示例(JSON)
{"grp_id":220,"curr_pwr":209,"min_sample":2,"max_sample":468,"avg_pwr":184,"time_stamp":1714918638,"sample":1000,"state":64}
依赖项
~6–16MB
~191K SLoC