星期五, 8月 07, 2015

Install Nagios on CentOS with DELL iDRAC script

My Nagios version is 3.5.1 and available to download from here.
http://sourceforge.net/projects/nagios/files/nagios-3.x/nagios-3.5.1/

check_iDRAC script could be downloaded from here
https://exchange.nagios.org/directory/Plugins/Network-and-Systems-Management/Check_iDRAC-for-DELL-iDRAC/details

MIB file could be downloaded from here.
http://dezoils.com/wp-content/uploads/2014/11/iDRAC-MIB.zip

-------------------------------------- How-To ----------------------------------

There are 2 systems in this instruction, 1 for CentOS (Host) and 1 for iDRAC device (DUT).

##########  DUT iDRAC port setting
                - connect to idrac web interface (log in of course)
                - in left side, go into the Overview / iDRAC settings / Network
                - in right side (from top panel), choose Services / SNMP Agent
                - make sure "Enabled" is checked
                - make sure "SNMP Protocol" is checked on option "All (SNMP v1/v2/v3)


##########  CentOS (Host)
- Install CentOS 7
                #yum search net-snmp (make sure you can see the package list, it's normal if there is a downloading process)
                #yum install net-snmp net-snmp-utils git -y
                #git clone https://github.com/dangmocrang/check_idrac
                #cd check_idrac
                #mv idrac_2.0b9 idrac_2.0b9.py
                #python idrac_2.0b9.py -h  (please check if it can print out the help page, if yes, the script works).
                copy IDRAC-MIB.mib file as attached to Desktop

                #pwd (confirm the current directly is "/root/check_idrac", if not, please do command "#cd /root/check_idrac")
                #mv idrac_2.0b9 idrac_2.0b9.py
                #python ./idrac_2.0b9.py -H $IP_Address -c public -m /home/dell/Desktop/IDRAC-MIB.mib –n –w mem
                it's very important, you have to get response like
----------------
Memory 1 (DIMM Socket A1) 2.00 GB/1600 MHz: ENABLED/OK [DDR3, Samsung, S/N: 234A70AF]
----------------




########## Nagios Installation
**copy attathed nagios-3.5.1.tar.gz and nagios-plugins-1.4.11.tar.gz to Desktop
su -
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
yum install   httpd php  gd gd-devel gcc glibc glibc-common openssl perl perl-devel make -y
cd /home/dell/Desktop
tar -xvzf nagios
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cp -rvf contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin   (set the password for "nagiosadmin" user)
systemctl start httpd.service
systemctl start nagios.service
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

cp /home/dell/Desktop/IDRAC-MIB.mib /usr/share/snmp/mibs/
cp /root/check_idrac/idrac_2.0b9.py /usr/local/nagios/libexec/
chown nagios.nagios /usr/local/nagios/libexec/idrac_2.0b9.py
echo "cfg_file=/usr/local/nagios/etc/objects/idrac.cfg" >> /usr/local/nagios/etc/nagios.cfg
touch /usr/local/nagios/etc/objects/idrac.cfg
gedit /usr/local/nagios/etc/objects/idrac.cfg
                - copy & past all contents list below (#### idrac.cfg file ###) into the file
                - then you need to modify $idrac_ip_address to real DUT (idrac) IP Address (there are 2 items)
                - then save it

service nagios restart

*** now you should be able to use Chrome to browse "http://CentOS_IP_Address/nagios/" and log in as user:nagiosadmin and password you just set.


$$$$$$ for multi-DUT (idrac) $$$$$$$$$$$
cd /usr/local/nagios/etc/objects

cp idrac.cfg idrac2.cfg
cp idrac.cfg idrac3.cfg

echo "cfg_file=/usr/local/nagios/etc/objects/idrac2.cfg" >> /usr/local/nagios/etc/nagios.cfg
echo "cfg_file=/usr/local/nagios/etc/objects/idrac3.cfg" >> /usr/local/nagios/etc/nagios.cfg

and you need to modify "/usr/local/nagios/etc/objects/idrac2.cfg,idrac3.cfg...etc" for the following items.
- host_name
- $idrac_ip_address
- command_name
- $idrac_ip_address
- host_name
- check_command
#service nagios restart
$$$$$$






#### idrac.cfg file ###
define host{
        host_name                       idrac-dut
        alias                           iDRAC Server
        address                         $idrac_ip_address
        check_command                   check-host-alive
        check_interval                  1
        retry_interval                  1
        max_check_attempts              5
        check_period                    24x7
        process_perf_data               0
        retain_nonstatus_information    0
        contact_groups                  admins
        notification_interval           1
        notification_period             24x7
        notification_options            d,u,r
        }

define command{
command_name    check-idrac
command_line   python /usr/local/nagios/libexec/idrac_2.0b9.py -H $idrac_ip_address -c public -m /usr/share/snmp/mibs/IDRAC-MIB.mib -n | tee /tmp/test.log
}


define service{
host_name       idrac-dut
service_description     OnlyForTesting
check_command   check-idrac
max_check_attempts      5
check_interval  1
retry_interval  1
check_period    24x7
notification_interval   3
notification_period     24x7
notification_options    w,c,r
contacts        nagiosadmin
contact_groups  admins
        }


-------------------------------------- End of How-To ----------------------------------

沒有留言: