diff options
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | NPTest.pm | 252 | ||||
-rw-r--r-- | plugins-scripts/t/check_file_age.t | 103 | ||||
-rw-r--r-- | plugins/t/NPTest.cache.travis | 46 | ||||
-rw-r--r-- | plugins/t/check_by_ssh.t | 14 | ||||
-rw-r--r-- | plugins/t/check_fping.t | 12 | ||||
-rw-r--r-- | plugins/t/check_ftp.t | 11 | ||||
-rw-r--r-- | plugins/t/check_http.t | 52 | ||||
-rw-r--r-- | plugins/t/check_imap.t | 15 | ||||
-rw-r--r-- | plugins/t/check_jabber.t | 20 | ||||
-rw-r--r-- | plugins/t/check_ldap.t | 17 | ||||
-rw-r--r-- | plugins/t/check_mysql.t | 29 | ||||
-rw-r--r-- | plugins/t/check_mysql_query.t | 11 | ||||
-rw-r--r-- | plugins/t/check_snmp.t | 16 | ||||
-rw-r--r-- | plugins/t/check_ssh.t | 14 | ||||
-rw-r--r-- | plugins/t/check_tcp.t | 20 | ||||
-rw-r--r-- | plugins/t/check_time.t | 11 |
18 files changed, 212 insertions, 438 deletions
diff --git a/.travis.yml b/.travis.yml index 123e1783..712f2475 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,9 +42,6 @@ before_install: - sudo add-apt-repository -y ppa:waja/trusty-backports - sudo apt-get update -qq - sudo apt-get purge -qq gawk - # http://docs.travis-ci.com/user/trusty-ci-environment/ indicates, no MySQL on Trusty (yet) - # # ensure we have a test database in place for tests - # - mysql -e "create database IF NOT EXISTS test;" -uroot install: - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libradcli-dev libkrb5-dev libnet-snmp-perl procps @@ -74,6 +71,7 @@ before_script: - tools/setup - ./configure --enable-libtap - make + - export NPTEST_ACCEPTDEFAULT=1 - export NPTEST_CACHE="$(pwd)/plugins/t/NPTest.cache.travis" - ssh-keygen -t dsa -N "" -f ~/.ssh/id_dsa - cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys @@ -82,7 +80,7 @@ before_script: - sudo rm -f /usr/share/mibs/ietf/SNMPv2-PDU /usr/share/mibs/ietf/IPSEC-SPD-MIB /usr/share/mibs/ietf/IPATM-IPMC-MIB /usr/share/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB - sudo mkdir -p /var/lib/snmp/mib_indexes - sudo mkdir /media/ramdisk && sudo chmod 777 /media/ramdisk && sudo mount -t tmpfs -o size=20% none /media/ramdisk - - sed "/host_tls_cert/s/.*/'host_tls_cert' => '$(hostname)',/" -i $NPTEST_CACHE + - sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i $NPTEST_CACHE script: - if [ "$COVERITY_SCAN_BRANCH" != 1 ]; then make test; fi diff --git a/Makefile.am b/Makefile.am index 7e0d4131..df1bcbb3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,6 +34,7 @@ test test-debug: if test "$(PERLMODS_DIR)" != ""; then cd perlmods && $(MAKE) $@; fi cd plugins && $(MAKE) $@ cd plugins-scripts && $(MAKE) $@ + cd plugins-root && $(MAKE) $@ # Solaris pkgmk BUILDDIR = build-solaris @@ -53,8 +53,8 @@ developer to interactively request test parameter information from the user. The user can accept the developer's default value or reply "none" which will then be returned as "" for the test to skip if appropriate. -If a parameter needs to be entered and the test is run without a tty -attached (such as a cronjob), the parameter will be assigned as if it +If a parameter needs to be entered and the test is run without a tty +attached (such as a cronjob), the parameter will be assigned as if it was "none". Tests can check for the parameter and skip if not set. Responses are stored in an external, file-based cache so subsequent test @@ -62,17 +62,6 @@ runs will use these values. The user is able to change the values by amending the values in the file /var/tmp/NPTest.cache, or by setting the appropriate environment variable before running the test. -The option exists to store parameters in a scoped means, allowing a -test harness to a localise a parameter should the need arise. This -allows a parameter of the same name to exist in a test harness -specific scope, while not affecting the globally scoped parameter. The -scoping identifier is the name of the test harness sans the trailing -".t". All cache searches first look to a scoped parameter before -looking for the parameter at global scope. Thus for a test harness -called "check_disk.t" requesting the parameter "mountpoint_valid", the -cache is first searched for "check_disk"/"mountpoint_valid", if this -fails, then a search is conducted for "mountpoint_valid". - To facilitate quick testing setup, it is possible to accept all the developer provided defaults by setting the environment variable "NPTEST_ACCEPTDEFAULT" to "1" (or any other perl truth value). Note @@ -249,26 +238,26 @@ sub checkCmd { if ( scalar( grep { $_ == $exitStatus } @{$desiredExitStatus} ) ) { - $desiredExitStatus = $exitStatus; + $desiredExitStatus = $exitStatus; } else { - $desiredExitStatus = -1; + $desiredExitStatus = -1; } } elsif ( ref $desiredExitStatus eq "HASH" ) { if ( exists( ${$desiredExitStatus}{$exitStatus} ) ) { - if ( defined( ${$desiredExitStatus}{$exitStatus} ) ) - { - $testOutput = ${$desiredExitStatus}{$exitStatus}; - } - $desiredExitStatus = $exitStatus; + if ( defined( ${$desiredExitStatus}{$exitStatus} ) ) + { + $testOutput = ${$desiredExitStatus}{$exitStatus}; + } + $desiredExitStatus = $exitStatus; } else { - $desiredExitStatus = -1; + $desiredExitStatus = -1; } } @@ -327,78 +316,51 @@ sub skipMsg return $testStatus; } -sub getTestParameter -{ - my( $param, $envvar, $default, $brief, $scoped ); - my $new_style; - if (scalar @_ <= 3) { - ($param, $brief, $default) = @_; - $envvar = $param; - $new_style = 1; - } else { - ( $param, $envvar, $default, $brief, $scoped ) = @_; - $new_style = 0; - } - - # Apply default values for optional arguments - $scoped = ( defined( $scoped ) && $scoped ); - - my $testharness = basename( (caller(0))[1], ".t" ); # used for scoping +sub getTestParameter { + my($param, $description, $default) = @_; - if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} ) - { - return $ENV{$envvar}; + if($param !~ m/^NP_[A-Z0-9_]+$/mx) { + die("parameter should be all uppercase and start with NP_ (requested from ".(caller(0))[1].")"); } - my $cachedValue = SearchCache( $param, $testharness ); - if ( defined( $cachedValue ) ) - { - # This save required to convert to new style because the key required is - # changing to the environment variable - if ($new_style == 0) { - SetCacheParameter( $envvar, undef, $cachedValue ); - } + return $ENV{$param} if $ENV{$param}; + + my $cachedValue = SearchCache($param); + if(defined $cachedValue) { return $cachedValue; } - my $defaultValid = ( defined( $default ) && $default ); - my $autoAcceptDefault = ( exists( $ENV{'NPTEST_ACCEPTDEFAULT'} ) && $ENV{'NPTEST_ACCEPTDEFAULT'} ); - - if ( $autoAcceptDefault && $defaultValid ) - { - return $default; + if($ENV{'NPTEST_ACCEPTDEFAULT'}) { + return $default if $default; + return ""; } # Set "none" if no terminal attached (eg, tinderbox build servers when new variables set) return "" unless (-t STDIN); my $userResponse = ""; - - while ( $userResponse eq "" ) - { + while($userResponse eq "") { print STDERR "\n"; - print STDERR "Test Harness : $testharness\n"; - print STDERR "Test Parameter : $param\n"; - print STDERR "Environment Variable : $envvar\n" if ($param ne $envvar); - print STDERR "Brief Description : $brief\n"; - print STDERR "Enter value (or 'none') ", ($defaultValid ? "[${default}]" : "[]"), " => "; + print STDERR "Test File : ".(caller(0))[1]."\n"; + print STDERR "Test Parameter : $param\n"; + print STDERR "Description : $description\n"; + print STDERR "Enter value (or 'none') ", ($default ? "[${default}]" : "[]"), " => "; $userResponse = <STDIN>; $userResponse = "" if ! defined( $userResponse ); # Handle EOF - chomp( $userResponse ); - if ( $defaultValid && $userResponse eq "" ) - { + chomp($userResponse); + if($default && $userResponse eq "") { $userResponse = $default; } } print STDERR "\n"; - if ($userResponse =~ /^(na|none)$/) { - $userResponse = ""; + if($userResponse =~ /^(na|none)$/) { + $userResponse = ""; } - # define all user responses at global scope - SetCacheParameter( $param, ( $scoped ? $testharness : undef ), $userResponse ); + # store user responses + SetCacheParameter($param, $userResponse); return $userResponse; } @@ -407,37 +369,20 @@ sub getTestParameter # Internal Cache Management Functions # -sub SearchCache -{ - my( $param, $scope ) = @_; +sub SearchCache { + my($param) = @_; LoadCache(); - if ( exists( $CACHE{$scope} ) && exists( $CACHE{$scope}{$param} ) ) - { - return $CACHE{$scope}{$param}; - } - - if ( exists( $CACHE{$param} ) ) - { + if(exists $CACHE{$param}) { return $CACHE{$param}; } - return undef; # Need this to say "nothing found" + return undef; # Need this to say "nothing found" } -sub SetCacheParameter -{ - my( $param, $scope, $value ) = @_; - - if ( defined( $scope ) ) - { - $CACHE{$scope}{$param} = $value; - } - else - { - $CACHE{$param} = $value; - } - +sub SetCacheParameter { + my($param, $value) = @_; + $CACHE{$param} = $value; SaveCache(); } @@ -475,6 +420,11 @@ sub SaveCache delete $CACHE{'_cache_loaded_'}; my $oldFileContents = delete $CACHE{'_original_cache'}; + # clean up old style params + for my $key (keys %CACHE) { + delete $CACHE{$key} if $key !~ m/^NP_[A-Z0-9_]+$/mx; + } + my($dataDumper) = new Data::Dumper([\%CACHE]); $dataDumper->Terse(1); $dataDumper->Sortkeys(1); @@ -486,7 +436,7 @@ sub SaveCache if($oldFileContents ne $data) { my($fileHandle) = new IO::File; if (!$fileHandle->open( "> ${CACHEFILENAME}")) { - print STDERR "NPTest::LoadCache() : Problem saving ${CACHEFILENAME} : $!\n"; + print STDERR "NPTest::SaveCache() : Problem saving ${CACHEFILENAME} : $!\n"; return; } print $fileHandle $data; @@ -542,10 +492,10 @@ sub DetermineTestHarnessDirectory push ( @dirs, "./tests"); } - if ( @dirs > 0 ) - { - return @dirs; - } + if ( @dirs > 0 ) + { + return @dirs; + } # To be honest I don't understand which case satisfies the # original code in test.pl : when $tstdir == `pwd` w.r.t. @@ -611,73 +561,73 @@ sub TestsFrom # All the new object oriented stuff below -sub new { - my $type = shift; - my $self = {}; - return bless $self, $type; +sub new { + my $type = shift; + my $self = {}; + return bless $self, $type; } # Accessors sub return_code { - my $self = shift; - if (@_) { - return $self->{return_code} = shift; - } else { - return $self->{return_code}; - } + my $self = shift; + if (@_) { + return $self->{return_code} = shift; + } else { + return $self->{return_code}; + } } sub output { - my $self = shift; - if (@_) { - return $self->{output} = shift; - } else { - return $self->{output}; - } + my $self = shift; + if (@_) { + return $self->{output} = shift; + } else { + return $self->{output}; + } } sub perf_output { - my $self = shift; - $_ = $self->{output}; - /\|(.*)$/; - return $1 || ""; + my $self = shift; + $_ = $self->{output}; + /\|(.*)$/; + return $1 || ""; } sub only_output { - my $self = shift; - $_ = $self->{output}; - /(.*?)\|/; - return $1 || ""; + my $self = shift; + $_ = $self->{output}; + /(.*?)\|/; + return $1 || ""; } sub testCmd { - my $class = shift; - my $command = shift or die "No command passed to testCmd"; - my $timeout = shift || 120; - my $object = $class->new; - - local $SIG{'ALRM'} = sub { die("timeout in command: $command"); }; - alarm($timeout); # no test should take longer than 120 seconds - - my $output = `$command`; - $object->return_code($? >> 8); - $_ = $? & 127; - if ($_) { - die "Got signal $_ for command $command"; - } - chomp $output; - $object->output($output); - - alarm(0); - - my ($pkg, $file, $line) = caller(0); - print "Testing: $command", $/; - if ($ENV{'NPTEST_DEBUG'}) { - print "testCmd: Called from line $line in $file", $/; - print "Output: ", $object->output, $/; - print "Return code: ", $object->return_code, $/; - } - - return $object; + my $class = shift; + my $command = shift or die "No command passed to testCmd"; + my $timeout = shift || 120; + my $object = $class->new; + + local $SIG{'ALRM'} = sub { die("timeout in command: $command"); }; + alarm($timeout); # no test should take longer than 120 seconds + + my $output = `$command`; + $object->return_code($? >> 8); + $_ = $? & 127; + if ($_) { + die "Got signal $_ for command $command"; + } + chomp $output; + $object->output($output); + + alarm(0); + + my ($pkg, $file, $line) = caller(0); + print "Testing: $command", $/; + if ($ENV{'NPTEST_DEBUG'}) { + print "testCmd: Called from line $line in $file", $/; + print "Output: ", $object->output, $/; + print "Return code: ", $object->return_code, $/; + } + + return $object; } # do we have ipv6 diff --git a/plugins-scripts/t/check_file_age.t b/plugins-scripts/t/check_file_age.t index ebf673f5..8b876708 100644 --- a/plugins-scripts/t/check_file_age.t +++ b/plugins-scripts/t/check_file_age.t @@ -20,105 +20,74 @@ my $temp_link = "/tmp/check_file_age.link.tmp"; unlink $temp_file, $temp_link; -$result = NPTest->testCmd( - "./check_file_age" - ); +$result = NPTest->testCmd("./check_file_age"); cmp_ok( $result->return_code, '==', 3, "Missing parameters" ); like ( $result->output, $unknownOutput, "Output for unknown correct" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file"); cmp_ok( $result->return_code, '==', 2, "File not exists" ); like ( $result->output, $criticalOutput, "Output for file missing correct" ); write_chars(100); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file"); cmp_ok( $result->return_code, '==', 0, "File is new enough" ); like ( $result->output, $successOutput, "Output for success correct" ); sleep 2; -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -w 1" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -w 1"); cmp_ok( $result->return_code, '==', 1, "Warning for file over 1 second old" ); like ( $result->output, $warningOutput, "Output for warning correct" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -w 0:1" - ); -cmp_ok( $result->return_code, '==', 1, "Warning for file over 1 second old by range" ); -like ( $result->output, $warningOutput, "Output for warning by range correct" ); - -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1"); cmp_ok( $result->return_code, '==', 2, "Critical for file over 1 second old" ); like ( $result->output, $criticalOutput, "Output for critical correct" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 0:1" - ); -cmp_ok( $result->return_code, '==', 2, "Critical for file over 1 second old by range" ); -like ( $result->output, $criticalOutput, "Output for critical by range correct" ); - -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 100" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 100"); cmp_ok( $result->return_code, '==', 0, "Checking file size" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 0:1000 -W 0:100" - ); -cmp_ok( $result->return_code, '==', 0, "Checking file size by range" ); - -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 100" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 100"); like( $result->output, $performanceOutput, "Checking for performance Output" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 100" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 100"); like( $result->output, $performanceOutput, "Checking for performance Output from range" ); -$result = NPTest->testCmd( - "./check_file_age -f /non/existent --ignore-missing" - ); +$result = NPTest->testCmd("./check_file_age -f /non/existent --ignore-missing"); cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 101" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 101"); cmp_ok( $result->return_code, '==', 1, "One byte too short" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 101:" - ); -cmp_ok( $result->return_code, '==', 1, "One byte too short by range" ); - -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -C 101" - ); +$result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -C 101"); cmp_ok( $result->return_code, '==', 2, "One byte too short - critical" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -C 101:" - ); -cmp_ok( $result->return_code, '==', 2, "One byte too short by range - critical" ); +SKIP: { + eval 'use Monitoring::Plugin::Range'; + skip "Monitoring::Plugin::Range module require", 9 if $@; + + $result = NPTest->testCmd("./check_file_age -f $temp_file -w 0:1"); + cmp_ok( $result->return_code, '==', 1, "Warning for file over 1 second old by range" ); + like ( $result->output, $warningOutput, "Output for warning by range correct" ); + + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 0:1"); + cmp_ok( $result->return_code, '==', 2, "Critical for file over 1 second old by range" ); + like ( $result->output, $criticalOutput, "Output for critical by range correct" ); + + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 0:1000 -W 0:100"); + cmp_ok( $result->return_code, '==', 0, "Checking file size by range" ); + + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 101:"); + cmp_ok( $result->return_code, '==', 1, "One byte too short by range" ); + + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -W 0:99"); + cmp_ok( $result->return_code, '==', 1, "One byte too long by range" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -W 0:99" - ); -cmp_ok( $result->return_code, '==', 1, "One byte too long by range" ); + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -C 101:"); + cmp_ok( $result->return_code, '==', 2, "One byte too short by range - critical" ); -$result = NPTest->testCmd( - "./check_file_age -f $temp_file -c 1000 -C 0:99" - ); -cmp_ok( $result->return_code, '==', 2, "One byte too long by range - critical" ); + $result = NPTest->testCmd("./check_file_age -f $temp_file -c 1000 -C 0:99"); + cmp_ok( $result->return_code, '==', 2, "One byte too long by range - critical" ); +}; symlink $temp_file, $temp_link or die "Cannot create symlink"; $result = NPTest->testCmd("./check_file_age -f $temp_link -c 10"); diff --git a/plugins/t/NPTest.cache.travis b/plugins/t/NPTest.cache.travis index 28437a00..6ee45053 100644 --- a/plugins/t/NPTest.cache.travis +++ b/plugins/t/NPTest.cache.travis @@ -1,64 +1,54 @@ { - 'MYSQL_LOGIN_DETAILS' => '-u root -d test', 'NP_ALLOW_SUDO' => 'yes', 'NP_DNS_SERVER' => '8.8.8.8', 'NP_GOOD_NTP_SERVICE' => '', + 'NP_HOST_DHCP_RESPONSIVE' => '', + 'NP_HOST_HPJD_PORT_INVALID' => '161', + 'NP_HOST_HPJD_PORT_VALID' => '', + 'NP_HOSTNAME_INVALID_CIDR' => '130.133.8.39/30', 'NP_HOSTNAME_INVALID' => 'nosuchhost', - 'NP_HOSTNAME_VALID' => 'monitoring-plugins.org', - 'NP_HOSTNAME_VALID_IP' => '130.133.8.40', 'NP_HOSTNAME_VALID_CIDR' => '130.133.8.41/30', - 'NP_HOSTNAME_INVALID_CIDR' => '130.133.8.39/30', + 'NP_HOSTNAME_VALID_IP' => '130.133.8.40', + 'NP_HOSTNAME_VALID' => 'monitoring-plugins.org', 'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.', - 'NP_HOST_DHCP_RESPONSIVE' => '', 'NP_HOST_NONRESPONSIVE' => '10.0.0.1', 'NP_HOST_RESPONSIVE' => 'localhost', 'NP_HOST_SMB' => '', - 'NP_HOST_SNMP' => 'localhost', + 'NP_HOST_SNMP' => '', 'NP_HOST_TCP_FTP' => '', 'NP_HOST_TCP_HPJD' => '', - 'NP_HOST_HPJD_PORT_INVALID' => '161', - 'NP_HOST_HPJD_PORT_VALID' => '', - 'NP_HOST_TCP_HTTP' => 'localhost', 'NP_HOST_TCP_HTTP2' => 'test.monitoring-plugins.org', + 'NP_HOST_TCP_HTTP' => 'localhost', 'NP_HOST_TCP_IMAP' => 'imap.web.de', + 'NP_HOST_TCP_JABBER' => 'jabber.org', 'NP_HOST_TCP_LDAP' => 'localhost', 'NP_HOST_TCP_POP' => 'pop.web.de', + 'NP_HOST_TCP_PROXY' => 'localhost', 'NP_HOST_TCP_SMTP' => 'localhost', 'NP_HOST_TCP_SMTP_NOTLS' => '', 'NP_HOST_TCP_SMTP_TLS' => '', + 'NP_HOST_TLS_CERT' => 'localhost, + 'NP_HOST_TLS_HTTP' => 'localhost', + 'NP_HOST_UDP_TIME' => 'none', 'NP_INTERNET_ACCESS' => 'yes', 'NP_LDAP_BASE_DN' => 'cn=admin,dc=nodomain', 'NP_MOUNTPOINT2_VALID' => '/media/ramdisk', 'NP_MOUNTPOINT_VALID' => '/', + 'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test', 'NP_MYSQL_SERVER' => 'localhost', - 'NP_HOST_UDP_TIME' => 'localhost', 'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock', 'NP_MYSQL_WITH_SLAVE' => '', 'NP_MYSQL_WITH_SLAVE_LOGIN' => '', 'NP_NO_NTP_SERVICE' => 'localhost', + 'NP_PORT_TCP_PROXY' => '3128', 'NP_SMB_SHARE' => '', 'NP_SMB_SHARE_DENY' => '', 'NP_SMB_SHARE_SPC' => '', 'NP_SMB_VALID_USER' => '', 'NP_SMB_VALID_USER_PASS' => '', - 'NP_SNMP_COMMUNITY' => 'public', + 'NP_SNMP_COMMUNITY' => '', + 'NP_SNMP_USER' => '', 'NP_SSH_CONFIGFILE' => '~/.ssh/config', 'NP_SSH_HOST' => 'localhost', - 'NP_SSH_IDENTITY' => '~/.ssh/id_dsa', - 'NP_HOST_TCP_JABBER' => 'jabber.org', - 'host_nonresponsive' => '10.0.0.1', - 'host_responsive' => 'localhost', - 'host_snmp' => '', - 'host_tcp_ftp' => '', - 'host_tcp_http' => 'localhost', - 'host_tcp_imap' => 'imap.nierlein.de', - 'host_tcp_smtp' => 'localhost', - 'hostname_invalid' => 'nosuchhost', - 'snmp_community' => '', - 'user_snmp' => '', - 'host_udp_time' => 'none', - 'host_tls_http' => 'localhost', - 'host_tls_cert' => 'localhost', - 'NP_HOST_TCP_PROXY' => 'localhost', - 'NP_PORT_TCP_PROXY' => '3128', + 'NP_SSH_IDENTITY' => '~/.ssh/id_dsa' } diff --git a/plugins/t/check_by_ssh.t b/plugins/t/check_by_ssh.t index 4797390d..1d2939e9 100644 --- a/plugins/t/check_by_ssh.t +++ b/plugins/t/check_by_ssh.t @@ -9,17 +9,9 @@ use Test::More; use NPTest; # Required parameters -my $ssh_service = getTestParameter( "NP_SSH_HOST", - "A host providing SSH service", - "localhost"); - -my $ssh_key = getTestParameter( "NP_SSH_IDENTITY", - "A key allowing access to NP_SSH_HOST", - "~/.ssh/id_dsa"); - -my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE", - "A config file with ssh settings", - "~/.ssh/config"); +my $ssh_service = getTestParameter("NP_SSH_HOST", "A host providing SSH service", "localhost"); +my $ssh_key = getTestParameter("NP_SSH_IDENTITY", "A key allowing access to NP_SSH_HOST", "~/.ssh/id_dsa"); +my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE", "A config file with ssh settings", "~/.ssh/config"); plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key); diff --git a/plugins/t/check_fping.t b/plugins/t/check_fping.t index 08692e46..342b0a7e 100644 --- a/plugins/t/check_fping.t +++ b/plugins/t/check_fping.t @@ -15,15 +15,9 @@ BEGIN {$tests = 4; plan tests => $tests} my $successOutput = '/^FPING OK - /'; my $failureOutput = '/^FPING CRITICAL - /'; -my $host_responsive = getTestParameter( "host_responsive", "NP_HOST_RESPONSIVE", "localhost", - "The hostname of system responsive to network requests" ); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); - +my $host_responsive = getTestParameter("NP_HOST_RESPONSIVE", "The hostname of system responsive to network requests", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $t; diff --git a/plugins/t/check_ftp.t b/plugins/t/check_ftp.t index de6831ba..93a7d7c3 100644 --- a/plugins/t/check_ftp.t +++ b/plugins/t/check_ftp.t @@ -11,14 +11,9 @@ use NPTest; use vars qw($tests); BEGIN {$tests = 4; plan tests => $tests} -my $host_tcp_ftp = getTestParameter( "host_tcp_ftp", "NP_HOST_TCP_FTP", "localhost", - "A host providing the FTP Service (an FTP server)"); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); +my $host_tcp_ftp = getTestParameter("NP_HOST_TCP_FTP", "A host providing the FTP Service (an FTP server)", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $successOutput = '/FTP OK -\s+[0-9]?\.?[0-9]+ second response time/'; diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 416fbbcb..b3760ebe 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t @@ -9,46 +9,21 @@ use Test::More; use POSIX qw/mktime strftime/; use NPTest; -plan tests => 55; +plan tests => 50; my $successOutput = '/OK.*HTTP.*second/'; my $res; -my $host_tcp_http = getTestParameter( "NP_HOST_TCP_HTTP", - "A host providing the HTTP Service (a web server)", - "localhost" ); - -my $host_tls_http = getTestParameter( "host_tls_http", "NP_HOST_TLS_HTTP", "localhost", - "A host providing the HTTPS Service (a tls web server)" ); - -my $host_tls_cert = getTestParameter( "host_tls_cert", "NP_HOST_TLS_CERT", "localhost", - "the common name of the certificate." ); - - -my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE", - "The hostname of system not responsive to network requests", - "10.0.0.1" ); - -my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID", - "An invalid (not known to DNS) hostname", - "nosuchhost"); - -my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", - "Is this system directly connected to the internet?", - "yes"); - -my $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2", - "A host providing an index page containing the string 'monitoring'", - "test.monitoring-plugins.org" ); - -my $host_tcp_proxy = getTestParameter( "NP_HOST_TCP_PROXY", - "A host providing a HTTP proxy with CONNECT support", - "localhost"); - -my $port_tcp_proxy = getTestParameter( "NP_PORT_TCP_PROXY", - "Port of the proxy with HTTP and CONNECT support", - "3128"); +my $host_tcp_http = getTestParameter("NP_HOST_TCP_HTTP", "A host providing the HTTP Service (a web server)", "localhost"); +my $host_tls_http = getTestParameter("NP_HOST_TLS_HTTP", "A host providing the HTTPS Service (a tls web server)", "localhost"); +my $host_tls_cert = getTestParameter("NP_HOST_TLS_CERT", "the common name of the certificate.", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); +my $internet_access = getTestParameter("NP_INTERNET_ACCESS", "Is this system directly connected to the internet?", "yes"); +my $host_tcp_http2 = getTestParameter("NP_HOST_TCP_HTTP2", "A host providing an index page containing the string 'monitoring'", "test.monitoring-plugins.org"); +my $host_tcp_proxy = getTestParameter("NP_HOST_TCP_PROXY", "A host providing a HTTP proxy with CONNECT support", "localhost"); +my $port_tcp_proxy = getTestParameter("NP_PORT_TCP_PROXY", "Port of the proxy with HTTP and CONNECT support", "3128"); my $faketime = -x '/usr/bin/faketime' ? 1 : 0; @@ -158,7 +133,7 @@ SKIP: { # run some certificate checks with faketime SKIP: { - skip "No faketime binary found", 12 if !$faketime; + skip "No faketime binary found", 7 if !$faketime; $res = NPTest->testCmd("LC_TIME=C TZ=UTC ./check_http -C 1 $host_tls_http"); like($res->output, qr/OK - Certificate '$host_tls_cert' will expire on/, "Catch cert output"); is( $res->return_code, 0, "Catch cert output exit code" ); @@ -171,23 +146,18 @@ SKIP: { my $time = strftime("%Y-%m-%d %H:%M:%S", localtime($ts)); $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts))."' ./check_http -C 1 $host_tls_http"); like($res->output, qr/CRITICAL - Certificate '$host_tls_cert' just expired/, "Output on expire date"); - is( $res->return_code, 2, "Output on expire date" ); $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts-1))."' ./check_http -C 1 $host_tls_http"); like($res->output, qr/CRITICAL - Certificate '$host_tls_cert' expires in 0 minutes/, "cert expires in 1 second output"); - is( $res->return_code, 2, "cert expires in 1 second exit code" ); $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts-120))."' ./check_http -C 1 $host_tls_http"); like($res->output, qr/CRITICAL - Certificate '$host_tls_cert' expires in 2 minutes/, "cert expires in 2 minutes output"); - is( $res->return_code, 2, "cert expires in 2 minutes exit code" ); $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts-7200))."' ./check_http -C 1 $host_tls_http"); like($res->output, qr/CRITICAL - Certificate '$host_tls_cert' expires in 2 hours/, "cert expires in 2 hours output"); - is( $res->return_code, 2, "cert expires in 2 hours exit code" ); $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+1))."' ./check_http -C 1 $host_tls_http"); like($res->output, qr/CRITICAL - Certificate '$host_tls_cert' expired on/, "Certificate expired output"); - is( $res->return_code, 2, "Certificate expired exit code" ); }; $res = NPTest->testCmd( "./check_http --ssl $host_tls_http -E" ); diff --git a/plugins/t/check_imap.t b/plugins/t/check_imap.t index 9c6eae1f..7c74e564 100644 --- a/plugins/t/check_imap.t +++ b/plugins/t/check_imap.t @@ -8,17 +8,10 @@ use strict; use Test::More tests => 7; use NPTest; -my $host_tcp_smtp = getTestParameter( "host_tcp_smtp", "NP_HOST_TCP_SMTP", "mailhost", - "A host providing an STMP Service (a mail server)"); - -my $host_tcp_imap = getTestParameter( "host_tcp_imap", "NP_HOST_TCP_IMAP", $host_tcp_smtp, - "A host providing an IMAP Service (a mail server)"); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); +my $host_tcp_smtp = getTestParameter("NP_HOST_TCP_SMTP", "A host providing an STMP Service (a mail server)", "mailhost"); +my $host_tcp_imap = getTestParameter("NP_HOST_TCP_IMAP", "A host providing an IMAP Service (a mail server)", $host_tcp_smtp); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $t; diff --git a/plugins/t/check_jabber.t b/plugins/t/check_jabber.t index 7a708d5b..fcdae179 100644 --- a/plugins/t/check_jabber.t +++ b/plugins/t/check_jabber.t @@ -10,23 +10,9 @@ use NPTest; plan tests => 10; -my $host_tcp_jabber = getTestParameter( - "NP_HOST_TCP_JABBER", - "A host providing the Jabber Service", - "jabber.org" - ); - -my $host_nonresponsive = getTestParameter( - "NP_HOST_NONRESPONSIVE", - "The hostname of system not responsive to network requests", - "10.0.0.1", - ); - -my $hostname_invalid = getTestParameter( - "NP_HOSTNAME_INVALID", - "An invalid (not known to DNS) hostname", - "nosuchhost", - ); +my $host_tcp_jabber = getTestParameter("NP_HOST_TCP_JABBER", "A host providing the Jabber Service", "jabber.de"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/'; diff --git a/plugins/t/check_ldap.t b/plugins/t/check_ldap.t index b8944d4b..b8a4a766 100644 --- a/plugins/t/check_ldap.t +++ b/plugins/t/check_ldap.t @@ -9,19 +9,10 @@ use warnings; use Test::More; use NPTest; -my $host_tcp_ldap = getTestParameter("NP_HOST_TCP_LDAP", - "A host providing the LDAP Service", - "localhost" ); - -my $ldap_base_dn = getTestParameter("NP_LDAP_BASE_DN", - "A base dn for the LDAP Service", - "cn=admin" ); - -my $host_nonresponsive = getTestParameter("host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter("hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); +my $host_tcp_ldap = getTestParameter("NP_HOST_TCP_LDAP", "A host providing the LDAP Service", "localhost"); +my $ldap_base_dn = getTestParameter("NP_LDAP_BASE_DN", "A base dn for the LDAP Service", "cn=admin"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my($result, $cmd); my $command = './check_ldap'; diff --git a/plugins/t/check_mysql.t b/plugins/t/check_mysql.t index 28cd4cd0..e426bf59 100644 --- a/plugins/t/check_mysql.t +++ b/plugins/t/check_mysql.t @@ -21,30 +21,11 @@ plan skip_all => "check_mysql not compiled" unless (-x "check_mysql"); plan tests => 15; my $bad_login_output = '/Access denied for user /'; -my $mysqlserver = getTestParameter( - "NP_MYSQL_SERVER", - "A MySQL Server hostname or IP with no slaves setup" - ); -my $mysqlsocket = getTestParameter( - "NP_MYSQL_SOCKET", - "Full path to a MySQL Server socket with no slaves setup" - ); -my $mysql_login_details = getTestParameter( - "MYSQL_LOGIN_DETAILS", - "Command line parameters to specify login access (requires " . - "REPLICATION CLIENT privleges)", - "-u test -ptest", - ); -my $with_slave = getTestParameter( - "NP_MYSQL_WITH_SLAVE", - "MySQL server with slaves setup" - ); -my $with_slave_login = getTestParameter( - "NP_MYSQL_WITH_SLAVE_LOGIN", - "Login details for server with slave (requires REPLICATION CLIENT " . - "privleges)", - $mysql_login_details || "-u test -ptest" - ); +my $mysqlserver = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server hostname or IP with no slaves setup"); +my $mysqlsocket = getTestParameter("NP_MYSQL_SOCKET", "Full path to a MySQL Server socket with no slaves setup"); +my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access (requires REPLICATION CLIENT privleges)", "-u test -ptest"); +my $with_slave = getTestParameter("NP_MYSQL_WITH_SLAVE", "MySQL server with slaves setup"); +my $with_slave_login = getTestParameter("NP_MYSQL_WITH_SLAVE_LOGIN", "Login details for server with slave (requires REPLICATION CLIENT privleges)", $mysql_login_details || "-u test -ptest"); my $result; diff --git a/plugins/t/check_mysql_query.t b/plugins/t/check_mysql_query.t index 407af881..96899ac6 100644 --- a/plugins/t/check_mysql_query.t +++ b/plugins/t/check_mysql_query.t @@ -17,15 +17,8 @@ use vars qw($tests); plan skip_all => "check_mysql_query not compiled" unless (-x "check_mysql_query"); -my $mysqlserver = getTestParameter( - "NP_MYSQL_SERVER", - "A MySQL Server with no slaves setup" - ); -my $mysql_login_details = getTestParameter( - "MYSQL_LOGIN_DETAILS", - "Command line parameters to specify login access", - "-u user -ppw -d db", - ); +my $mysqlserver = getTestParameter("NP_MYSQL_SERVER", "A MySQL Server with no slaves setup"); +my $mysql_login_details = getTestParameter("NP_MYSQL_LOGIN_DETAILS", "Command line parameters to specify login access", "-u user -ppw -d db"); my $result; if (! $mysqlserver) { diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t index 9a6cd2bb..f2f218fd 100644 --- a/plugins/t/check_snmp.t +++ b/plugins/t/check_snmp.t @@ -15,18 +15,12 @@ BEGIN { my $res; -my $host_snmp = getTestParameter( "host_snmp", "NP_HOST_SNMP", "localhost", - "A host providing an SNMP Service"); +my $host_snmp = getTestParameter("NP_HOST_SNMP", "A host providing an SNMP Service", "localhost"); +my $snmp_community = getTestParameter("NP_SNMP_COMMUNITY", "The SNMP Community string for SNMP Testing (assumes snmp v1)", "public"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); +my $user_snmp = getTestParameter("NP_SNMP_USER", "An SNMP user", "auth_md5"); -my $snmp_community = getTestParameter( "snmp_community", "NP_SNMP_COMMUNITY", "public", - "The SNMP Community string for SNMP Testing (assumes snmp v1)" ); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); -my $user_snmp = getTestParameter( "user_snmp", "NP_SNMP_USER", "auth_md5", "An SNMP user"); $res = NPTest->testCmd( "./check_snmp -t 1" ); is( $res->return_code, 3, "No host name" ); diff --git a/plugins/t/check_ssh.t b/plugins/t/check_ssh.t index 80083492..a5cd23ce 100644 --- a/plugins/t/check_ssh.t +++ b/plugins/t/check_ssh.t @@ -9,17 +9,9 @@ use Test::More; use NPTest; # Required parameters -my $ssh_host = getTestParameter("NP_SSH_HOST", - "A host providing SSH service", - "localhost"); - -my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", - "The hostname of system not responsive to network requests", - "10.0.0.1" ); - -my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", - "An invalid (not known to DNS) hostname", - "nosuchhost" ); +my $ssh_host = getTestParameter("NP_SSH_HOST", "A host providing SSH service", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1" ); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost" ); plan skip_all => "SSH_HOST must be defined" unless $ssh_host; diff --git a/plugins/t/check_tcp.t b/plugins/t/check_tcp.t index 121b0cb3..cb4de53d 100644 --- a/plugins/t/check_tcp.t +++ b/plugins/t/check_tcp.t @@ -15,21 +15,11 @@ BEGIN { } -my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost", - "A host providing the HTTP Service (a web server)" ); - -my $host_tls_http = getTestParameter( "host_tls_http", "NP_HOST_TLS_HTTP", "localhost", - "A host providing the HTTPS Service (a tls web server)" ); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); - -my $internet_access = getTestParameter( "NP_INTERNET_ACCESS", - "Is this system directly connected to the internet?", - "yes"); +my $host_tcp_http = getTestParameter("NP_HOST_TCP_HTTP", "A host providing the HTTP Service (a web server)", "localhost"); +my $host_tls_http = getTestParameter("NP_HOST_TLS_HTTP", "A host providing the HTTPS Service (a tls web server)", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); +my $internet_access = getTestParameter("NP_INTERNET_ACCESS", "Is this system directly connected to the internet?", "yes"); my $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/'; diff --git a/plugins/t/check_time.t b/plugins/t/check_time.t index 961f56e6..92c2f891 100644 --- a/plugins/t/check_time.t +++ b/plugins/t/check_time.t @@ -11,14 +11,9 @@ use NPTest; use vars qw($tests); BEGIN {$tests = 8; plan tests => $tests} -my $host_udp_time = getTestParameter( "host_udp_time", "NP_HOST_UDP_TIME", "localhost", - "A host providing the UDP Time Service" ); - -my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1", - "The hostname of system not responsive to network requests" ); - -my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost", - "An invalid (not known to DNS) hostname" ); +my $host_udp_time = getTestParameter("NP_HOST_UDP_TIME", "A host providing the UDP Time Service", "localhost"); +my $host_nonresponsive = getTestParameter("NP_HOST_NONRESPONSIVE", "The hostname of system not responsive to network requests", "10.0.0.1"); +my $hostname_invalid = getTestParameter("NP_HOSTNAME_INVALID", "An invalid (not known to DNS) hostname", "nosuchhost"); my $successOutput = '/^TIME OK - [0-9]+ second time difference/'; |