Thursday, 31 March 2011

Nagios - Smartmon monitoring

CHECK_SMARTMON

Define services

/usr/local/etc/nagios/objects/services.cfg

# SMART ad0
define service {
        use                             generic-service
        host_name                       host1,host2,host3
        service_description             nrpe_check_smart_ad0
        check_command                   check_nrpe2!check_smart_ad0
}

# SMART ad1
define service {
        use                             generic-service
        host_name                       host2
        service_description             nrpe_check_smart_ad1
        check_command                   check_nrpe2!check_smart_ad1
}

Edit Suoders
I add the following to /usr/local/etc/sudoers on the servers being monitored:
nagios          ALL=(ALL) NOPASSWD: /usr/local/libexec/nagios/check_smartmon -d /dev/ad*
nagios          ALL=(ALL) NOPASSWD: /usr/local/libexec/nagios/check_smartmon -d /dev/da*
Add to commands.cfg
command[check_smart_ad0]=/usr/local/bin/sudo /usr/local/libexec/nagios/check_smartmon -d /dev/ad0
command[check_smart_ad1]=/usr/local/bin/sudo /usr/local/libexec/nagios/check_smartmon -d /dev/ad1
 
ERROR:
superman@Nagi:/usr/local/nagios/libexec$ ./check_smartmon ?
-bash: ./check_smartmon: /usr/local/bin/python: bad interpreter: No such file or directory
If your smartmon don't work --> change the python path in your check_smartmon file - and remove the top
line which points to /usr/local/bin/python and replace with /usr/bin/python 
= Installation =
Adjust the first line to your Python binary (e.g. /usr/local/bin/python or
/usr/bin/python) and the path to your smartctl binary (e.g.
/usr/local/sbin/smartctl or /usr/sbin/smartctl).
 
Install Smartmon
sudo apt-get install smartmontools 
 
Check_smartmon Examples: 

No comments:

Post a Comment