$ ipmitool -I open shellipmitool> helpCommands: raw Send a RAW IPMI request and print response i2c Send an I2C Master Write-Read command and print response spd Print SPD info from remote I2C device lan Configure LAN Channels chassis Get chassis status and set power state power Shortcut to chassis power commands event Send pre-defined events to MC mc Management Controller status and global enables……
查看开关机状态$ ipmitool power statusChassis Power is on
开机/关机$ ipmitool power on $ ipmitool power off
查看当前用户$ ipmitool user list 2ID Name Callin Link Auth IPMI Msg Channel Priv Limit1 Administrator true false true ADMINISTRATOR2 (Empty User) true false false NO ACCESS……
增加用户$ ipmitool user set name 2 test01 $ ipmitool user set password 2 password123
查看BMC IP地址$ ipmitool lan print 2……IP Address Source : Static AddressIP Address : 192.168.1.222Subnet Mask : 255.255.255.0MAC Address : 38:ea:a7:a9:xx:xx……
修改BMC IP地址$ ipmitool lan set 2 ipsrc static $ ipmitool lan set 2 ipaddr 192.168.1.1$ ipmitool lan set 2 netmask 255.255.255.0 $ ipmitool lan set 2 defgw 192.168.1.254
查看日志$ ipmitool sel list 10c | 11/07/2022 | 06:47:24 | Temperature #0x03 | Upper Critical going high | Asserted 10d | 11/07/2022 | 06:47:33 | Temperature #0x03 | Upper Critical going high | Asserted 10e | 11/07/2022 | 06:48:57 | System ACPI Power State #0xd5 | S4/S5: soft-off | Asserted 10f | 11/08/2022 | 00:46:40 | System ACPI Power State #0xd5 | S0/G0: working | Asserted 110 | 11/08/2022 | 01:52:23 | Memory #0x40 | Uncorrectable ECC | Asserted 111 | 11/08/2022 | 01:52:33 | Memory #0x40 | Uncorrectable ECC | Asserted 112 | 11/14/2022 | 06:48:58 | Temperature #0x30 | Upper Critical going high | Asserted …… $ ipmitool sel helpSEL Commands: info clear delete list elist get add time save readraw writeraw interpret
查看FRU信息$ ipmitool fru listFRU Device Description : Builtin FRU Device (ID 0) Chassis Type : Rack Mount Chassis Chassis Serial : Board Mfg Date : Wed Oct 21 20:00:00 2009 Board Mfg : HP Board Product : ProLiant DL380p Gen8 Board Serial : Board Part Number : 653200-B21 Product Manufacturer : HP Product Name : ProLiant DL380p Gen8 Product Part Number : 653200-B21 Product Serial : FRU Device Description : BMC CONTROLLER (ID 238) Product Manufacturer : HPE Product Name : BMC CONTROLLER Product Part Number : iLO 4……
设置为光盘启动$ ipmitool chassis bootparam set bootflag force_cdrom
bootparam set bootflag <device> [options=...] Legal devices are: none : No override force_pxe : Force PXE boot force_disk : Force boot from default Hard-drive force_safe : Force boot from default Hard-drive, request Safe Mode force_diag : Force boot from Diagnostic Partition force_cdrom : Force boot from CD/DVD force_bios : Force boot into BIOS Setup
重启BMC$ ipmitool mc reset cold
注:以上命令中均在本机执行,如果对网络中其它主机进行操作,需要指定BMC 的IP地址、用户名和密码: -H hostname Remote host name for LAN interface -U username Remote session username -P password Remote session passwordPython操作实例安装所需的软件包(第三方),拿HP iLO示例$ pip install python-hpilo
导入软件包,获取服务器物理状态# -- coding: utf-8 --import pprintimport hpiloilo = hpilo.Ilo("192.168.1.1", "admin", "password")health_summary = ilo.get_embedded_health()['health_at_a_glance']pprint.pprint(health_summary)
获取IML日志:# 查看IML(Integrated Management log)日志logs = ilo.get_server_event_log()for log in logs: print(log)
查看Event日志# 查看 iLO Event logevents = ilo.get_ilo_event_log()for event in events: print(event)
主要方法:(图片来源网络,侵删)
0 评论