File: check_lmmon.pl

package info (click to toggle)
nagios-plugins 1.4.5-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 6,520 kB
  • ctags: 3,564
  • sloc: ansic: 34,372; perl: 12,573; sh: 10,669; python: 444; makefile: 440; awk: 45
file content (19 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
# NetSaint Temp warning script
# Written by: Nathan LeSueur

if ($#ARGV < 1) {
print "Usage: $0 <critical temp> <warning temp> <normal temp>\n";
exit; } $crit = shift; $warn = shift; $norm = shift; if ($warn >
$crit) {    print "Warning level cannot be greater than critical
level!\n"; exit; } @b = qx{/usr/local/bin/lmmon -s}; foreach(@b) { @c
= split(/ \/ /, $_); $d = $c[1]; } @e = split(/F/, $d); $f = $e[0];

$status = "$f degrees F\n";

if($f >= $crit) {print "CRITICAL - $status"; exit 2;}
if($f >= $warn) {print "WARNING - $status"; exit 1;}
if($f <= $norm && $f != 0) {print "OK - $status"; exit 0;}
else{print "UNKNOWN - unable to access smb\n"; exit (-1);}