Linux/ipmitool: Difference between revisions

From Omnia
Jump to navigation Jump to search
 
Line 45: Line 45:
  10.10.10.10: off
  10.10.10.10: off


  ipmitool -H MYSERVER -U ADMIN -P ADMIN power status
  ipmitool -H MYSERVER -U MYUSER -P MYPASS power status


Power status can be used at non ADMIN level.  To call with a user that is only OPERATOR level and on a LANPLUS interface:
Power status can be used at non ADMIN level.  To call with a user that is only OPERATOR level and on a LANPLUS interface:
  ipmitool -L operator -I lanplus -H MYSERVER -U ADMIN -P ADMIN power status
  ipmitool -L operator -I lanplus -H MYSERVER -U MYUSER -P 'MYPASS' power status
   # or -L OPERATOR -I lanplus
   # or -L OPERATOR -I lanplus
Equivalent with ipmipower
ipmipower -D LAN_2_0 -h i-MYSERVER -u MYUSER -p 'MYPASS' --stat


=== Power On and Off ===
=== Power On and Off ===

Latest revision as of 15:51, 13 August 2024

ipmitool

ipmitool - utility for controlling IPMI-enabled devices


Configuring IPMI under Linux using ipmitool - Thomas-Krenn-Wiki - https://www.thomas-krenn.com/en/wiki/Configuring_IPMI_under_Linux_using_ipmitool

Installation

Easy way:

yum install ipmitool
apt-get install ipmitool
# for ipmipower tool:
yum install freeipmi
apt-get install freeipmi-tools

