#!/usr/bin/perl
#############################
# check_myups
# Mike Schilli, 2007
#############################
use strict;
use Log::Log4perl qw(:easy);
use Nagios::Clientstatus;

my $version = "0.01";
my $ncli    =
  Nagios::Clientstatus->new(
 help_subref => sub {
  print "usage: $0\n";
 },
 version        => $version,
 mandatory_args => [],
  );

my $data = `upsc elcheapo\@localhost ups.status`;

chomp $data;
my $status = "ok";

if ($data eq "OB") {
 $status = "critical";
}

print "UPS ", uc($status),
  " - $data\n";

exit $ncli->exitvalue(
 $status);
