diff -ruN nagiosplug-save/contrib/check_dns_random.pl nagiosplug/contrib/check_dns_random.pl
--- nagiosplug-save/contrib/check_dns_random.pl	2003-01-29 05:27:20.000000000 +0000
+++ nagiosplug/contrib/check_dns_random.pl	2004-03-27 21:58:45.000000000 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -wT
 # ------------------------------------------------------------------------------
 # File Name:            check_dns_random.pl
 # Author:               Richard Mayhew - South Africa
@@ -23,52 +23,60 @@
 require 5.004;
 
 # --------------------------------------------------------------------[ Uses ]--
-use Socket;
 use strict;
+use lib utils.pm ;
+use Plugin;
+use Plugin::Parameter qw($helpparameterlist $versionparameterlist $hostnameparameter
+			 $filenameparameter $commandfileparameter
+			 $verboseparameter);
+
+use vars qw($opt_H $opt_f $opt_F $PROGNAME);
+
+use utils qw(%ERRORS &usage);
+
+#use Socket;
+
+$filenameparameter->default("/etc/nagios/domains.list");
+$commandfileparameter->default("/usr/lib/nagios/plugins/check_dns");
+
+my @commandparameterlist = ( $hostnameparameter, $filenameparameter, $commandfileparameter, $verboseparameter );
+my $plugin = new Plugin(-revision => '$Revision: 1.2 ',
+			-copyright => "2000 Richard Mayhew, 2004 Howard Wilkinson <howard\@cohtech.com>",
+			-shortcomment => "Perl Check Random DNS plugin for Nagios",
+			-longcomment => "Check to see if one of a randomly selected set of domain names can be resolved by a host. Uses check_dns plugin",
+			-parameterlists => [ \@commandparameterlist, $helpparameterlist, $versionparameterlist ]);
 
 # --------------------------------------------------------------[ Enviroment ]--
 $ENV{PATH} = "/bin";
 $ENV{BASH_ENV} = "";
 $|=1;
 
-my $host = shift || &usage;
+$plugin->init();
 
-my $domainfile = "/usr/local/nagios/etc/domains.list";
-my $wc = `/usr/bin/wc -l $domainfile`;
-my $check = "/usr/local/nagios/libexec/check_dns";
-my $x = 0;
+if ( ! -f $opt_f) {
+  $plugin->usage();
+  usage("$PROGNAME UNKNOWN: File $opt_f does not exist\n");
+}
+my $wc = `/usr/bin/wc -l $opt_f`;
+$wc =~ m/(\d+)/;
+$wc = $1;
 my $srv_file = "";
-my $z = "";
-my $y = "";
 
-open(DOMAIN,"<$domainfile") or die "Error Opening $domainfile File!\n";
-        while (<DOMAIN>) {
-          $srv_file .= $_;
+if(!open(DOMAIN,"<$opt_f")) {
+  $plugin->usage();
+  usage("$PROGNAME UNKNOWN: Error Opening $opt_f File!\n");
+}
+while (<DOMAIN>) {
+  $srv_file .= $_;
 }
-        close(DOMAIN);
-                my @data = split(/\n/,$srv_file);
+close(DOMAIN);
 
-chomp $wc;
-$wc =~ s/ //g;
-$wc =~ s/domains//g;
-
-$x = rand $wc;
-($z,$y) = split(/\./,$x);
-
-system($check, $data[$z], $host);
-exit ($? / 256);
-
-sub usage
-{
-        print "Minimum arguments not supplied!\n";
-        print "\n";
-        print "Perl Check Random DNS plugin for Nagios\n";
-        print "Copyright (c) 2000 Richard Mayhew\n";
-        print "\n";
-        print "Usage: check_dns_random.pl <host>\n";
-        print "\n";
-        print "<host> = DNS server you would like to query.\n";
-        exit -1;
+my @data = split(/\n/,$srv_file);
 
-}
+my $x = rand $wc;
+my ($z,$y) = split(/\./,$x);
+
+$data[$z] =~ m/(.*)/;
+$y = $1;
 
+exec $opt_F, "--hostname=" . $y, "--server=".$opt_H;
