操作详细IPMI(操作日志重启状态服务器)「操作日志功能」

IPMI硬件管理IPMI是一个开放的标准,是用于管理基于 Intel架构服务器的工业标准,由英特尔、HP、NEC、DELL等公司制定
用户可以利用IPMI监视服务器的物理健康特征,如温度、电压、风扇工作状态、电源状态等
2004年Intel发表了IPMI 2.0的规格,能够向下相容IPMI 1.0、1.5,新增了Console Redirection,并可以通过以太网远程管理服务器
IPMI主要的功能硬件监控(模块状态、传感器)远程控制(远程开机、关机、重启,Console)日志(硬件运行日志)配置BIOS、RAID列出所有相关硬件等IPMI 操作方法今天主要来说一下IPMI具体的使用操作方法,从常规的ipmitool命令行操作到Python脚本控制,基本能涵盖到日常运维所涉及的所有操作
ipmitool 是一种可用在 linux 系统下的命令行方式的 ipmi 平台管理工具,它支持 ipmi 2.0规范,通过它可以实现获取传感器的信息、显示系统日志内容、网络远程开关机等功能
命令行操作实例进入BMC sh(ipmitool交互界面)$ 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_cdrombootparam 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)主要方法:方法功能get_embedded_health()获取服务器物理状态信息press_pwr_btn()按一下电源键hold_pwr_btn()长按电源键reset_rib()重置iloreset_server()重启服务器cold_boot_server()冷重启warm_boot_server()热重启get_ilo_event_log()获取ilo event日志get_server_event_log()获取IML日志
操作详细IPMI(操作日志重启状态服务器)
(图片来源网络,侵删)

联系我们

在线咨询:点击这里给我发消息