Networker

[Networker] Nagios Plugin for Tape Libraries...

2010-03-10 02:39:11
Subject: [Networker] Nagios Plugin for Tape Libraries...
From: Anacreo <anacreo AT GMAIL DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Wed, 10 Mar 2010 01:37:57 -0600
So I'm stuck at the office and this plugin we wrote has been such a
lifesaver, I figured I'd give it out to the community...

Here is our GroundWork GDMA external command, you may have to use your own
mechanism for running this on a vanilla Nagios environment...

Check_networker_edl[1]_Enable="ON"
Check_networker_edl[1]_Service="check_networker_edl"
Check_networker_edl[1]_Command="check_networker_edl.pl full 10 5"

Basically run the command...

"check_networker_edl.pl full 10 5"

10TB left is a WARNING
5TB left is a CRITICAL


Here is the check command we use (note that the EDL name is hard coded into
the program, please feel free to improve it):
cat check_networker_edl.pl
#!/usr/bin/perl
    use strict;
    use warnings;
    my $pool = $ARGV[0];
    my $warnvalue = $ARGV[1];
    my $critvalue = $ARGV[2];

    my @info = qx(/bin/echo "show current capacity\nprint type: NSR jukebox
; name: *EDL*" | /usr/sbin/nsradmin -i -);
    my $lista = join ('',@info);
    my @pools = split(',',$lista);
    #print "$pools[0] \n";
    if ($#ARGV < 2) {
                      die "Usage: check_networker_edl.pl pool warnvalue
critvalue \n";
                    }#end if


    if ($pool eq "full")
       {
         my @full_s = split(' ',$pools[0]);
         my $full_v = $full_s[2];
         for ($full_s[3])
             {
               if ($full_s[3] eq "GB") { $full_v = ($full_v/1024);
$full_s[3]='TB';}
               elsif ($full_s[3] eq "KB") { $full_v = (($full_v/1024)/1024);
$full_s[3]='TB'; }
               else { $full_v = $full_s[2] }

             }
         for ($full_v)
             {
             if ($full_v < $critvalue) { print "CRITICAL - Storage space on
the *EDL* lower than the critical value of $critvalue $full_s[3] Free:
$full_v $full_s[3] \n"; exit 2; }
             if ($full_v < $warnvalue) { print "WARNING - Storage space on
the *EDL* lower than the warning value of $warnvalue $full_s[3] Free:
$full_v $full_s[3] \n"; exit 1; }
             else { print "OK - Storage space is OK for the* EDL* Free:
$full_v $full_s[3]\n"; exit 0; }
             }

       }

Here is the output from the running plugin:
# ./check_networker_edl.pl full 10 5
WARNING - Storage space on the EDL lower than the warning value of 10 TB
Free: 6.013671875 TB

To sign off this list, send email to listserv AT listserv.temple DOT edu and 
type "signoff networker" in the body of the email. Please write to 
networker-request AT listserv.temple DOT edu if you have any problems with this 
list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

<Prev in Thread] Current Thread [Next in Thread>
  • [Networker] Nagios Plugin for Tape Libraries..., Anacreo <=