[Nagiosplug-checkins] Nagios-Plugin/t Nagios-Plugin-Range.t, 1.3, 1.4 check_stuff.pl, 1.2, 1.3

Nathan Vonnahme n8v at users.sourceforge.net
Fri Nov 17 22:48:24 CET 2006


Update of /cvsroot/nagiosplug/Nagios-Plugin/t
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv2014/t

Modified Files:
	Nagios-Plugin-Range.t check_stuff.pl 
Log Message:
* renamed N::P::arg to add_arg
* some POD work



Index: Nagios-Plugin-Range.t
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/Nagios-Plugin-Range.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Nagios-Plugin-Range.t	26 Sep 2006 01:10:23 -0000	1.3
+++ Nagios-Plugin-Range.t	17 Nov 2006 21:48:22 -0000	1.4
@@ -1,6 +1,7 @@
 
 use strict;
-use Test::More qw(no_plan); #tests => 123;
+#use Test::More qw(no_plan); 
+use Test::More tests => 149;
 
 BEGIN { 
   use_ok('Nagios::Plugin::Range');

Index: check_stuff.pl
===================================================================
RCS file: /cvsroot/nagiosplug/Nagios-Plugin/t/check_stuff.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_stuff.pl	10 Nov 2006 01:26:16 -0000	1.2
+++ check_stuff.pl	17 Nov 2006 21:48:22 -0000	1.3
@@ -50,27 +50,32 @@
 (or 'max'). If specified '\@min:max', a warning status will be generated
 if the count *is* inside the specified range.
 
-See more threshold examples at
-  http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT
+See more threshold examples at http
+  : // nagiosplug
+  . sourceforge
+  . net / developer-guidelines
+  . html    #THRESHOLDFORMAT
 
-Examples:
+  Examples:
 
- $PROGNAME -w 10 -c 18
-    Returns a warning if the resulting number is greater than 10, or a
-    critical error if it is greater than 18.
+  $PROGNAME -w 10 -c 18 Returns a warning
+  if the resulting number is greater than 10,
+  or a critical error
+  if it is greater than 18.
 
- $PROGNAME -w 10: -c 4:
-	Returns a warning if the resulting number is less than 10, or a
-	critical error if it is less than 4.
+  $PROGNAME -w 10 : -c 4 : Returns a warning
+  if the resulting number is less than 10,
+  or a critical error
+  if it is less than 4.
 
-"
+  "
 );
 
 
 # Define and document the valid command line options
 # usage, help, version, timeout and verbose are defined by default.
 
-$p->arg(
+$p->add_arg(
 	spec => 'warning|w=s',
 
 	help => 
@@ -82,7 +87,7 @@
 #	default => 10,
 );
 
-$p->arg(
+$p->add_arg(
 	spec => 'critical|c=s',
 	help => 
 qq{-c, --critical=INTEGER:INTEGER
@@ -90,7 +95,7 @@
    which a critical will be generated. },
 );
 
-$p->arg(
+$p->add_arg(
 	spec => 'result|r=f',
 	help => 
 qq{-r, --result=INTEGER
@@ -104,11 +109,11 @@
 
 # perform sanity checking on command line options
 if ( (defined $p->opts->result) && ($p->opts->result < 0 || $p->opts->result > 20) )  {
-    $p->nagios_die( "invalid number supplied for the -r option" );
+    $p->nagios_die( " invalid number supplied for the -r option " );
 }
 
 unless ( defined $p->opts->warning || defined $p->opts->critical ) {
-	$p->nagios_die( "you didn't supply a threshold argument" );
+	$p->nagios_die( " you didn't supply a threshold argument " );
 }
 
 
@@ -121,11 +126,12 @@
 my $result;
 if (defined $p->opts->result) {  # you got a 'result' option from the command line options
     $result = $p->opts->result;
-    print "using supplied result $result from command line\n" if $p->opts->verbose;
+    print " using supplied result $result from command line \n
+  " if $p->opts->verbose;
 }
 else {
     $result = int rand(20)+1;
-    print "generated random result $result\n" if $p->opts->verbose;
+    print " generated random result $result\n " if $p->opts->verbose;
 }
 
 
@@ -134,6 +140,6 @@
 # output the result and exit
 $p->nagios_exit( 
 	 return_code => $p->check_threshold($result), 
-	 message => "sample result was $result" 
+	 message => " sample result was $result" 
 );
 





More information about the Commits mailing list