diff -ruN nagiosplug-save/contrib/check_disk_snmp.pl nagiosplug/contrib/check_disk_snmp.pl
--- nagiosplug-save/contrib/check_disk_snmp.pl	2002-08-13 00:09:48.000000000 +0100
+++ nagiosplug/contrib/check_disk_snmp.pl	2004-03-27 21:55:43.000000000 +0000
@@ -1,74 +1,140 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -wT
 # cm@financial.com 07/2002
-use strict;
-use Net::SNMP;
-use Getopt::Std;
-
-my %opts =(
-        u => 'nobody',          # snmp user
-        l => 'authNoPriv',      # snmp security level   
-        a => 'MD5',             # snmp authentication protocol
-        A => 'nopass',          # authentication protocol pass phrase.
-        x => 'DES',             # privacy protocol
-        m => 'localhost',       # host 
-        d => 1,         # devicenumber
-        w => 70,                # warnratio
-        c => 85,                # critical ratio
-        h => 0,
-        );
-
-getopts('m:u:l:a:A:x:d:w:c:h',\%opts);
-
-if ( $opts{'h'} ) {
-	print "Usage: $0 [ -u <username> ] [ -l <snmp security level>] [ -a <snmp authentication protocol> ] [ -A <authentication protocol pass phrase> ] [ -x <snmp privacy protocol> ] [ -m <hostname>] [ -d <devicenumber> ] [ -w <warning ratio> ] [ -c <critical ratio ]\n";
-	exit 1;
-}
-
-if ($opts{'w'} >= $opts{'c'}) {
-	print "Errorratio must be higher then Warnratio!\n";
-	exit 1;
-}
 
-my ($session, $error) = Net::SNMP->session(
-	-hostname	=>	$opts{'m'},
-	-nonblocking	=>	0x0,
-	-username	=>	$opts{'u'},
-	-authpassword	=>	$opts{'A'},
-	-authprotocol	=>	$opts{'a'},
-	-version	=>	'3',
-	);
-
-if ($@) {
-	print "SNMP-Error occured";
-	exit 1;
-}
-my $result=undef;
 
+require 5.004;
+use POSIX;
+use strict;
+use lib utils.pm ;
+use Plugin;
+use Plugin::Parameter qw($helpparameterlist $versionparameterlist $hostnameparameter
+			 $userparameter $warningparameter $criticalparameter
+
+			 $communityparameter
+			 $authprotocolparameter $authpasswordparameter $authkeyparameter
+			 $privprotocolparameter $privpasswordparameter $privkeyparameter
+			 $snmpversionparameter
 
-my $deviceSize=".1.3.6.1.2.1.25.2.3.1.5.$opts{'d'}";
-my $deviceUsed=".1.3.6.1.2.1.25.2.3.1.6.$opts{'d'}";
-my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$opts{'d'}";
-my @OID=($deviceSize, $deviceUsed, $deviceName);
-$result = $session->get_request(
-	-varbindlist => \@OID,
-	);
+			 $timeoutparameter $portparameter $verboseparameter);
+use Net::SNMP;
 
