From e0c038d4c2a974f53c37d0b9fb3b22b7cd8d765b Mon Sep 17 00:00:00 2001 From: Nathan Vonnahme Date: Fri, 17 Nov 2006 21:48:22 +0000 Subject: * renamed N::P::arg to add_arg * some POD work git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1539 f882894a-f735-0410-b71e-b25c423dba1c --- t/check_stuff.pl | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 't/check_stuff.pl') diff --git a/t/check_stuff.pl b/t/check_stuff.pl index 889e484..8284169 100755 --- a/t/check_stuff.pl +++ b/t/check_stuff.pl @@ -50,27 +50,32 @@ THRESHOLDs for -w and -c are specified 'min:max' or 'min:' or ':max' (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 @@ qq{-w, --warning=INTEGER:INTEGER # default => 10, ); -$p->arg( +$p->add_arg( spec => 'critical|c=s', help => qq{-c, --critical=INTEGER:INTEGER @@ -90,7 +95,7 @@ qq{-c, --critical=INTEGER:INTEGER which a critical will be generated. }, ); -$p->arg( +$p->add_arg( spec => 'result|r=f', help => qq{-r, --result=INTEGER @@ -104,11 +109,11 @@ $p->getopts; # 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 @@ unless ( defined $p->opts->warning || defined $p->opts->critical ) { 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 @@ else { # output the result and exit $p->nagios_exit( return_code => $p->check_threshold($result), - message => "sample result was $result" + message => " sample result was $result" ); -- cgit v1.2.3-74-g34f1