Friday, 9 September 2011

Netapp monitoring with check_netapp.pl

In my previous post  I showed how to enable Nagios to monitor a Netapp device. The only issue that you may have noticed is the output of the Nagios check. Having Nagios return “SMNP 73 OK” is not a particularly interesting result. We would also like some performance metrics so RRDTool can graph it on Nagios.
So how can we achieve this? Nagios Exchange provides netapp.pl which is a Perl script which allows you to monitor disk usage and formats the results in to a reasonable format. The script takes several arguments by default:
/opt/nagios/libexec/check_netapp.pl
Missing arguments!
check_netapp -H <ip_address> -v variable [-w warn_range] 
[-c crit_range]
 [-C community] [-t timeout] [-p port-number]
 [-P snmp version] [-L seclevel] [-U secname] [-a authproto]
 [-A authpasswd] [-X privpasswd] [-o volume]
The ones we are interested in are
-H <ip_address>
-v <variable>
-o <volume>
-w -c <warn_range crit_range>
-t <timeout>
So for our test volume we would like to check the disk usage so we would execute the following command to check the diskspace used:
/opt/nagios/libexec/check_netapp.pl -H netapp -v DISKUSED 
-o /vol/test/ -w 60 -c 70 -t 60
 DISKUSED CRITICAL - /vol/test/ - total: 600 Gb - used 501 
Gb (84%) - free: 98 Gb|NetApp 
/vol/test/ Used Space=501GB;360;420;0;600
This provides a much nicer output that the standard SNMP result. So to have Nagios use this command we add the command to the commands.cfg file:
define command{
        command_name check-test-volume
        command_line $USER1$/check_netapp.pl -H netapp -v 
DISKUSED -o /vol/test/ 
-w 80 -c 90 -t 60
}
After this is added we add the service to our groups config file:
define service
        use                             netapp-template-unix
        host_name                       netapp
        service_description             Check Test Volume Disk 
Space
        check_command                   check-test-volume
}
To activate this check restart Nagios and wait for the monitoring results to appear on our Nagios site. If you have RRDTool and pnpnagios installed they should begin graphing the results shortly after the first checks are recieved.

No comments:

Post a Comment