-if (!defined($result)) {
-	printf("ERROR: %s.\n", $session->error);
-	$session->close;
-	exit 1;
+use vars qw($opt_P $opt_V $opt_h $opt_m $opt_s
+	    $opt_W $opt_u $opt_p $opt_w $opt_c
+	    $opt_d $opt_x $opt_K $opt_k $opt_A
+	    $opt_a $opt_C $opt_S $opt_t
+	    $opt_v $xml $PROGNAME);
+
+use utils qw(%ERRORS &usage);
+
+$ENV{'PATH'}='';
+$ENV{'BASH_ENV'}='';
+$ENV{'ENV'}='';
+
+$hostnameparameter->flags([ 'm', @{$hostnameparameter->flags()} ]);
+
+$userparameter->default('nobody');
+$authprotocolparameter->default('MD5');
+$privprotocolparameter->default('DES');
+$portparameter->default(161);
+$warningparameter->default(70);
+$warningparameter->description("Percentage disk space used before Warning status occurs");
+$criticalparameter->default(85);
+$criticalparameter->description("Percentage disk space used before Critical status occurs");
+
+my $devicenumberparameter = new Plugin::Parameter(-name => "devicenumber", -flags => [ 'd', 'devicenumber' ],
+						  -type => "INTEGER", -optional => "yes", -valueoptional => "no",
+						  -default => 1,
+						  -checker => \&Plugin::Parameter::_check_integer,
+						  -description => "Ordinal number of device in MIB to be queried");
+
+my @commandparameterlist = ( $hostnameparameter,
+			     $communityparameter,
+			     $userparameter,
+			     $authprotocolparameter,
+			     $authpasswordparameter,
+			     $authkeyparameter,
+			     $privprotocolparameter,
+			     $privpasswordparameter,
+			     $privkeyparameter,
+			     $devicenumberparameter,
+			     $warningparameter,
+			     $criticalparameter,
+			     $snmpversionparameter,
+			     $portparameter,
+			     $timeoutparameter,
+			     $verboseparameter );
+
+my $plugin = new Plugin(-revision         => '$Revision: 1.2$',
+			-copyright        => "2002 <cm\@financial.com>, 2004 Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment     => "Report on disk space using SNMP access",
+			-longcomment      => "",
+			-parameterlists   => [ \@commandparameterlist, $helpparameterlist, $versionparameterlist ] );
+
+$plugin->init();
+
+if ($opt_w >= $opt_c) {
+  $plugin->usage();
+  usage("$PROGNAME UNKNOWN: Critical ratio must be higher than Warning ratio!\n");
+}
+
+my @SNMPArgs = ( -hostname => $opt_m,
+		 -timeout  => $opt_t,
+		 -port     => $opt_p,
+		 -version  => $opt_S );
+
+my @SNMPAuthenticators = ();
+if ($opt_S eq "snmpv1" || $opt_S eq "snmpv2"
+   || $opt_S == 1 || $opt_S == 2) {
+  @SNMPAuthenticators = ( @SNMPAuthenticators, -community => $opt_C );
+} else {
+  my %authenticators = ( username       => $opt_u,
+			 authprotocol   => $opt_a,
+			 authpassword   => $opt_A,
+			 authkey        => $opt_k,
+			 privprotocol   => $opt_x,
+			 privkey        => $opt_K,
+			 privpassword   => $opt_P );
+
+  foreach my $key (keys %authenticators) {
+    next unless ($authenticators{$key});
+    @SNMPAuthenticators = ( @SNMPAuthenticators,
+			    -$key  => $authenticators{$key} );
+  }
+}
+
+my $deviceSize='.1.3.6.1.2.1.25.2.3.1.5.'.$opt_d;
+my $deviceUsed='.1.3.6.1.2.1.25.2.3.1.6.'.$opt_d;
+my $deviceName='.1.3.6.1.2.1.25.2.3.1.3.'.$opt_d;
+
+my @OIDs=($deviceSize, $deviceUsed, $deviceName);
+
+my ($session, $error) = Net::SNMP->session( @SNMPArgs, @SNMPAuthenticators );
+
+if (!defined $session) {
+  print "$PROGNAME UNKNOWN: Unable to contact server '$opt_m' $error\n";
+  exit $ERRORS{'UNKNOWN'};
+}
+
+my $response = $session->get_request(-varbindlist => \@OIDs);
+
+if (!defined $response) {
+  printf("$PROGNAME UNKNOWN: %s.\n", $session->error);
+  $session->close;
+  exit $ERRORS{'UNKNOWN'};
+}
+
+my $ratio = $response->{$deviceUsed} * 100 / $response->{$deviceSize};
+
+if ($ratio > $opt_c) {
+  printf("$PROGNAME CRITICAL: %s usage %.2f%%\n", $response->{$deviceName}, $ratio);
+  exit $ERRORS{'CRITICAL'};
+}
+
+if ($ratio > $opt_w) {
+  printf("$PROGNAME WARNING: %s usage %.2f%%\n", $response->{$deviceName}, $ratio);
+  exit $ERRORS{'WARNING'};
 }
 
-my $ratio=$result->{$deviceUsed}*100/$result->{$deviceSize};
-
-if ($ratio > $opts{'c'}){
-	printf("CRITICAL: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
-	exit 2;
-}
-if ($ratio > $opts{'w'}){
-	printf("WARNING: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
-        exit 1;
-}
+printf("$PROGNAME OK: %s usage %.2f%%\n", $response->{$deviceName}, $ratio);
 
-printf("OK: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
-exit 0;
+exit $ERRORS{'OK'};
