diff -ruN nagiosplug-save/plugins-scripts/check_rpc.pl nagiosplug/plugins-scripts/check_rpc.pl
--- nagiosplug-save/plugins-scripts/check_rpc.pl	2003-08-10 13:11:49.000000000 +0100
+++ nagiosplug/plugins-scripts/check_rpc.pl	2004-03-27 23:04:12.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl -w
+#!/usr/bin/perl -wT
 #
 # check_rpc plugin for nagios
 #
@@ -21,21 +21,50 @@
 # $Id: check_rpc.pl,v 1.8 2003/08/10 12:11:49 kdebisschop Exp $
 #
 
+require 5.004;
 use strict;
 use lib utils.pm;
-use utils qw($TIMEOUT %ERRORS &print_revision &support);
-use vars qw($PROGNAME);
-my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state);
+use Plugin;
+use Plugin::Parameter qw(:DEFAULT :standard $p_opt);
+
+use vars qw($PROGNAME $opt_H $opt_C $opt_p $opt_c $opt_U $opt_T $opt_t $verbose);
+
+use utils qw(%ERRORS);
+
+my $C_opt = new Plugin::Parameter(-name => "command", -flags => [ 'C', 'command' ],
+				  -optional => "no", -valueoptional => "no", -type => "RPCCOMMAND",
+				  -description => "The program name (or number)");
+my $c_opt = new Plugin::Parameter(-name => "progver", -flags => [ 'c', 'progver' ],
+				  -optional => "yes", -valueoptional => "no", -type => "STRING",
+				  -description => "The version you want to check for, one or more. Should prevent checks of unknown versions being syslogged e.g. 2,3,6 to check v2, v3, and v6");
+my $U_opt = new Plugin::Parameter(-name => "UDP", -flags => [ 'U', 'udp' ],
+				  -optional => "yes", -valueoptional => "yes", -type => "NONE",
+				  -description => "Test UDP");
+my $T_opt = new Plugin::Parameter(-name => "TCP", -flags => [ 'T', 'tcp' ],
+				  -optional => "yes", -valueoptional => "yes", -type => "NONE",
+				  -description => "Test TCP");
+$v_opt->binding(\$verbose);
+my $plugin = new Plugin(-revision => '$Revision: 1.8 $',
+			-copyright => "2002 Karl DeBisschop/Truongchinh Nguyen/Subhendu Ghosh, 2004 Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment => "Check if a rpc service is registered and running using  'rpcinfo -H host -C rpc_command'",
+			-checker => sub { my ($plugin) = @_;
+					  if ($opt_T && $opt_U) {
+					    $plugin->usage();
+					    utils::usage("$PROGNAME UNKNOWN: Cannot defined both tcp AND udp options");
+					  }
+					},
+			-parameterlists => [ [ $H_opt, $C_opt, $c_opt, $U_opt, $T_opt, $p_opt, $t_opt, $v_opt ], $h_opts, $V_opts ]);
+
+$plugin->init();
+
+my (@proto,%prognum,$response,$prognum,$port,$cmd,$progver,$state);
 my ($array_ref,$test,$element,@progkeys,$proto,$a,$b);
-my ($opt_V,$opt_h,$opt_C,$opt_p,$opt_H,$opt_c,$opt_u,$opt_t);
+
 my ($line, @progvers, $response2,$response3);
-$opt_V = $opt_h = $opt_C = $opt_p = $opt_H =  $opt_u = $opt_t ='';
+
 $state = 'UNKNOWN';
 $progver = $response=$response2= $response3 ='';
 
-$PROGNAME = "check_rpc";
-sub print_help ();
-sub print_usage ();
 sub in ($$);
 
 $ENV{'BASH_ENV'}=''; 
@@ -49,29 +78,6 @@
 $proto[10004]='u';
 $proto[10007]='u';
 
-use Getopt::Long;
-Getopt::Long::Configure('bundling');
-GetOptions(
-	"V"   => \$opt_V,   "version"    => \$opt_V,
-	"h"   => \$opt_h,   "help"       => \$opt_h,
-	"C=s" => \$opt_C,   "command=s"  => \$opt_C,
-	"p=i" => \$opt_p,   "port=i"     => \$opt_p,
- 	"H=s" => \$opt_H,   "hostname=s" => \$opt_H,
- 	"c=s" => \$opt_c,   "progver=s"  => \$opt_c,
- 	"v+"  => \$verbose, "verbose+"   => \$verbose,
- 	"u"   => \$opt_u,   "udp"        => \$opt_u,
- 	"t"   => \$opt_t,   "tcp"        => \$opt_t
-);
-
-# -h means display verbose help screen
-if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
-
-# -V means display version number
-if ($opt_V) { 
-	print_revision($PROGNAME,'$Revision: 1.8 $ '); 
-	exit $ERRORS{'OK'}; 
-}
-
 # Hash containing all RPC program names and numbers
 # Add to the hash if support for new RPC program is required
 
@@ -206,45 +212,22 @@
 		print "   $key \t=>\t$prognum{$key} \n";
 	}
 	print "\n\n";
-	print_usage();
+	$plugin->usage();
 	exit $ERRORS{'OK'};
 }
 
