IPMITOOL 命令支持列表 V2.0 技术博客
IPMI(Intelligent Platform Management Interface)是一种开放标准的硬件管理接口规格,用于对服务器的硬件进行监控、管理和控制。IPMITOOL 是一个强大的开源工具,它允许用户通过命令行界面与 IPMI 兼容的系统进行交互。本文将详细介绍 IPMITOOL 命令支持列表 V2.0,包括常见用法、最佳实践以及示例代码,帮助读者更好地理解和使用 IPMITOOL。
目录#
- IPMITOOL 简介
- IPMITOOL 命令支持列表概述
- 常用命令分类及详细介绍
- 系统信息查询命令
- 传感器信息查询命令
- 电源管理命令
- 事件日志管理命令
- SEL(System Event Log)管理命令
- 常见使用场景及示例
- 最佳实践
- 注意事项
- 总结
- 参考资料
1. IPMITOOL 简介#
IPMITOOL 是一个用于与支持 IPMI 协议的系统进行通信的命令行工具。它可以在本地或通过网络连接到远程 IPMI 设备,提供了诸如查询系统信息、监控传感器数据、控制电源状态等功能。IPMITOOL 是开源的,支持多种操作系统,如 Linux、Windows 等。
2. IPMITOOL 命令支持列表概述#
IPMITOOL 命令支持列表 V2.0 包含了丰富的命令,用于满足不同的管理需求。这些命令可以分为多个类别,如系统信息查询、传感器信息查询、电源管理、事件日志管理等。每个命令都有其特定的功能和参数,用户可以根据需要选择合适的命令进行操作。
3. 常用命令分类及详细介绍#
3.1 系统信息查询命令#
ipmitool chassis status- 功能:查询机箱的状态信息,如电源状态、机箱门状态等。
- 示例:
ipmitool chassis status- **输出示例**:
System Power : on
Power Overload : false
Duty Cycle Overload : false
Power Fault : false
Power Control Fault : false
Power Restore Policy : unknown
Last Power Event : unknown
Chassis Intrusion : inactive
Front-Panel Lockout : inactive
Drive Fault : false
Cooling/Fan Fault : false
ipmitool bmc info- 功能:查询 BMC(Baseboard Management Controller)的信息,如版本号、制造商等。
- 示例:
ipmitool bmc info- **输出示例**:
Device ID : 32
Device Revision : 0
Firmware Revision : 1.23
IPMI Version : 2.0
Manufacturer ID : 1234
Manufacturer Name : Example Manufacturer
Product ID : 5678
Product Name : Example Product
Device Available : yes
Provides Device SDRs : yes
Additional Device Support:
Sensor Device
SEL Device
FRU Inventory Device
IPMI Watchdog
3.2 传感器信息查询命令#
ipmitool sensor- 功能:查询系统中所有传感器的信息,包括温度、电压、风扇转速等。
- 示例:
ipmitool sensor- **输出示例**:
Temp1 | 25.000 | degrees C | ok | na | 0.000 | 0.000 | 0.000 | 80.000 | 85.000 | 90.000
Temp2 | 23.000 | degrees C | ok | na | 0.000 | 0.000 | 0.000 | 80.000 | 85.000 | 90.000
Fan1 | 3000 | RPM | ok | na | 1000 | 1200 | 1400 | 6000 | 6200 | 6400
Fan2 | 3200 | RPM | ok | na | 1000 | 1200 | 1400 | 6000 | 6200 | 6400
Voltage1 | 12.0 | Volts | ok | na | 11.0 | 11.2 | 11.4 | 12.6 | 12.8 | 13.0
3.3 电源管理命令#
ipmitool chassis power on- 功能:打开服务器电源。
- 示例:
ipmitool chassis power onipmitool chassis power off- 功能:关闭服务器电源。
- 示例:
ipmitool chassis power offipmitool chassis power cycle- 功能:重启服务器电源。
- 示例:
ipmitool chassis power cycle3.4 事件日志管理命令#
ipmitool sel list- 功能:列出系统事件日志(SEL)中的所有事件。
- 示例:
ipmitool sel list- **输出示例**:
0000 | 2023-10-01T12:00:00 | Power on
0001 | 2023-10-01T12:05:00 | Temperature sensor 1 crossed low warning threshold
0002 | 2023-10-01T12:10:00 | Power off
3.5 SEL(System Event Log)管理命令#
ipmitool sel clear- 功能:清除系统事件日志(SEL)。
- 示例:
ipmitool sel clear4. 常见使用场景及示例#
4.1 监控服务器温度#
while true; do
ipmitool sensor | grep "Temp"
sleep 60
done此脚本每隔一分钟查询一次服务器的温度传感器信息,并将结果输出。
4.2 远程管理服务器电源#
ipmitool -I lanplus -H 192.168.1.100 -U admin -P password chassis power cycle此命令通过网络连接到 IP 地址为 192.168.1.100 的服务器,使用用户名 admin 和密码 password 重启服务器电源。
5. 最佳实践#
- 使用别名:为常用的 IPMITOOL 命令创建别名,以减少输入工作量。例如,在
.bashrc文件中添加以下内容:
alias ipmi-power-on='ipmitool chassis power on'
alias ipmi-power-off='ipmitool chassis power off'- 定期备份 SEL:定期备份系统事件日志(SEL),以防止数据丢失。可以使用脚本定期执行
ipmitool sel list > sel_backup.txt命令。 - 设置合理的传感器阈值:根据服务器的硬件规格,设置合理的传感器阈值,以便及时发现硬件故障。
6. 注意事项#
- 权限问题:在某些操作系统中,运行 IPMITOOL 命令需要 root 权限。
- 网络安全:在使用网络连接到远程 IPMI 设备时,确保网络安全,避免使用明文密码。
- 硬件兼容性:不同的服务器硬件对 IPMITOOL 命令的支持可能有所不同,在使用前请查阅服务器的文档。
7. 总结#
IPMITOOL 是一个功能强大的工具,通过 IPMITOOL 命令支持列表 V2.0,用户可以方便地对支持 IPMI 协议的服务器进行监控、管理和控制。本文详细介绍了 IPMITOOL 的常用命令、常见使用场景、最佳实践和注意事项,希望能帮助读者更好地使用 IPMITOOL。