【专项】】ipmitool 相关工具

ipmitool常用操作指导书

1、ipmitool工具安装

方式一:(源码包安装方式)

(1)将软件包ipmitool-1.8.11.tar.gz上传到Linux OS的/home目录下

(2)依次执行如下命令进行ipmitool的安装

# tar -zxvf /home/ipmitool-1.8.11.tar.gz

# cd /home/ipmitool-1.8.11

# ./configure && make && make install

# cp contrib/bmclanconf /usr/local/bin/

方式二:(通过yum源安装或是rpm包安装 )

yum  install ipmitool

或是

yum localinstall  ipmitool*.rpm

 # yum源中可能 openipmi 或是freeipmi 的包,可根据需求选择安装。

 

(3)运行命令“ipmitool lan print”查看BMC配置信息,使用时若出现如下提示

Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

Get Device ID command failed

Unable to open SDR for reading

请依次执行以下命令加载ipmi驱动模块

# modprobe ipmi_msghandler

# modprobe ipmi_si

# modprobe ipmi_devintf

 

 

2、ipmitool常用操作

(1)查看BMC版本信息,使用命令“ipmitool mc info”。

(2)查看BMC配置信息,使用命令“ipmitool lan print”。

(3)重启BMC,使用命令“ipmitool mc reset <warm|cold>”(分为热复位和冷复位)。

(4)查看BMC用户信息,使用命令“ipmitool user list 1”。

(5)设置BMC用户密码,使用命令“ipmitool user set password 用户ID 新密码”。

(6)设置BMC IP获取方式,使用命令“ipmitool lan set 1 ipsrc <static|dhcp>”。

(7)设置BMC IP地址,使用命令“ipmitool lan set 1 ipaddr xxx.xxx.xxx.xxx”。

(8)设置BMC掩码地址,使用命令“ipmitool lan set 1 netmask xxx.xxx.xxx.xxx”。

(9)设置BMC默认网关IP地址,使用命令“ipmitool lan set 1 defgw ipaddr xxx.xxx.xxx.xxx”。

(10)查询watchdog的状态,使用命令“ipmitool mc watchdog get”。

(11)查询单板上电状态,使用命令“ipmitool chassis power status”(on-上电,off-下电)。

(12)控制单板下电,使用命令“ipmitool chassis power off”。

(13)控制单板上电,使用命令“ipmitool chassis power on”。

(14)控制单板复位,使用命令“ipmitool chassis power <cycle|reset>”。

 

ipmitool 关于主机几个状态的操作

1. 查看开关机状态:
ipmitool -H (BMC的管理IP地址) -I lanplus -U (BMC登录用户名) -P (BMC 登录用户名的密码) power status
2. 开机:
ipmitool -H (BMC的管理IP地址) -I lanplus -U (BMC登录用户名) -P (BMC 登录用户名的密码) power on
3. 关机:
ipmitool -H (BMC的管理IP地址) -I lanplus -U (BMC登录用户名) -P (BMC 登录用户名的密码) power off

 

FAQ

  1. 安装后执行ipmitool 报错怎么处理?

报错信息如下:

Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

 

答:

1)、ipmitool 命令执行需要root权限。

2)、解决办法:需要加载相关模块

 查看先关模块是否加载(可以看出模块未加载)

lsmod |grep ^ipmi

 

加载以下模块

modprobe ipmi_watchdog

modprobe ipmi_poweroff

modprobe ipmi_devintf

modprobe ipmi_si #加载该模块如果没有不影响ipmi的使用(与系统版本有关)

modprobe ipmi_msghandler #加载该模块如果没有不影响ipmi的使用

  

之后就可以正常使用了:

ipmitool lan print 1; #查看本机IPMI地址等信息

 

3) 如果出现

XXX@ubuntu:~$ sudo modprobe ipmi_si

modprobe: ERROR: could not insert 'ipmi_si': No such device

这是机器上没有IPMI设备而出现的报错

====================================================================================================

ipmi命令的帮助信息

[root@server2 monitordata]# ipmitool -h

ipmitool version 1.8.15

