4 # Copyright (C) 2000 Leland E. Vandervort <leland@mmania.com>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty
13 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # you should have received a copy of the GNU General Public License
17 # along with this program (or with Nagios); if not, write to the
18 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA
20 ####################################
21 # checks for overtemperature, fans, psu, and nfs operations/second on
22 # Network Appliance Filers.
24 # OK if temp, fans, psu OK and Ops/Sec below warning and critical
25 # Thresholds (default is warning=3500, critical=5000)
26 # ** Note: See the specifications for your Filer model for
28 # Returns Warning if NFS Ops/Sec is above warning threshold
29 # (default 3500, or specified by -o command line option)
30 # Returns Critical if NFS Ops/Sec is above critical threshold
31 # ( -m option, or default 5000), or if overtem, psufault, or
34 ####################################
35 # Notes on operational limits for NetApp Filers:
36 # Platform Maximum Ops/Second (recommended)
37 # -------------------------------------------------------------
41 ####################################
45 &Getopt
::Long
::config
('auto_abbrev');
50 my $community = "public";
52 my $opsthresh = "3500";
53 my $critical = "5000";
55 my $status_string = "";
58 overtemp
=> '1.3.6.1.4.1.789.1.2.4.1.0',
59 failedfan
=> '1.3.6.1.4.1.789.1.2.4.2.0',
60 failedpsu
=> '1.3.6.1.4.1.789.1.2.4.4.0',
61 nfsops
=> '1.3.6.1.4.1.789.1.2.2.1.0'
66 my %STATUSCODE = ( 'UNKNOWN' => '-1',
71 my $state = "UNKNOWN";
75 print "ERROR: No snmp response from $hostname (sigALRM)\n";
76 exit($STATUSCODE{"UNKNOWN"});
82 my $nfsops_start = &SNMPGET
($OIDLIST{nfsops
});
84 my $nfsops_end = &SNMPGET
($OIDLIST{nfsops
});
85 my $nfsopspersec = $nfsops_end - $nfsops_start;
86 return($nfsopspersec);
91 printf("\nPerl NetApp filer plugin for Nagios\n");
94 check_netapp [options] <hostname>
98 -o Operations per second warning threshold
99 -m Operations per second critical threshold
102 printf("Copyright (C)2000 Leland E. Vandervort\n");
103 printf("check_netapp comes with absolutely NO WARRANTY either implied or explicit\n");
104 printf("This program is licensed under the terms of the\n");
105 printf("GNU General Public License\n(check source code for details)\n\n\n");
106 exit($STATUSCODE{"UNKNOWN"});
110 $status = GetOptions
( "community=s", \
$community,
112 "opsthresh=i", \
$opsthresh,
113 "maxops=i", \
$critical );
121 ($session,$error) = Net
::SNMP
->session(
122 Hostname
=> $hostname,
123 Community
=> $community,
126 if(!defined($session)) {
127 printf("$state %s\n", $error);
128 exit($STATUSCODE{$state});
130 if(!defined($response = $session->get_request($OID))) {
131 printf("$state %s\n", $session->error());
133 exit($STATUSCODE{$state});
136 return($response->{$OID});
139 $hostname = shift || &show_help
;
141 my $tempcheck = &SNMPGET
($OIDLIST{overtemp
});
142 if($tempcheck == 1) {
144 $status_string .= "Temp OK ";
148 $status_string .= "Temp CRIT";
151 foreach $element ('failedfan','failedpsu') {
152 my $my_return = &SNMPGET
($OIDLIST{$element});
153 if(($my_return =~ /no/) || ($my_return == 0)) {
154 $status_string .= "$element = $my_return ";
158 $status_string .= "$element = $my_return ";
163 my $tmp_opssec = &get_nfsops
();
165 if ($tmp_opssec >= $critical) {
168 elsif ($tmp_opssec >= $opsthresh) {
175 $status_string .= "Ops\/Sec = $tmp_opssec ";
177 print "$state $status_string\n";
178 exit($STATUSCODE{$state});