Table of Contents

Prev  
 Next
, , , ,

IPMI CLI Tools

Much copied from Adam Sweet's wiki on IPMI.

What is IPMI?

IPMI is standard which allows remote server management, primarily developed by Intel. IPMI cards, known as Baseboard Management Cards (BMCs) are primitive computers in their own right and are operational all the time, so long as the server has a power source. The server itself does not need to be powered on, or the operating system operational for the BMC to work, it just needs a power source to be connected to the server.

The primary benefits of IPMI are:

Essentially, IPMI will save you purchasing a separate remote power control unit and SOL will save you purchasing an IP KVM, both of which would be quite expensive for the same functionality the IPMI provides.

Some downside of IPMI:

IPMI Revisions

There are currently 3 IPMI revisions (with details taken from http://www.ecst.csuchico.edu/~dranch/LINUX/IPMI/ipmi-on-linux.html):

IPMI version 2.0 is desirable as it allows you to use SOL to get a remote console on the server as though it were local in cases where the operating system locks up and SSH or (heaven forbid) telnet access are not available due to the operating system being inoperable. v2.0 also allows you to encrypt the contents of the IPMI packets sent to remote systems and so protects the BMC passwords and your commands on the network. IPMI v1.5 still allows to you to power the system on and off and view sensor output, but does not support packet encryption (and therefore sends your BMC password over the network in plain text) and does not support SOL in any standardised way. Both 2.0 and 1.5 are in common usage and are both still sold on new servers.

Usage:

Options:

IPMI BASH Scripts

IPMI Start Script

This script is used to start-up a remote BMC computer via ipmitool.

The script performs some basic error checking a reporting, of the ipmitool functions used. Once the ipmi start command has been issued the main computer is checked using the ping command to determine if it is actually up. The script exits with a 0 upon successful ping attempt or other error codes as noted in the code upon failure.

edit code: sudo vim Myscripts/ipmi_start_05_40.sh

to run script stand alone to start the remote computer: bash Myscripts/ipmi_start_05_40.sh ; echo $?

(the echo $? will return the error code, as per typical Unix, a 0 return indicates success.)

#!/bin/bash
 
BMC_IP="192.168.1.40"
User_Name="baumkp"
PW_file_location="/etc/ipmitool"
LAN_IP="192.168.1.5"
 
#Check if on
status_on="Chassis Power is on"
status_off="Chassis Power is off"
power_status=$(ipmitool -I lanplus -H $BMC_IP -U $User_Name -f $PW_file_location power status 2>/dev/null)
if [ ${?} -ne 0 ]
  then exit 11
  #error 11 means that the impitool power status return an error
  #ipmitool communication to remote machine did not function for any possible reason
fi
 
if [ "$power_status" == "$status_off" ]
  then
    ipmitool -I lanplus -H $BMC_IP -U $User_Name -f $PW_file_location power on &>/dev/null 2>/dev/null
    if [ $? -ne 0 ]
      then exit 12
      #error 12 means that the ipmi tool power on command returned an error code
    fi
    sleep 10
fi
 
for ((c=1; C<15; c++))
do
  ping -c1 -W1 -q $LAN_IP &>/dev/null
  if [ $? -eq 0 ]
    then
      exit 0
      # Successful communication to machine to be started!
    else
      sleep 10
  fi
done
exit 13
#exit code 13 means that the ping attempts were unsuccessful

IPMI Stop Script

This script is used to Soft Stop a remote BMC computer via ipmitool. This negates the need to place command directly on the computer in question.

The script performs some basic error checking and reporting, of the ipmitool functions used. Once the ipmi soft stop command has been issued the main computer is check using the ipmi power status command command to determine if it is actually down. The script exits with a 0 upon on successful attempt to verify actual power down or other error codes as noted in the code upon failure.

edit code: sudo vim ~/Myscripts/ipmi_stop_05_40.sh

to run script stand alone to soft stop the remote computer: bash ~/Myscripts/ipmi_stop_05_40.sh ; echo $?

(the echo $? will return the error code, as per typical Unix, a 0 return indicates success.)

#!/bin/bash
 
BMC_IP="192.168.1.40"
User_Name="baumkp"
PW_file_location="/etc/ipmitool"
LAN_IP="192.168.1.5"
 
#Check if on
status_on="Chassis Power is on"
status_off="Chassis Power is off"
power_status=$(ipmitool -I lanplus -H $BMC_IP -U $User_Name -f $PW_file_location power status 2>/dev/null)
if [ ${?} -ne 0 ]
  then exit 11
  #error 11 means that the impitool power status return an error
  #ipmitool communication to remote machine did not function for any possible reason
fi
 
if [ "$power_status" == "$status_on" ]
  then
    ipmitool -I lanplus -H $BMC_IP -U $User_Name -f $PW_file_location power soft &>/dev/null 2>/dev/null
    if [ $? -ne 0 ]
      then exit 12
      #error 12 means that the ipmi tool power on command returned an error code
    fi
    sleep 40
fi
 
for ((c=1; C<8; c++))
do
  power_status=$(ipmitool -I lanplus -H $BMC_IP -U $User_Name -f $PW_file_location power status 2>/dev/null)
  if [ ${?} -ne 0 ]
    then exit 11
    #error 11 means that the impitool power status return an error
    #ipmitool communication to remote machine did not function for any possible reason
  fi
 
  if [ "$power_status" == "$status_off" ]
    then
    exit 0
    # The machine is verified as shutdown
  fi
  sleep 30
  #wait another 30 seconds and check again 
done
 
exit 13
#exit code 13 means that the machine did not shutdown in the check time period

Test Script

#!/bin/bash
 
#Check if on
status_on="Chassis Power is on"
status_off="Chassis Power is off"
power_status=$(ipmitool -I lanplus -H 192.168.1.41 -U baumkp -f /etc/ipmitool power status &>/dev/null) ; echo $?
rc=$?
 
if ["$?" -ne "0"] then echo "Error" fi
 
 
#If off, turn on 
ipmitool -I lanplus -H 192.168.1.40 -U baumkp -f /etc/ipmitool power on
 
#Wait until running status returned
ipmitool -I lanplus -H 192.168.1.40 -U baumkp -f /etc/ipmitool power status
 
#Wait until OS is running
ping -c1 -W1 -q 192.168.1.10 &>/dev/null ; echo $?

IPMI List

Glossary

List of IPMI terms. Taken wholesale from http://www.ecst.csuchico.edu/~dranch/LINUX/IPMI/ipmi-on-linux.html

Below is a list of some links on IPMI CLI commands


Prev  
 Next