usage: 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 shell

        exec          Run list of commands from file

        set           Set runtime variable for shell and exec

        hpm           Update HPM components using PICMG HPM.1 file

        ekanalyzer    run FRU-Ekeying analyzer using FRU files

        ime           Update Intel Manageability Engine Firmware

====================================================================================================

 

 

延伸阅读:

以下内容转自:https://blog.csdn.net/iteye_19871/article/details/81832242

  1. 什么是IPMI? IPMI规范为平台管理子系统定义了标准化的抽象接口。这里的“平台管理(platform management)”用指平台硬件内置的监控和控制功能,以及主要用作监控系统硬件健康状况的功能。接受监控的元素包括:系统温度、电压、风扇、电源、总线错误、系统物理安全性等等。IPMI包括自动和手动恢复功能,比如本地或远程系统重启、电源开启/关闭等操作;还包括记录异常或故障日志,以供以后检查,在不具备运行时软件的情况下由平台发出警告的能力;还包括设备清单信息,以帮助识别故障硬件单元。(http://en.wikipedia.org/wiki/IPMI)
  2. 什么是FreeIPMI? FreeIPMI提供in-band 与out-of-band【注1】的IPMI软件实现,基于IPMI 1.5/2.0规范。IPMI规范定义了一系列平台管理的结构,并由一些系统管理厂商实现。用户会对IPMI的传感器监控、系统事件监控、电源控制、Serial-over-LAN (SOL)【注2】感兴趣。FreeIPMI就提供了这些方面的工具。很多可供大型高性能计算或集群的特性也在FreeIPMI中实现。 FreeIPMI和OpenIPMI、Ipmitool、Ipmiuitl都是IPMI规范的开源实现。
  3. FreeIPMI可在哪些操作系统上运行? FreeIPMI开发于GNU/Linux之上,可在Redhat、Fedora、Suse和Debian上构建成功。并已被移植到FreeBSD、OpenBSD、Solaris、OpenSolaris和Windows(通过Cygwin)之上。
  4. FreeIPMI与其他IPMI开源项目有哪些不同?
    1. 支持HPC
    2. 更多的OEM支持,包括Dell、Fujitsu、Inventec、Sun和Supermicro。
    3. 更多的灵活性和功能。FreeIPMI将IPMI的各个子部分实现为不同的工具,提供更多灵活性。
    4. 易于设置:以userspace程序库方式实现,无需构建、设置、管理任何kernel的模块和驱动。
    5. 可移植性
  5. FreeIPMI包括的工具和程序库 项目工具:
    1. Bmc-info:读取BMC 信息,包括设备版本号、设备支持和GUID。
    2. Bmc-config:配置一般的BMC【注3】和IPMI信息。支持用户名、密码、网络信息、安全、SOL和其他核心字段的配置。
    3. Bmc-watchdog:管理BMC watchdog的daemon。通常用作系统超时管理和系统出现崩溃时的自动重启。
    4. Ipmi-chassis:管理监控chassis【注4】的工具,比如chassis电源、识别(比如LED控制)和状态等等。
    5. Ipmi-fru:从主板和机器中读取可替换单元FRU(field replaceable unit)信息的工具。
    6. Ipmi-sel:读取和管理IPMI系统事件日志(SEL,system event log)的工具。SEL记录存储事件信息,对于调试问题有所帮助。
    7. Ipmi-sensors:读取IPMI传感器读数和传感器数据存储库(sensor data repository, SDR)信息的工具。
    8. Ipmipower:远程电源控制。
    9. Ipmiconsole:SOL控制工具。
    10. Ipmi-raw:提供IPMI命令16进制输入输出的工具。
    11. Ipmi-locate:探测BMC设备位置信息的工具,比如设备地址。
    12. Ipmimonitoring:传感器监控和解释工具。类似于ipmi-sensors,但是传感器读数已经经过分析,并映射到Nominal、Warning和Critical这几个状态中。
    13. Ipmi-pre-config:配置平台事件过滤(Platform Event Filtering,PEF)信息的工具。
    14. Ipmi-chassis-config:配置IPMI chassis信息。支持启动设备、电源恢复策略和其他chassis相关单元的配置。
    15. Ipmi-sensors-config:配置IPMI传感器,支持传感器阈值、传感器事件和其他传感器相关的信息。
    16. Ipmi-dcmi:执行数据中心可管理性接口(Data Center Manageability Interface,DCMI) IPMI扩展命令的工具。支持资产管理和电源使用率管理等扩展。
    17. Bmc-device:执行高阶BMC命令的工具。
    18. Ipmiping:供调试使用的IMPI ping工具。
    19. Rmcpping:供调试使用的RMCP ping工具。
    20. Ipmi-oem:执行OEM特定命令的IPMI工具。
    21. Ipmidetect/Ipmidetected:IPMI节点检测的工具和daemon。
    程序库
    1. Libfreeipmi:C程序库,包括KCS、SSIF和OpenIPMI Linux、Solaris BMC 驱动、IPMI 1.5、和IPMI 2.0 LAN通信接口、IPMI包构建实用工具、IPMI命令行实用工具、读取/解释/管理IMPI实用工具。
    2. Libimpiconsole:控制台SOL存取程序库。SOL控制台存取被抽象为文件描述符接口,用户可以通过文件描述符读取和写入控制台数据。
    3. Libipmimonitoring:传感器监控和解释程序库。传感器监控和解释被抽象为带有迭代器接口的API。
    4. Libmidetect:IPMI节点检测程序库。

注1: 从技术的角度,网络管理可分为带外管理(out-of-band)和带内管理(in-band)两种管理模式。所谓带内管理,是指网络的管理控制信息与用户网络的承载业务信息通过同一个逻辑信道传送;而在带外管理模式中,网络的管理控制信息与用户网络的承载业务信息在不同的逻辑信道传送。可参考: http://www.hudong.com/wiki/%E5%B8%A6%E5%86%85%E7%BD%91%E7%AE%A1

注2: Serial-over-LAN机制允许被管理系统的串行端口的输入和输入通过IP协议进行转发。 在有些被管理的系统中,尤其是刀片服务器系统中,受控计算机的串行端口并没有以传统方式连接到串行端口socket上。为了允许用户通过串行端口访问计算机上的应用,串行端口的输入和输出被重定向到网络中。比如,用户希望通过串口访问刀片服务器,并telnet到一个网络地址完成登录操作。在刀片服务器 ,登录会被看作来自串行端口。 SOL在IPMI中以RMCP+(Remote Management Control Protocol+)协议实现。

注3: BMC,baseboard management controller。集成在服务器主板上的专用微控制器,是IPMC架构的核心,管理系统管理软件和平台硬件之间的接口。系统中不同类型的传感器都要向BMC报告、提供参数,包括温度、风扇转速、电源状态、操作系统状态等等。BMC可以通过网络向系统管理员发出警告。SA也可以远程与BMC通信,以采取纠正措施。http://en.wikipedia.org/wiki/Baseboard_management_controller

注4: chassis本意为汽车底盘,在计算机领域中,chassis指主板、内存、磁盘等所在的坚硬框架。 说明:本文主要参考FreeIPMI FAQ

 

[root@server2 monitordata]# ipmitool -h ipmitool version 1.8.15usage: 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 Interfaceto 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 interfaceis the system one -a Prompt for remote password -Y Prompt for the Kg keyfor IPMIv2 authentication -e charSet SOL escape character -C ciphersuite Cipher suite to be used by lanplus interface -k key Use Kg keyfor IPMIv2 authentication -y hex_key Use hexadecimal-encoded Kg keyfor 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 andset power state power Shortcut to chassis power commands event Send pre-defined events to MC mc Management Controller status andglobal 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 shell exec Run list of commands from file setSet runtime variable for shell and exec hpm Update HPM components using PICMG HPM.1 file ekanalyzer run FRU-Ekeying analyzer using FRU files ime Update Intel Manageability Engine Firmware
posted @ 2022-10-16 18:02  Mars-Wu  阅读(848)  评论(0编辑  收藏  举报