diff -ruN nagiosplug-save/contrib/check_ms_spooler.pl nagiosplug/contrib/check_ms_spooler.pl
--- nagiosplug-save/contrib/check_ms_spooler.pl	2002-07-16 01:04:42.000000000 +0100
+++ nagiosplug/contrib/check_ms_spooler.pl	2004-03-27 22:28:28.000000000 +0000
@@ -34,88 +34,69 @@
 # Fix many peculiarities.
 #
 
-
+require 5.004;
 use strict ;
+use lib utils.pm ;
+use Plugin;
+use Plugin::Parameter qw(:DEFAULT :standard $u_opt $P_opt);
 
-use Getopt::Long ;
-use utils ;
-
-use vars qw($opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $debug);
+use vars qw($opt_H $opt_u $opt_P $opt_t $debug $PROGNAME);
 use vars '$AUTOLOAD' ;
-use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
 
-my $PROGNAME = 'check_ms_spooler' ;
+use utils qw(%ERRORS &usage);
+
+$P_opt->flags([ 'p', 'password' ]);
+$u_opt->default("guest");
+$P_opt->default("guest");
+$P_opt->binding(\$opt_P);
+my $d_opt = new Plugin::Parameter(-name => "debug", -flags => [ 'd', 'debug' ],
+				  -optional => "yes", -valueoptional => "yes", -type => "NONE",
+				  -binding => \$debug,
+				  -description => "Debugging output");
+my $plugin = new Plugin(-revision => '$Revision: 1.1 $',
+			-copyright => "2001 Karl DeBisschop/S Hopcroft, 2004 Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment => "Perl Check MS Spooler plugin for Nagios. Display a subset of the queues on an SMB (Samba or MS) print spooler.",
+			-parameterlists => [ [ $H_opt, $u_opt, $P_opt, $d_opt, $t_opt ], $h_opts, $V_opts ]);
 
-sub print_help ();
-sub print_usage ();
-sub help ();
-sub version ();
+$plugin->init();
 
 delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
 
-use constant SMBCLIENT_PATH	=> '/usr/local/samba/bin/smbclient' ;
+use constant SMBCLIENT_PATH	=> '/usr/bin/smbclient' ;
 use constant MAX_QUEUES_TO_CHECK => 20 ;		# So that the check doesn't take longer than $TIMEOUT
 
 use constant SMBCLIENT_SVC	=> sub { return `${\SMBCLIENT_PATH} -L //$_[0] -U $_[1]%$_[2]` } ;
 use constant SMBCLIENT_QUEUE	=> sub { return `${\SMBCLIENT_PATH} //$_[0]/$_[1] -U $_[2]%$_[3] -c 'queue; quit' 2>/dev/null` } ;
 
-							# The queue results depend on the name resolution method.
-
-							# Forcing 'wins' or 'bcat' name resolution makes the queue results the
-							# same for all spoolers (those that are resolved with WINS have an extra line
-							# 'Got a positive name query response from <ip address of WINS> ..)
-							# but would fail if there is no WINS and when miscreant spoolers
-							# don't respond to broadcasts.
+# The queue results depend on the name resolution method.
+			     
+# Forcing 'wins' or 'bcat' name resolution makes the queue results the
+# same for all spoolers (those that are resolved with WINS have an extra line
+# 'Got a positive name query response from <ip address of WINS> ..)
+# but would fail if there is no WINS and when miscreant spoolers
+# don't respond to broadcasts.
 
 use constant MIN		=> sub { my $min = $_[0] ; foreach (@_) { $min = $_ if $_ <= $min; } return $min ; } ;
 