-# -H means host name
-unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; }
-
-if (! utils::is_hostname($opt_H)){
-	print "$opt_H is not a valid host name\n";
-	print_usage();
-	exit $ERRORS{"UNKNOWN"};
-}else{
-	$host = $opt_H;
-}
-
-if ($opt_t && $opt_u) {
-	print "Cannot define tcp AND udp\n";
-	print_usage();
-	exit $ERRORS{'UNKNOWN'};
-}
-
-
-# -C means command name or number
-$opt_C = shift unless ($opt_C);
-unless ($opt_C) { print_usage(); exit -1; }
 @progkeys = keys %prognum;
 if ($opt_C =~ m/^([0-9]+)$/){
-#    $response = "RPC ok: program $opt_C (version ";
     $prognum = $1;
 } elsif ( in( \@progkeys, $opt_C)) {
-#    $response = "RPC ok: $opt_C (version ";
     $prognum = $prognum{$opt_C};
 } else {
-    print "Program $opt_C is not defined\n";
-    exit $ERRORS{'UNKNOWN'};
+    $plugin->usage();
+    utils::usage("$PROGNAME UNKNOWN: Program $opt_C is not defined\n");
 }
 
 # -p means port number
-if($opt_p =~ /^([0-9]+)$/){
+if(defined $opt_p && $opt_p =~ /^([0-9]+)$/){
     $port = "-n $1";
 } else {
     $port = "";
@@ -252,16 +235,10 @@
 
 $proto = 'u';
 $proto = $proto[$prognum] if ($proto[$prognum]);
-$proto = 't' if ($opt_t);
-$proto = 'u' if ($opt_u);
-
+$proto = 't' if ($opt_T);
+$proto = 'u' if ($opt_U);
 
-# Just in case of problems, let's not hang Nagios
-$SIG{'ALRM'} = sub {
-        print ("ERROR: No response from RPC server (alarm)\n");
-        exit $ERRORS{"UNKNOWN"};
-};
-alarm($TIMEOUT);
+$plugin->start_timeout($opt_t, "No response from RPC server (alarm)");
 
 # -c is progver  - if we need to check multiple specified versions.
 if (defined $opt_c ) {
@@ -290,12 +267,12 @@
 }
 
 if ($state eq 'OK') {
-	print "$state: RPC program $opt_C".$response." $proto running\n";
+	print "$PROGNAME $state: RPC program $opt_C".$response." $proto running\n";
 }else{
 	if($response){
-		print "$state: RPC program $opt_C".$response2." $proto is not running,".$response." $proto is running\n";
+		print "$PROGNAME $state: RPC program $opt_C".$response2." $proto is not running,".$response." $proto is running\n";
 	}else{
-		print "$state: RPC program $opt_C $response2 $proto is not running\n";
+		print "$PROGNAME $state: RPC program $opt_C $response2 $proto is not running\n";
 	}
 }
 exit $ERRORS{$state};
@@ -304,7 +281,7 @@
 ########  Subroutines ==========================
 
 sub get_rpcinfo {
-	$cmd = "$utils::PATH_TO_RPCINFO $port -" . "$proto $host $prognum $progver 2>&1 |";
+	$cmd = "$utils::PATH_TO_RPCINFO $port -" . "$proto $opt_H $prognum $progver 2>&1 |";
 	print "$cmd\n" if ($verbose);
 	open CMD, $cmd or die "Can't fork for rpcinfo: $!\n" ;
 
@@ -325,8 +302,8 @@
 		}
 		if ( $line =~ /program $prognum is not available/ ) {
 			$response3 = "";
-			$response3 = "tcp" if $opt_t;
-			$response3 = "udp" if $opt_u;
+			$response3 = "tcp" if $opt_T;
+			$response3 = "udp" if $opt_U;
 			$state = 'CRITICAL';
 			print "3:$response3 \n" if $verbose;
 		}
@@ -334,28 +311,6 @@
 	close CMD;
 }
 
-
-sub print_help() {
-	print_revision($PROGNAME,'$Revision: 1.8 $ ');
-	print "Copyright (c) 2002 Karl DeBisschop/Truongchinh Nguyen/Subhendu Ghosh\n";
-	print "\n";
-	print "Check if a rpc service is registered and running using\n";
-	print "      rpcinfo -H host -C rpc_command \n";
-	print "\n";
-	print_usage();
-	print "\n";
-	print "  <host>          The server providing the rpc service\n";
-	print "  <rpc_command>   The program name (or number).\n";
-	print "  <program_version> The version you want to check for (one or more)\n";
-	print "                    Should prevent checks of unknown versions being syslogged\n";
-	print "                    e.g. 2,3,6 to check v2, v3, and v6\n";
-	print "  [-u | -t]       Test UDP or TCP\n";
-	print "  [-v]            Verbose \n";
-	print "  [-v -v]         Verbose - will print supported programs and numbers \n";
-	print "\n";
-	support();
-}
-
 sub print_usage () {
 	print "Usage: \n";
 	print " $PROGNAME -H host -C rpc_command [-p port] [-c program_version] [-u|-t] [-v]\n";
