Code

Fix for regex input of '|', being output causing problems with Nagios' parsing of
[nagiosplug.git] / contrib / check_lmmon.pl
1 #!/usr/bin/perl
2 # NetSaint Temp warning script
3 # Written by: Nathan LeSueur
5 if ($#ARGV < 1) {
6 print "Usage: $0 <critical temp> <warning temp> <normal temp>\n";
7 exit; } $crit = shift; $warn = shift; $norm = shift; if ($warn >
8 $crit) {    print "Warning level cannot be greater than critical
9 level!\n"; exit; } @b = qx{/usr/local/bin/lmmon -s}; foreach(@b) { @c
10 = split(/ \/ /, $_); $d = $c[1]; } @e = split(/F/, $d); $f = $e[0];
12 $status = "$f degrees F\n";
14 if($f >= $crit) {print "CRITICAL - $status"; exit 2;}
15 if($f >= $warn) {print "WARNING - $status"; exit 1;}
16 if($f <= $norm && $f != 0) {print "OK - $status"; exit 0;}
17 else{print "UNKNOWN - unable to access smb\n"; exit (-1);}