-$SIG{"ALRM"} = sub { die "Alarm clock restart" } ;
-
-Getopt::Long::Configure('bundling', 'no_ignore_case');
-GetOptions
-        ("V|version"     => \&version,
-         "h|help"        => \&help,
-         "d|debug"       => \$debug,
-         "p|password=s"  => \$opt_p,
-         "u|username=s"  => \$opt_u,
-         "H|hostname=s"  => \$opt_H);
-
-
-
-($opt_H) || usage("MS Spooler name not specified\n");
-my $spooler = $1 if $opt_H =~ m#(\w+)# ;		# MS host names allow __any__ characters (more than \w)
-($spooler) || usage("Invalid MS spooler name: $opt_H\n");
-
-($opt_u) || ($opt_u = 'guest');
-my $user = $1 if $opt_u =~ m#(\w+)# ;
-($user) || usage("Invalid user: $opt_u\n");
-
-($opt_p) || ($opt_p = 'guest');
-my $pass = $1 if ($opt_p =~ /(.*)/);
-($pass) || usage("Invalid password: $opt_p\n");
-
 my ($printer, $queue, @queues, $ms_spooler_status, @results, %junk) ;
 my (@fault_messages, @queue_contents, @services, @prandom_queue_indices) ;
 my ($queue_contents, $number_of_queues, $state, $queue_report) ;
 
-$state = "getting service list (${\SMBCLIENT_PATH} -L $spooler -U $user%$pass) from spooler\n" ;
+$state = "getting service list (${\SMBCLIENT_PATH} -L $opt_H -U $opt_u%$opt_P) from spooler\n" ;
 
-eval {
-  alarm($TIMEOUT) ;
-  @services = SMBCLIENT_SVC->( $spooler, $user, $pass ) ;
-} ;
-alarm(0) ;
+$plugin->start_timeout($opt_t, "Alarm clock restart");
 
-if ($@ and $@ !~ /Alarm clock restart/) {
-  print "Failed. $PROGNAME failed $state. Got \"$@\"\n" ;
-  exit $ERRORS{"CRITICAL"} ;
-}
+my @tservices = SMBCLIENT_SVC->( $opt_H, $opt_u, $opt_P ) ;
 
-if ($@ and $@ =~ /Alarm clock restart/) {
-  print "Failed. $PROGNAME timed out $state. Got \"@services\"\n" ;
-  exit $ERRORS{"CRITICAL"} ;
+# Howard Wilkinson
+# Remove added interface messages (our machines have 1000's)
+foreach my $service (@tservices) {
+  next if ($service =~ m/^added interface/i);
+  push @services, $service;
 }
 
+$plugin->stop_timeout();
+
 # tsitc> /usr/local/samba/bin/smbclient //ipaprint1/tt03 -U blah%blah -P -c 'queue; quit'
 # Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
 # Connection to ipaprint1 failed
@@ -125,9 +106,9 @@
 # Got a positive name query response from 10.0.100.29 ( 10.0.6.20 )
 # session setup failed: ERRDOS - ERRnoaccess (Access denied.)
 
-if ( grep /Connection to $spooler failed|ERR/, @services ) {
+if ( grep /Connection to $opt_H failed|ERR/, @services ) {
   print "Failed. $PROGNAME failed $state. Got \"@services\"\n" ;
-  # print "Failed. Request for services list to $spooler failed. Got \"@services\"\n" ;
+  # print "Failed. Request for services list to $opt_H failed. Got \"@services\"\n" ;
   exit $ERRORS{"CRITICAL"} ;
 }
 
@@ -162,7 +143,7 @@
 $ms_spooler_status = 0 ;
 $number_of_queues = MIN->(MAX_QUEUES_TO_CHECK, (scalar(@services) >> 3) + 1) ;
 
-$state = "checking queues on $spooler" ;
+$state = "checking queues on $opt_H" ;
 
 eval {
 						# foreach queues to check
@@ -177,7 +158,7 @@
 
   # @queues = @printers[ map { int( rand($#printers) ) } ( 1 .. $number_of_queues ) ] ;
 
-  alarm($TIMEOUT) ;
+  $plugin->start_timeout($opt_t, "Alarm clock restart");
 
   @queue_contents = @fault_messages = () ;
 
@@ -218,9 +199,16 @@
     # resolved by WINS (because those names are NetBIOS and therefore not in DNS);
     # 4 lines for errors or enqueued jobs
   
-    print STDERR "${\SMBCLIENT_PATH} //$spooler/$printer -U $user%$pass -c 'queue; quit' ==>\n" if $debug ;
+    print STDERR "${\SMBCLIENT_PATH} //$opt_H/$printer -U $opt_u%$opt_P -c 'queue; quit' ==>\n" if $debug ;
   
-    @results = SMBCLIENT_QUEUE->( $spooler, $printer, $user, $pass ) ;
+    my @tresults = SMBCLIENT_QUEUE->( $opt_H, $printer, $opt_u, $opt_P ) ;
+
+    # Howard Wilkinson
+    # Remove added interface messages our machines have 1000's.
+    foreach my $result (@tresults) {
+      next if ($result =~ m/^added interface/i);
+      push @results, $result;
+    }
 
     print STDERR "\"@results\"\n" if $debug ;
     
@@ -237,70 +225,20 @@
       push @fault_messages, "$printer: $queue_report" ;
     }
   }
-  alarm(0) ;
+  $plugin->stop_timeout();
 } ;
 
