Re: [Mon-devel] [Mon-commit] mon/mon.d netappdiskfail.monitor, 1.1, 1.2
Brought to you by:
trockij
From: Augie S. <aug...@gm...> - 2008-03-10 23:15:55
|
I created a new monitor to check for failed disks in NetApps; it's based on the netappfree.monitor. I meant to just check it into the devel branch, but I ended up putting it in both stable and devel.; hopefully not a big deal. --Augie On Mon, Mar 10, 2008 at 3:12 PM, Augie Schwer <as...@us...> wrote: > Update of /cvsroot/mon/mon/mon.d > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21048 > > Added Files: > netappdiskfail.monitor > Log Message: > Created a new monitor to check for failed NetApp disks. > > --- NEW FILE: netappdiskfail.monitor --- > #!/usr/bin/perl > # > # Use SNMP to get disk failures from a NetApp. > # > # USAGE > # [--community=<SNMP COMMUNITY>] [--timeout=<seconds>] [--retries=<count>] host1 host2 ... > > # sample invocation in mon.cf, with local MIB directory for the Netapp MIB > # NETWORK-APPLIANCE-MIB.txt (copy from /etc/mib/netapp.mib on filer): > # service diskfree > # description test disk failure on Netapp filers > # depend SELF:ping > # MIBDIRS=/usr/local/share/snmp/mibs > # interval 7m > # monitor netappdiskfail.monitor > > # > # This requires the UCD SNMP library and G.S. Marzot's Perl SNMP > # module. > # > > use strict; > > use SNMP; > use Getopt::Long; > > $ENV{"MIBS"} = 'RFC1213-MIB:NETWORK-APPLIANCE-MIB'; > > my %opt = (); > > GetOptions (\%opt, "community=s", "timeout=i", "retries=i"); > > die "no host arguments\n" if (@ARGV == 0); > > my $RET = 0; > my @ERRS = (); > my %HOSTS = (); > > my $COMM = $opt{"community"} || "public"; > my $TIMEOUT = $opt{"timeout"} || 2; $TIMEOUT *= 1000 * 1000; > my $RETRIES = $opt{"retries"} || 5; > > my $sess; > > foreach my $host (@ARGV) { > if (!defined($sess = new SNMP::Session (DestHost => $host, > Timeout => $TIMEOUT, Community => $COMM, > Retries => $RETRIES, > Version => 1))) { > $RET = 1; > $HOSTS{$host} ++; > push (@ERRS, "could not create session to $host: " . $SNMP::Session::ErrorStr); > next; > } > > if ($sess->get('diskFailedCount.0') > 0) { > $HOSTS{$host} ++; > push (@ERRS, "Disk failure - " . $sess->get('diskFailedCount.0') . " failed disk(s)."); > push (@ERRS, $sess->get('diskFailedMessage.0')); > $RET = 1; > } > } > > if ($RET) { > print join(" ", sort keys %HOSTS), "\n\n", join("\n", @ERRS), "\n"; > } > > exit $RET; > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Mon-commit mailing list > Mon...@li... > https://lists.sourceforge.net/lists/listinfo/mon-commit > -- Augie Schwer - Augie@Schwer.us - http://schwer.us Key fingerprint = 9815 AE19 AFD1 1FE7 5DEE 2AC3 CB99 2784 27B0 C072 |