01 #!/usr/bin/perl 02 ############################# 03 # check_myups 04 # Mike Schilli, 2007 05 ############################# 06 use strict; 07 use Log::Log4perl qw(:easy); 08 use Nagios::Clientstatus; 09 10 my $version = "0.01"; 11 my $ncli = 12 Nagios::Clientstatus->new( 13 help_subref => sub { 14 print "usage: $0\n"; 15 }, 16 version => $version, 17 mandatory_args => [], 18 ); 19 20 my $data = `upsc elcheapo\@localhost ups.status`; 21 22 chomp $data; 23 my $status = "ok"; 24 25 if ($data eq "OB") { 26 $status = "critical"; 27 } 28 29 print "UPS ", uc($status), 30 " - $data\n"; 31 32 exit $ncli->exitvalue( 33 $status);