diff -ruN nagiosplug-save/contrib/check_netapp.pl nagiosplug/contrib/check_netapp.pl
--- nagiosplug-save/contrib/check_netapp.pl	2002-02-28 06:42:54.000000000 +0000
+++ nagiosplug/contrib/check_netapp.pl	2004-03-27 22:38:05.000000000 +0000
@@ -40,139 +40,112 @@
 #   F760                         9000
 ####################################
 
+require 5.004;
+use strict;
+use lib utils.pm ;
+use Plugin;
+use Plugin::Parameter qw(:DEFAULT :snmp);
+
 use Net::SNMP;
-use Getopt::Long;
-&Getopt::Long::config('auto_abbrev');
 
-my $status;
-my $response = "";
-my $TIMEOUT = 10;
-my $community = "public";
-my $port = 161;
-my $opsthresh = "3500";
-my $critical = "5000";
+use vars qw($opt_m $opt_o $opt_H $opt_C $opt_p $opt_t $PROGNAME);
 
-my $status_string = "";
+use utils qw(%ERRORS);
 
-my %OIDLIST = (
-		overtemp 	=> 	'1.3.6.1.4.1.789.1.2.4.1.0',
-		failedfan	=>	'1.3.6.1.4.1.789.1.2.4.2.0',
-		failedpsu	=>	'1.3.6.1.4.1.789.1.2.4.4.0',
-		nfsops		=>	'1.3.6.1.4.1.789.1.2.2.1.0'
+$p_opt->default("snmp");
+my $o_opt = new Plugin::Parameter(-name => "warningops", -flags => [ 'o', 'warnops' ],
+				  -optional => "yes", -valueoptional => "no", -type => "INTEGER",
+				  -default => 3500,
+				  -description => "Operations per second warning threshold");
+my $m_opt = new Plugin::Parameter(-name => "criticalops", -flags => [ 'm', 'critops' ],
+				  -optional => "yes", -valueoptional => "no", -type =>"INTEGER",
+				  -default => 5000,
+				  -description => "Operations per second critical threshold");
+my $plugin = new Plugin(-revision => '$Revision: 1.1.1.1 $',
+			-copyright => "2000 Leland E. Vandervort, Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment => "Perl NetApp filer plugin for Nagios",
+			-longcomment => "Monitor Network Appliance Filers, for overtemperature, fans operation, PSU function and NFS operations/second",
+			-parameterlists => [ [ $H_opt, $C_opt, $o_opt, $m_opt, $p_opt, $t_opt ], $h_opts, $V_opts ]);
+
+my %OIDLIST = (overtemp 	=> 	'1.3.6.1.4.1.789.1.2.4.1.0',
+	       failedfan	=>	'1.3.6.1.4.1.789.1.2.4.2.0',
+	       failedpsu	=>	'1.3.6.1.4.1.789.1.2.4.4.0',
+	       nfsops		=>	'1.3.6.1.4.1.789.1.2.2.1.0'
 	      );
 
 
 
-my %STATUSCODE = (  'UNKNOWN' => '-1',
-                    'OK' => '0',
-                    'WARNING' => '1',
-                    'CRITICAL' => '2');
-
+my $status_string = "";
 my $state = "UNKNOWN";
 
+$plugin->init();
 
-$SIG{'ALRM'} = sub {
-    print "ERROR: No snmp response from $hostname (sigALRM)\n";
-    exit($STATUSCODE{"UNKNOWN"});
-};
-
-alarm($TIMEOUT);                    
-
-sub get_nfsops {
-	my $nfsops_start = &SNMPGET($OIDLIST{nfsops});
-	sleep(1);
-	my $nfsops_end = &SNMPGET($OIDLIST{nfsops});
-	my $nfsopspersec = $nfsops_end - $nfsops_start;
-	return($nfsopspersec);
+my $tempcheck = &SNMPGET($OIDLIST{overtemp});
+if($tempcheck == 1) {
+  escalate_exitval('OK');
+  $status_string .= "Temp OK ";
+} else {
+  esclate_exitval('CRITICAL');
+  $status_string .= "Temp CRIT";
+}
+
+foreach my $element ('failedfan','failedpsu') {
+  my $my_return = &SNMPGET($OIDLIST{$element});
+  if(($my_return =~ /no/) || ($my_return == 0)) {
+    $status_string .= "$element = $my_return ";
+    escalate_exitval('OK');
+  } else {
+    $status_string .= "$element = $my_return ";
+    escalate_exitval('CRITICAL');
+  }
 }
 
+my $tmp_opssec = &get_nfsops();
 
-sub show_help {
-    printf("\nPerl NetApp filer plugin for Nagios\n");
-    printf("Usage:\n");
-    printf("
-  check_netapp [options] <hostname>
-  Options:
-    -c snmp-community
-    -p snmp-port
-    -o Operations per second warning threshold 
-    -m Operations per second critical threshold
-
-");
-    printf("Copyright (C)2000 Leland E. Vandervort\n");
-    printf("check_netapp comes with absolutely NO WARRANTY either implied or explicit\n");
-    printf("This program is licensed under the terms of the\n");
-    printf("GNU General Public License\n(check source code for details)\n\n\n");
-    exit($STATUSCODE{"UNKNOWN"});
-}
- 
-
-$status = GetOptions( "community=s", \$community,
-                      "port=i",      \$port,
-		      "opsthresh=i", \$opsthresh,
-		      "maxops=i",    \$critical );
-                     
-if($status == 0) {
-    &show_help;
+if ($tmp_opssec >= $opt_m) {
+  escalate_exitval('CRITICAL');
+} elsif ($tmp_opssec >= $opt_o) {
+  escalate_exitval('WARNING');
+} else {
+  escalate_exitval('OK');
 }
 
-sub SNMPGET {
-    $OID = shift;
-    ($session,$error) = Net::SNMP->session(
-        Hostname        =>      $hostname,
-        Community       =>      $community,
-        Port            =>      $port
-        );
-    if(!defined($session)) {
-        printf("$state %s\n", $error);
-        exit($STATUSCODE{$state});
-    }
-    if(!defined($response = $session->get_request($OID))) {
-        printf("$state %s\n", $session->error());
-        $session->close();
-	exit($STATUSCODE{$state});
-    }
-    $session->close();
-    return($response->{$OID});
-}
+$status_string .= "Ops\/Sec = $tmp_opssec ";
 
-$hostname = shift || &show_help;
+print "$PROGNAME $state $status_string\n";
+exit($ERRORS{$state});
 
-my $tempcheck = &SNMPGET($OIDLIST{overtemp});
-if($tempcheck == 1) {
-	$state = "OK";
-	$status_string .= "Temp OK ";
-}
-else {
-	$state = "CRITICAL";
-	$status_string .= "Temp CRIT";
-}
-
-foreach $element ('failedfan','failedpsu') {
-	my $my_return = &SNMPGET($OIDLIST{$element});
-	if(($my_return =~ /no/) || ($my_return == 0)) {
-		$status_string .= "$element = $my_return ";
-		$state = "OK";
-	}
-	else {
-		$status_string .= "$element = $my_return ";
-		$state = "CRITICAL";
-	}
+sub escalate_exitval {
+  my ($newstatus) = @_;
+  $state = $newstatus if ($ERRORS{$newstatus} > $ERRORS{$state});
 }
 
-my $tmp_opssec = &get_nfsops();
-
-if ($tmp_opssec >= $critical) {
-	$state = "CRITICAL";
-}
-elsif ($tmp_opssec >= $opsthresh) {
-	$state = "WARNING";
-}
-else {
-	$state = "OK";
+sub get_nfsops {
+  my $nfsops_start = &SNMPGET($OIDLIST{nfsops});
+  sleep(1);
+  my $nfsops_end = &SNMPGET($OIDLIST{nfsops});
+  my $nfsopspersec = $nfsops_end - $nfsops_start;
+  return($nfsopspersec);
 }
 
-$status_string .= "Ops\/Sec = $tmp_opssec ";
+sub SNMPGET {
+  my $OID = shift;
+  my ($session,$error) = Net::SNMP->session(-Hostname        =>      $opt_H,
+					    -Community       =>      $opt_C,
+					    -Port            =>      $opt_p,
+					    -Timeout         =>      $opt_t
+					   );
+  if(!defined($session)) {
+    printf("$PROGNAME $state: %s\n", $error);
+    exit($ERRORS{$state});
+  }
+  my $response = $session->get_request($OID);
+  if(!defined $response) {
+    printf("$PROGNAME $state: %s\n", $session->error());
+    $session->close();
+    exit($ERRORS{$state});
+  }
+  $session->close();
+  return($response->{$OID});
+}
 
-print "$state $status_string\n";
-exit($STATUSCODE{$state});
