1、简介
IPMI(Intelligent Platform Management Interface)即智能平台管理接口是使硬件管理具备“智能化”的新一代通用接口标准。用户可以利用 IPM监视服务器的物理特征,如温度、电压、电扇工作状态、电源供应以及机箱入侵等。Ipmi 最大的优势在于它是独立于 CPU BIOS 和 OS 的,所以用户无论在开机还是关机的状态下,只要接通电源就可以实现对服务器的监控。Ipmi 是一种规范的标准,其中最重要的物理部件就是BMC(Baseboard Management Controller),一种嵌入式管理微控制器,它相当于整个平台管理的“大脑”,通过它 ipmi 可以监控各个传感器的数据并记录各种事件的日志。
ipmitool 是一种可用在 linux 系统下的命令行方式的 ipmi 平台管理工具,它支持 ipmi 1.5 规范(最新的规范为 ipmi 2.0),通过它可以实现获取传感器的信息、显示系统日志内容、网络远程开关机等功能。Ipmitool 有两种使用方式:
方式 接口 特点 本地调用 本地操作系统 通过OS内核提供接口,与BMC通信 远程调用 网络 通过网络以UDP报文形式与BMC通信
2. 使用 ipmi 的先决条件
想要实现对服务器的 ipmi 管理,必须在硬件、OS、管理工具等几个方面都满足:
2.1 服务器硬件本身提供对 ipmi 的支持
目前惠普、戴尔和 NEC 等大多数厂商的服务器都支持 IPMI 1.5,但并不是所有服务器都支持,所以应该先通过产品手册或在 BIOS 中确定服务器是否支持 ipmi,也就是说服务器在主板上要具有 BMC 等嵌入式的管理微控制器。
2.2 操作系统提供相应的 ipmi 驱动
通过操作系统监控服务器自身的 ipmi 信息时需要系统内核提供相应的支持,linux 系统通过内核对 OpenIPMI(ipmi 驱动)的支持来提供对 ipmi 的系统接口。
2.3 ipmi 管理工具
Linux 下的命令行方式的 ipmi 平台管理工具 ipmitool
3. 实现对 Linux 服务器的 ipmi 管理
3.1 实现对本地服务器的管理
启动模块:
modprobeipmi_msghandler
modprobeipmi_devintf
modprobeipmi_si
modprobeipmi_poweroff
modprobeipmi_watchdog
 
 
 
