[Nagiosplug-help] Small fix and modification for check_netapp

Charles Richmond cmr at iisc.com
Fri Sep 12 03:11:57 CEST 2008


FYI :)



Below is the diff of the check_netapp that corrects the negative numbers with volumes over 2TB and which converts output to GB for readability. The complete text can be found at http://www.iisc.com/check_netapp . The original check_netapp is by Ken Mckinlay with additional Nagios compatibility work by Ken Nerhood. My change is a relatively minor incremental one.

The result of the change can be seen in this output:
OLD/check_netapp -H x.x.x.x -C public -v DISKUSED -o /vol/vol_bpdimage/ -w 80 -c 90
DISKUSED OK - /vol/vol_bpdimage/ - total: 1090519040 Kb - used 589970728 Kb (54%) - free: 500548312 Kb|NetApp /vol/vol_bpdimage/ Used Space=589970728KB;872415232;981467136;0;1090519040

libexec/check_netapp -H x.x.x.x -C public -v DISKUSED -o /vol/vol_bpdimage/ -w 80 -c 90
DISKUSED OK - /vol/vol_bpdimage/ - total: 1040 Gb - used 562 Gb (54%) - free: 477 Gb|NetApp /vol/vol_bpdimage/ Used Space=562GB;832;936;0;1040

Note: I am calculating real GB using 1024*1024. If you want manufacturer's GB then change the '1048576' to '1000000' in the diff below.


[nagios at lrdcsvcdsk1 libexec]$ diff check_netapp ../OLD/check_netapp
39,46d38
< # Updated by Charles Richmond - http://www.iisc.com/
< # 2008.09.11
< #
< # Modified to correct negative values for volumes larger than
< # 2TB and modified 'sprintf' output to be Gb instead of Kb
< #
< #############################################################
< #
203,205c195,197
< my $used = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesUsed}{$key};
< my $total = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesTotal}{$key};
< my $avail = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesAvail}{$key};
---
> my $used = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesUsed}{$key};
> my $total = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesTotal}{$key};
> my $avail = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesAvail}{$key};
207,208c199,200
< $answer = sprintf("%s - total: %d Gb - used %d Gb (%d%%) - free: %d Gb",$volume,$total/1048576,$used/1048576,$percent,$avail/1048576);
< $perfdata = sprintf("NetApp %s Used Space=%dGB;%d;%d;0;%d",$volume,$used/1048576,$total/1048576*$warning/100,$total/1048576*$critical/100,$total/1048576);
---
> $answer = sprintf("%s - total: %d Kb - used %d Kb (%d%%) - free: %d Kb",$volume,$total,$used,$percent,$avail);
> $perfdata = sprintf("NetApp %s Used Space=%dKB;%d;%d;0;%d",$volume,$used,$total*$warning/100,$total*$critical/100,$total);
215,217c207,209
< my $used = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesUsed}{$key};
< my $total = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesTotal}{$key};
< my $avail = abs $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesAvail}{$key};
---
> my $used = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesUsed}{$key};
> my $total = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesTotal}{$key};
> my $avail = $snmpresponse{$snmpfilesysdfTabledfEntrydfKBytesAvail}{$key};
219,220c211,212
< $answer .= sprintf("%s - total: %d Gb - used %d Gb (%d%%) - free: %d Gb\n",$volume,$total/1048576,$used/1048576,$percent,$avail/1048576);
< $perfdata .= sprintf("NetApp %s Used Space=%dGB;%d;%d;0;%d",$volume,$used/1048576,$total/1048576*$warning/100,$total/1048576*$critical/100,$total/1048576);
---
> $answer .= sprintf("%s - total: %d Kb - used %d Kb (%d%%) - free: %d Kb\n",$volume,$total,$used,$percent,$avail);
> $perfdata .= sprintf("NetApp %s Used Space=%dKB;%d;%d;0;%d",$volume,$used,$total*$warning/100,$total*$critical/100,$total);
450d441
<
[nagios at lrdcsvcdsk1 libexec]$




More information about the Help mailing list