-if ($@ and $@ !~ /Alarm clock restart/) {
-  print "Failed. $PROGNAME failed at $state. Got \"$@\"\n" ;
-  exit $ERRORS{"CRITCAL"} ;
-}
-
-if ($@ and $@ =~ /Alarm clock restart/) {
-  my $i ;
-  foreach (@queues) { $i++ ; last if $_ eq $printer } 
-  print "Failed. Timed out connecting to $printer ($i of $number_of_queues) on //$spooler after $TIMEOUT secs. Got \"@fault_messages\"\n" ;
-  exit $ERRORS{"CRITICAL"} ;
-}
-  
 if (! $ms_spooler_status) {
-  print "Failed. Couldn't connect to @queues on //$spooler as user $user. Got \"@fault_messages\"\n" ;
+  print "Failed. Couldn't connect to @queues on //$opt_H as user $opt_u. Got \"@fault_messages\"\n" ;
   exit $ERRORS{"CRITICAL"} ;
 }
 
 $queue_contents = ( @queue_contents != 0 ? join(" ", (@queue_contents == 1 ? "Queue" : "Queues"), @queue_contents) :
 				           "All Queues empty" ) ;
   
-print "Ok. Connected to ", $queue_contents =~ /empty$/ ? "@{[sort @queues]}" : scalar @queues, " queues on //$spooler. $queue_contents\n" ;
+print "Ok. Connected to ", $queue_contents =~ /empty$/ ? "@{[sort @queues]}" : scalar @queues, " queues on //$opt_H. $queue_contents\n" ;
 exit $ERRORS{"OK"} ;
 
-sub print_usage () {
-	print "Usage: $PROGNAME -H <spooler> -u <user> -p <password>\n";
-}
-
-sub print_help () {
-	print_revision($PROGNAME,'$Revision: 1.1 $ ');
-	print "Copyright (c) 2001 Karl DeBisschop/S Hopcroft
-
-Perl Check MS Spooler plugin for NetSaint. Display a subset of the queues on an SMB (Samba or MS) print spooler.
-
-";
-	print_usage();
-	print '
--H, --hostname=STRING
-   NetBIOS name of the SMB Print spooler (Either Samba or MS spooler)
--u, --user=STRING
-   Username to log in to server. (Default: "guest")
--p, --password=STRING
-   Password to log in to server. (Default: "guest")
--d, --debug
-   Debugging output.
--h, --help
-   This stuff.
-
-';
-	support();
-}
-
-sub version () {
-	print_revision($PROGNAME,'$Revision: 1.1 $ ');
-	exit $ERRORS{'OK'};
-}
-
-sub help () {
-	print_help();
-	exit $ERRORS{'OK'};
-}
-
 sub AUTOLOAD {
 
   my @queue_rep = @_ ;
@@ -312,11 +250,11 @@
   if ( $AUTOLOAD =~ /.*::queue_report/ ) {
 
     if ( grep /Got a positive name query response from/, @queue_rep ){
-      *{$AUTOLOAD} = sub { return join ' ', splice(@_, 3) } ;
-      return join '', splice(@queue_rep, 3) ;
-    } else {
-      *{$AUTOLOAD} = sub { return join ' ',splice(@_, 2) } ;
+      *{$AUTOLOAD} = sub { return join ' ', splice(@_, 2) } ;
       return join '', splice(@queue_rep, 2) ;
+    } else {
+      *{$AUTOLOAD} = sub { return join ' ',splice(@_, 1) } ;
+      return join '', splice(@queue_rep, 1) ;
     }
   } else {
     die "No such subroutine: $AUTOLOAD" ;