IPMI 管理HP服务器
介绍:
管理系统版本    Centos_6.3
在管理机安装IPMI
192.168.0.2 [/opt/chaichuan] 2015-11-04 17:37:19root@pts/21 # rpm -ivh ipmitool-1.8.11-13.el6.x86_64.rpm OpenIPMI-2.0.16-12.el6.x86_64.rpm OpenIPMI-libs-2.0.16-12.el6.x86_64.rpm Preparing... ########################################### [100%] 1:OpenIPMI-libs ########################################### [ 33%] 2:OpenIPMI ########################################### [ 67%] 3:ipmitool ########################################### [100%]
或者使用yum安装
root@pts/0 # yum -y install OpenIPMI OpenIPMI-toolsLoaded plugins: downloadonly, fastestmirror, presto Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * epel: mirrors.opencas.cn * extras: mirrors.yun-idc.com * updates: mirrors.yun-idc.com Setting up Install Process Resolving Dependencies--> Running transaction check---> Package OpenIPMI.x86_64 0:2.0.16-14.el6 will be installed---> Package ipmitool.x86_64 0:1.8.11-28.el6 will be installed--> Finished Dependency Resolution Dependencies Resolved========================================================================================================================================== Package Arch Version Repository Size==========================================================================================================================================Installing: OpenIPMI x86_64 2.0.16-14.el6 base 156 k ipmitool x86_64 1.8.11-28.el6 base 464 k Transaction Summary==========================================================================================================================================Install 2 Package(s) Total download size: 620 k Installed size: 1.6 M Downloading Packages: Setting up and reading Presto delta metadata Processing delta metadata Package(s) data still to download: 620 k (1/2): OpenIPMI-2.0.16-14.el6.x86_64.rpm | 156 kB 00:00 (2/2): ipmitool-1.8.11-28.el6.x86_64.rpm | 464 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------Total 14 MB/s | 620 kB 00:00 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : OpenIPMI-2.0.16-14.el6.x86_64 1/2 Installing : ipmitool-1.8.11-28.el6.x86_64 2/2 Installed: OpenIPMI.x86_64 0:2.0.16-14.el6 ipmitool.x86_64 0:1.8.11-28.el6 Complete!
启动:
root@pts/21 # /etc/init.d/ipmievd startStarting ipmievd: [ OK ]192.168.0.2 [~] 2015-11-05 11:26:34root@pts/21 # /etc/init.d/ipmi startStarting ipmi drivers: [ OK ]192.168.0.2 [~] 2015-11-05 11:26:43root@pts/21 #
查看帮助:
root@pts/0 # ipmitool --helpipmitool: invalid option -- '-'ipmitool version 1.8.11usage: ipmitool [options...] <command> -h This help -V Show version information -v Verbose (can use multiple times) -c Display output in comma separated format -d N Specify a /dev/ipmiN device to use (default=0) -I intf Interface to use -H hostname Remote host name for LAN interface -p port Remote RMCP port [default=623] -U username Remote session username -f file Read remote session password from file -z size Change Size of Communication Channel (OEM) -S sdr Use local file for remote SDR cache -D tty:b[:s] Specify the serial device, baud rate to use and, optionally, specify that interface is the system one -a Prompt for remote password -Y Prompt for the Kg key for IPMIv2 authentication -e char Set SOL escape character -C ciphersuite Cipher suite to be used by lanplus interface -k key Use Kg key for IPMIv2 authentication -y hex_key Use hexadecimal-encoded Kg key for IPMIv2 authentication -L level Remote session privilege level [default=ADMINISTRATOR] Append a '+' to use name/privilege lookup in RAKP1 -A authtype Force use of auth type NONE, PASSWORD, MD2, MD5 or OEM -P password Remote session password -E Read password from IPMI_PASSWORD environment variable -K Read kgkey from IPMI_KGKEY environment variable -m address Set local IPMB address -b channel Set destination channel for bridged request -t address Bridge request to remote target address -B channel Set transit channel for bridged request (dual bridge) -T address Set transit address for bridge request (dual bridge) -l lun Set destination lun for raw commands -o oemtype Setup for OEM (use 'list' to see available OEM types) -O seloem Use file for OEM SEL event descriptions -N seconds Specify timeout for lan [default=2] / lanplus [default=1] interface -R retry Set the number of retries for lan/lanplus interface [default=4] Interfaces: open Linux OpenIPMI Interface [default] imb Intel IMB Interface lan IPMI v1.5 LAN Interface lanplus IPMI v2.0 RMCP+ LAN Interface serial-terminal Serial Interface, Terminal Mode serial-basic Serial Interface, Basic Mode Commands: 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 sdr Print Sensor Data Repository entries and readings sensor Print detailed sensor information fru Print built-in FRU and scan SDR for FRU locators gendev Read/Write Device associated with Generic Device locators sdr sel Print System Event Log (SEL) pef Configure Platform Event Filtering (PEF) sol Configure and connect IPMIv2.0 Serial-over-LAN tsol Configure and connect with Tyan IPMIv1.5 Serial-over-LAN isol Configure IPMIv1.5 Serial-over-LAN user Configure Management Controller users channel Configure Management Controller channels session Print session information dcmi Data Center Management Interface sunoem OEM Commands for Sun servers kontronoem OEM Commands for Kontron devices picmg Run a PICMG/ATCA extended cmd fwum Update IPMC using Kontron OEM Firmware Update Manager firewall Configure Firmware Firewall delloem OEM Commands for Dell systems shell Launch interactive IPMI shellexec Run list of commands from file set Set runtime variable for shell and exechpm Update HPM components using PICMG HPM.1 file ekanalyzer run FRU-Ekeying analyzer using FRU files ime Update Intel Manageability Engine Firmware
 
ipmitool -I lanplus -H 192.168.1.147 -U youyuan -P youyuan.com power status
hponcfg-4.4.0-0.x86_64
hponcfg -w /tmp/outpu.xml   导出ILO 配置文件
导入ILO配置文件需要删除用户信息:
<USER_INFO MODE="write">
  <ADD_USER
    USER_NAME = "youyuan"
    USER_LOGIN = "youyuan"
    PASSWORD = "%user_password%">
    <ADMIN_PRIV value = "Y"/>
    <REMOTE_CONS_PRIV value = "Y"/>
    <RESET_SERVER_PRIV value = "Y"/>
    <VIRTUAL_MEDIA_PRIV value = "Y"/>
    <CONFIG_ILO_PRIV value = "Y"/>
  </ADD_USER>
</USER_INFO>
 
hponcfg -f /tmp/out.xml    修改配置后导入到HP_ilo