Harder way (source code): (http://sourceforge.net/projects/ipmitool/)

yum install gcc make compat-glibc-headers
wget http://downloads.sourceforge.net/project/ipmitool/ipmitool/1.8.14/ipmitool-1.8.14.tar.bz2
tar -jvxf ipmitool-1.8.14.tar.bz2
ipmitool-1.8.14
./configure
make clean
make && make install

Load kernel module

modprobe ipmi_devintf    # CentOS 6.5 module name

Should create: /dev/ipmi0

Usage

References:

Get Power Status

$ ipmipower -h 10.10.10.10 -u ADMIN -p ADMIN -s
10.10.10.10: on
10.10.10.10: off
ipmitool -H MYSERVER -U MYUSER -P MYPASS power status

Power status can be used at non ADMIN level. To call with a user that is only OPERATOR level and on a LANPLUS interface:

ipmitool -L operator -I lanplus -H MYSERVER -U MYUSER -P 'MYPASS' power status
  # or -L OPERATOR -I lanplus

Equivalent with ipmipower

ipmipower -D LAN_2_0 -h i-MYSERVER -u MYUSER -p 'MYPASS' --stat

Power On and Off

ipmitool -H MYSERVER -U ADMIN -P ADMIN power on
ipmitool -H MYSERVER -U ADMIN -P ADMIN power off

Get BIOS Status

For Supermicro

ipmitool -H 10.10.10.10 -U ADMIN -P ADMIN raw 0x30 0x2a
aa / fe - ok finished bios (depending on model)
72 - off
91 - Stuck at "DXE--BIOS PCI Bus Enumeration..."
94 - Stuck at "?"
...many other codes... - system in various states of bios loading

Reboot System

ipmitool -H 10.10.10.10 -U ADMIN -P ADMIN power on
ipmitool -H 10.10.10.10 -U ADMIN -P ADMIN power off
ipmitool -H 10.10.10.10 -U ADMIN -P ADMIN power cycle
ipmipower -h 10.10.10.10 -u ADMIN -p ADMIN --on  # -n
ipmipower -h 10.10.10.10 -u ADMIN -p ADMIN --off  # -f
ipmipower -h 10.10.10.10 -u ADMIN -p ADMIN --cycle  # -c
ipmipower -h 10.10.10.10 -u ADMIN -p ADMIN -r  # --reset
ipmipower -h i-mynode -u ADMIN -p ADMIN -r --on-if-off

Note: ipmipower is part of the freeipmi-tools package

ipmi network address

ipmitool lan print
ipmitool lan print | grep "IP Address"


Change to Static Address:

ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 10.10.10.10
ipmitool lan set 1 netmask 255.255.255.0
ipmitool lan set 1 defgw ipaddr 10.10.10.1

Change to Dynamic Address:

ipmitool lan set 1 ipsrc dhcp
# reset firmware:
ipmitool mc reset cold


Ref: [1]

Sensor Data

sdr command - Print Sensor Data Repository entries and readings

# ipmitool sdr
P0 Temp          | 36 degrees C      | ok
P1 Temp          | 36 degrees C      | ok
P0 TjMax         | 86 degrees C      | ok
P1 Tjmax         | 86 degrees C      | ok
...

sensor command - Print detailed sensor information

# ipmitool sensor
P0 Temp          | 37.000     | degrees C  | ok    | na        | na        | na        | na        | 84.000    | na
P1 Temp          | 36.000     | degrees C  | ok    | na        | na        | na        | na        | 84.000    | na
P0 TjMax         | 86.000     | degrees C  | ok    | na        | na        | na        | na        | na        | na
P1 Tjmax         | 86.000     | degrees C  | ok    | na        | na        | na        | na        | na        | na
...

IPMI Reboot

ipmitool mc reset cold
ipmitool mc reset warm

Control Remote BMC

ipmitool -I lanplus -H [BMC_ADDRESS] -U USERID -P [PASSWORD] sensor

Note, my configuration was incorrect and this would timeout:

# ipmitool -I lanplus -H i-myserver -U USERID -P mypassword sensor
Error: Unable to establish IPMI v2 / RMCP+ session
Get Device ID command failed
Unable to open SDR for reading

Set Next Boot Device

Get Current Boot Device

Get the current boot device

ipmitool -H $IPMI_HOST -U $IPMI_USER chassis bootparam get 5 

Should likey list something like:

- BIOS PC Compatible (legacy) boot

---

Before setting PXE:

 Boot Flags :
   - Boot Flag Invalid
   - Options apply to only next boot
   - BIOS PC Compatible (legacy) boot
   - Boot Device Selector : No override

After setting PXE:

 Boot Flags :
   - Boot Flag Valid
   - Options apply to only next boot
   - BIOS PC Compatible (legacy) boot
   - Boot Device Selector : Force PXE

---

For reference: [1]

bootparam

Get or set various system boot option parameters.

get

Get boot parameter. Currently supported values for are:

    0 - Set In Progress
    1 - Service Partition Selector
    2 - Service Partition Scan
    3 - BMC Boot Flag Valid Bit Clearing
    4 - Boot Info Acknowledge
    5 - Boot Flags
    6 - Boot Initiator Info
    7 - Boot Initiator Mailbox

Note: 5 is really the only option that returns anything of interest

Force PXE

Set Boot Device to force_pxe [2]

ipmitool chassis bootparam set bootflag force_pxe

Other options:

 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

---

If you want it to persist: options=persistent

ipmitool chassis bootdev cdrom options=persistent

---

If you want UEFI:

ipmitool chassis bootdev pxe options=efiboot
#or
ipmitool chassis bootdev pxe options=efiboot,persistent

IPMIv2 LanPlus

Use IPMIv2 with LanPlus:

ipmitool -I lanplus ...

i2c access

If you know the bus and address of a target i2c device: (server/device specific)

usage: i2c [bus=public|# [chan=#] <i2caddr> <read bytes> [write data]

Example: (temperature sensor, there is a conversion required to get to C)

# ipmitool i2c bus=1 0x3e 1 1
 38
00111000

User List

ipmitool user list [CHANNEL_NUMBER]
# ipmitool user list 1
ID  Name             Callin  Link Auth  IPMI Msg   Channel Priv Limit
1                    true    false      true       USER
2   USERID           true    false      true       ADMINISTRATOR
3   root             true    false      false      ADMINISTRATOR

Password

ipmitool user list
#ipmitool user set password <USERID> [PASSWORD]

Add admin user: [2]

ipmitool user list
ipmitool user set name 3 ADMIN
ipmitool user set password 3  # enter 'ADMIN'
ipmitool channel setaccess 1 3 link=on ipmi=on callin=on privilege=4
ipmitool user enable 3


Password is too long (> 20 bytes)

Chassis Status

# ipmitool chassis status
System Power         : on
Power Overload       : false
Power Interlock      : inactive
Main Power Fault     : false
Power Control Fault  : false
Power Restore Policy : always-on
Last Power Event     :
Chassis Intrusion    : inactive
Front-Panel Lockout  : inactive
Drive Fault          : false
Cooling/Fan Fault    : false
Sleep Button Disable : not allowed
Diag Button Disable  : not allowed
Reset Button Disable : allowed
Power Button Disable : allowed
Sleep Button Disabled: false
Diag Button Disabled : false
Reset Button Disabled: false
Power Button Disabled: false

Chassis Power

# ipmitool chassis power
chassis power Commands: status, on, off, cycle, reset, diag, soft
# ipmitool chassis power status
Chassis Power is on
# ipmitool chassis reset

Example:

ipmipower -I lanplus -H HOST -U USER -P 'PASS' power off

FRU

Field Replaceable Units (FRU) information:

fru command - Print built-in FRU and scan SDR for FRU locators

# ipmitool fru
FRU Device Description : Builtin FRU Device (ID 0)
 Chassis Type                    : Rack Mount Chassis
 Chassis Serial                  : XXXXXXXXXXXXX
 Chassis Extra                   : XXXXXXXXXXXXX
 Chassis Extra                   : XXXXXXXXXXXXX
 Board Mfg Date        : Wed May 28 11:53:00 2014
 Board Mfg             : XXX
 Board Product         : XXX
 Board Serial          : XXXXXXXXXXXXX
 Board Part Number     : XXXXXXXXXXXXX
 Board Extra           : XXX
 Product Manufacturer  : XXX
 Product Name          : XXX
 Product Part Number   : XXXXXXXXXXXXX
 Product Asset Tag     : XXX
 Product Extra         : XXX
 Product Extra         : PVT
 Product Extra         : 2014-05-28 15:53:46

XXX - removed info as this sample is from a prototype server, not released

shell

Interactive shell (same as running commands from command line)

# ipmitool shell
ipmitool> help
...

Commands

# ipmitool
No command provided!
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
        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

ESXi

Get IPMI Address from ESXi Shell

~ # enum_instances OMC_IPMIIPProtocolEndpoint root/cimv2 | grep IPv4Address
                   IPv4Address = 10.10.10.100

Ref: [3]

Issues

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

Driver not loaded, or system does not support. If driver was just not loaded, try this (sometimes happens after initial install):

modprobe ipmi_devintf

keywords