Intelligent Platform Management Interface Tool

2 minute read

Installing IPMI tool on RHEL/CentOS/Scientific Linux systems can be achieved with yum

sudo yum -y install ipmitool
sudo modprobe ipmi_devintf
sudo modprobe ipmi_si
sudo service ipmievd start

Setting the IP address

sudo ipmitool lan set 1 ipsrc static
sudo ipmitool lan set 1 ipaddr x.x.x.x
Setting LAN IP Address to 192.168.133.7
sudo ipmitool lan set 1 netmask 255.255.255.0
Setting LAN Subnet Mask to 255.255.255.0
sudo ipmitool lan set 1 defgw ipaddr 192.168.133.1
Setting LAN Default Gateway IP to 192.168.133.1
sudo ipmitool lan set 1 access on
sudo ipmitool bmc reset cold
Sent cold reset command to MC

Listing existing users

sudo ipmitool user list 1
ID  Name         Callin  Link Auth  IPMI Msg   Channel Priv Limit
1                    false   false      true       NO ACCESS
2   ADMIN            false   false      true       ADMINISTRATOR
3                    true    false      false      NO ACCESS
4                    true    false      false      NO ACCESS
5                    true    false      false      NO ACCESS
6                    true    false      false      NO ACCESS
7                    true    false      false      NO ACCESS
8                    true    false      false      NO ACCESS
9                    true    false      false      NO ACCESS
10                   true    false      false      NO ACCESS

Setting a new password

sudo ipmitool user set password 1
Password for user 1:
Password for user 1:
Set User Password command successful (user 1)

Listing setting status

sudo ipmitool sdr list

Listing the event Log

sudo ipmitool sel list

Monitoring IPMI events with Nagios

<%#
kind: snippet
name: omd-add.1
%>
echo << EOF >> /tmp/omd-add.sh
#!/bin/sh               
# A script to add a newly provisioned host to an Open Monitoring Distribution (OMD) server using the WATO API.

# Set the omd user (User must be configured with an automation secret on the OMD master)
user=

# Set the password (use the pwgen program to generate a strong password - pwgen -n 96 |sort)
secret=

omd=<nagios URI>/<site>/check_mk/webapi.py?
site=<site>
action=add_host
folder=<folder>
hostname=$(hostname)
ipaddr=$(/sbin/ip addr |grep eth0 |grep inet |cut -d ' ' -f6| sed 's/.$//' | sed 's/.$//' | sed 's/.$//')

# Print settings
echo 'The hostname being added is'
echo $hostname
echo 'The IP Address is'
echo $ipaddr
echo 'Adding host to this monitoring server'
echo $omd
echo $site

# Install agent packages from the EPEL repository
yum -y install epel-release check-mk-agent

# Make a copy of the original agent configuration
cp /etc/xinetd.d/check-mk-agent /etc/xinetd.d/check-mk-agent.orig

# Only allow the agent agent from localhost and the nagios server
sed -i 's/#only_from      = 127.0.0.1 10.0.20.1 10.0.20.2/only_from      = 127.0.0.1 192.168.133.0/24 /g' /etc/xinetd.d/check-mk-agent

# Restart the xinetd service
/sbin/service xinetd restart

# Enable xinetd as default
/sbin/chkconfig xinetd on

# Add host to nagios server
curl -u "${user}":"${secret}" "<nagios URI>/<site>/check_mk/webapi.py?&action="$action"&_username="$user"&_secret="$secret"" -d "'request={"attributes":{"alias": "$alias","tag_agent": "cmk-agent","tag_criticality": "prod","ipaddress": "$ipaddr"},"hostname": "$hostname","folder": "$folder"}'"
EOF

Tags:

Categories:

Updated: