New upstream version 2.3.2
This commit is contained in:
		
							parent
							
								
									09f4277f49
								
							
						
					
					
						commit
						21323d25dd
					
				
					 104 changed files with 34386 additions and 7430 deletions
				
			
		| 
						 | 
				
			
			@ -1,54 +0,0 @@
 | 
			
		|||
{
 | 
			
		||||
  '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_CIDR' => '130.133.8.41/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_NONRESPONSIVE' => '10.0.0.1',
 | 
			
		||||
  'NP_HOST_RESPONSIVE' => 'localhost',
 | 
			
		||||
  'NP_HOST_SMB' => '',
 | 
			
		||||
  'NP_HOST_SNMP' => '',
 | 
			
		||||
  'NP_HOST_TCP_FTP' => '',
 | 
			
		||||
  'NP_HOST_TCP_HPJD' => '',
 | 
			
		||||
  '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_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' => '',
 | 
			
		||||
  'NP_SNMP_USER' => '',
 | 
			
		||||
  'NP_SSH_CONFIGFILE' => '~/.ssh/config',
 | 
			
		||||
  'NP_SSH_HOST' => 'localhost',
 | 
			
		||||
  'NP_SSH_IDENTITY' => '~/.ssh/id_rsa'
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ use Test::More;
 | 
			
		|||
use POSIX qw/mktime strftime/;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
plan tests => 58;
 | 
			
		||||
plan tests => 57;
 | 
			
		||||
 | 
			
		||||
my $successOutput = '/OK.*HTTP.*second/';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ like( $res->output, '/^Host: testhost:8001\s*$/ms', "Host Header OK" );
 | 
			
		|||
like( $res->output, '/CURLOPT_URL: http:\/\/'.$host_tcp_http.':80\//ms', "Url OK" );
 | 
			
		||||
 | 
			
		||||
SKIP: {
 | 
			
		||||
        skip "No internet access", 3 if $internet_access eq "no";
 | 
			
		||||
        skip "No internet access", 4 if $internet_access eq "no";
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -S");
 | 
			
		||||
        like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" );
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ SKIP: {
 | 
			
		|||
        $res = NPTest->testCmd("./$plugin -v -H $host_tls_http:443 -S -p 443");
 | 
			
		||||
        like( $res->output, '/^Host: '.$host_tls_http.'\s*$/ms', "Host Header OK" );
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -D -p 443");
 | 
			
		||||
        $res = NPTest->testCmd("./$plugin -v -H $host_tls_http -D -S -p 443");
 | 
			
		||||
        like( $res->output, '/(^Host: '.$host_tls_http.'\s*$)|(cURL returned 60)/ms', "Host Header OK" );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ SKIP: {
 | 
			
		|||
        cmp_ok( $res->return_code, "==", 0, "And also when not found");
 | 
			
		||||
}
 | 
			
		||||
SKIP: {
 | 
			
		||||
        skip "No internet access", 16 if $internet_access eq "no";
 | 
			
		||||
        skip "No internet access", 28 if $internet_access eq "no";
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd(
 | 
			
		||||
                "./$plugin --ssl $host_tls_http"
 | 
			
		||||
| 
						 | 
				
			
			@ -188,13 +188,7 @@ SKIP: {
 | 
			
		|||
        like  ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
 | 
			
		||||
        like  ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd(
 | 
			
		||||
                "./$plugin --ssl -H www.e-paycobalt.com"
 | 
			
		||||
                );
 | 
			
		||||
        cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f follow" );
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f curl" );
 | 
			
		||||
        is( $res->return_code, 0, "Redirection based on location is okay");
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -H www.mozilla.com --extended-perfdata" );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,8 +88,9 @@ $result = NPTest->testCmd(
 | 
			
		|||
        );
 | 
			
		||||
$_ = $result->perf_output;
 | 
			
		||||
my ($warn_absth_data, $crit_absth_data, $total_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/);
 | 
			
		||||
is ($warn_absth_data, $total_absth_data - 20, "Wrong warning in perf data using absolute thresholds");
 | 
			
		||||
is ($crit_absth_data, $total_absth_data - 10, "Wrong critical in perf data using absolute thresholds");
 | 
			
		||||
# default unit is MiB, but perfdata is always bytes
 | 
			
		||||
is ($warn_absth_data, $total_absth_data - (20 * (2 ** 20)), "Wrong warning in perf data using absolute thresholds");
 | 
			
		||||
is ($crit_absth_data, $total_absth_data - (10 * (2 ** 20)), "Wrong critical in perf data using absolute thresholds");
 | 
			
		||||
 | 
			
		||||
# Then check percent thresholds.
 | 
			
		||||
$result = NPTest->testCmd(
 | 
			
		||||
| 
						 | 
				
			
			@ -119,7 +120,7 @@ like  ( $result->only_output, qr/$more_free/, "Have disk name in text");
 | 
			
		|||
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" );
 | 
			
		||||
cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free");
 | 
			
		||||
$_ = $result->output;
 | 
			
		||||
my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+) MB .* (\d+) MB /g);
 | 
			
		||||
my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+)MiB .* (\d+)MiB /g);
 | 
			
		||||
my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,7 @@ use NPTest;
 | 
			
		|||
 | 
			
		||||
plan skip_all => "check_dns not compiled" unless (-x "check_dns");
 | 
			
		||||
 | 
			
		||||
plan tests => 19;
 | 
			
		||||
plan tests => 23;
 | 
			
		||||
 | 
			
		||||
my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -105,3 +105,11 @@ cmp_ok( $res->return_code, '==', 0, "Got expected address");
 | 
			
		|||
$res = NPTest->testCmd("./check_dns -H $hostname_valid -a $hostname_invalid_cidr -t 5");
 | 
			
		||||
cmp_ok( $res->return_code, '==', 2, "Got wrong address");
 | 
			
		||||
like  ( $res->output, "/^DNS CRITICAL.*expected '$hostname_invalid_cidr' but got '$hostname_valid_ip'".'$/', "Output OK");
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd("./check_dns -H $hostname_valid -n");
 | 
			
		||||
cmp_ok( $res->return_code, '==', 2, "Found $hostname_valid");
 | 
			
		||||
like  ( $res->output, "/^DNS CRITICAL.*Domain '$hostname_valid' was found by the server:/", "Output OK");
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd("./check_dns -H $hostname_invalid -n");
 | 
			
		||||
cmp_ok( $res->return_code, '==', 0, "Did not find $hostname_invalid");
 | 
			
		||||
like  ( $res->output, $successOutput, "Output OK" );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,34 +5,30 @@
 | 
			
		|||
#
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
use Test;
 | 
			
		||||
use Test::More;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
use vars qw($tests);
 | 
			
		||||
 | 
			
		||||
BEGIN {$tests = 4; plan tests => $tests}
 | 
			
		||||
 | 
			
		||||
my $successOutput = '/^FPING OK - /';
 | 
			
		||||
my $failureOutput = '/^FPING CRITICAL - /';
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
my $res;
 | 
			
		||||
 | 
			
		||||
my $fping = qx(which fping 2> /dev/null);
 | 
			
		||||
chomp($fping);
 | 
			
		||||
if( ! -x "./check_fping") {
 | 
			
		||||
  $t += skipMissingCmd( "./check_fping", $tests );
 | 
			
		||||
	plan skip_all => "check_fping not found, skipping tests";
 | 
			
		||||
}
 | 
			
		||||
elsif ( $> != 0 && (!$fping || ! -u $fping)) {
 | 
			
		||||
  $t += skipMsg( "./check_fping", $tests );
 | 
			
		||||
elsif ( !$fping || !-x $fping ) {
 | 
			
		||||
	plan skip_all => "fping not found or cannot be executed, skipping tests";
 | 
			
		||||
} else {
 | 
			
		||||
  $t += checkCmd( "./check_fping $host_responsive",    0,       $successOutput );
 | 
			
		||||
  $t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
 | 
			
		||||
  $t += checkCmd( "./check_fping $hostname_invalid",   [ 1, 2 ] );
 | 
			
		||||
}
 | 
			
		||||
  plan tests => 3;
 | 
			
		||||
  $res = NPTest->testCmd( "./check_fping $host_responsive" );
 | 
			
		||||
  cmp_ok( $res->return_code, '==', 0, "Responsive host returns OK");
 | 
			
		||||
 | 
			
		||||
exit(0) if defined($Test::Harness::VERSION);
 | 
			
		||||
exit($tests - $t);
 | 
			
		||||
  $res = NPTest->testCmd( "./check_fping $host_nonresponsive" );
 | 
			
		||||
  cmp_ok( $res->return_code, '==', 2, "Non-Responsive host returns Critical");
 | 
			
		||||
 | 
			
		||||
  $res = NPTest->testCmd( "./check_fping $hostname_invalid" );
 | 
			
		||||
  cmp_ok( $res->return_code, '==', 3, "Invalid host returns Unknown");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ use Test::More;
 | 
			
		|||
use POSIX qw/mktime strftime/;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
plan tests => 50;
 | 
			
		||||
plan tests => 49;
 | 
			
		||||
 | 
			
		||||
my $successOutput = '/OK.*HTTP.*second/';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ SKIP: {
 | 
			
		|||
        cmp_ok( $res->return_code, "==", 0, "And also when not found");
 | 
			
		||||
}
 | 
			
		||||
SKIP: {
 | 
			
		||||
        skip "No internet access", 16 if $internet_access eq "no";
 | 
			
		||||
        skip "No internet access", 23 if $internet_access eq "no";
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd(
 | 
			
		||||
                "./$plugin --ssl $host_tls_http"
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +135,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 ./$plugin -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" );
 | 
			
		||||
| 
						 | 
				
			
			@ -166,12 +166,6 @@ SKIP: {
 | 
			
		|||
        like  ( $res->output, '/time_connect=[\d\.]+/', 'Extended Performance Data Output OK' );
 | 
			
		||||
        like  ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd(
 | 
			
		||||
                "./$plugin --ssl -H www.e-paycobalt.com"
 | 
			
		||||
                );
 | 
			
		||||
        cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $res = NPTest->testCmd( "./$plugin -H www.mozilla.com -u /firefox -f follow" );
 | 
			
		||||
        is( $res->return_code, 0, "Redirection based on location is okay");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,10 +11,12 @@ use NPTest;
 | 
			
		|||
my $res;
 | 
			
		||||
 | 
			
		||||
my $loadValue = "[0-9]+\.?[0-9]+";
 | 
			
		||||
my $successOutput = "/^OK - load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
my $failureOutput = "/^CRITICAL - load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
my $successOutput = "/^LOAD OK - total load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
my $successScaledOutput = "/^LOAD OK - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
my $failureOutput = "/^LOAD CRITICAL - total load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
my $failurScaledOutput = "/^LOAD CRITICAL - scaled load average: $loadValue, $loadValue, $loadValue - total load average: $loadValue, $loadValue, $loadValue/";
 | 
			
		||||
 | 
			
		||||
plan tests => 11;
 | 
			
		||||
plan tests => 13;
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100" );
 | 
			
		||||
cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +28,7 @@ like( $res->output, $failureOutput, "Output OK");
 | 
			
		|||
 | 
			
		||||
$res = NPTest->testCmd( "./check_load -r -w 0,0,0 -c 0,0,0" );
 | 
			
		||||
cmp_ok( $res->return_code, 'eq', 2, "Load over 0 with per cpu division");
 | 
			
		||||
like( $res->output, $failureOutput, "Output OK");
 | 
			
		||||
like( $res->output, $failurScaledOutput, "Output OK");
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_load -w 100 -c 100,110" );
 | 
			
		||||
cmp_ok( $res->return_code, 'eq', 0, "Plugin can handle non-triplet-arguments");
 | 
			
		||||
| 
						 | 
				
			
			@ -34,3 +36,8 @@ like( $res->output, $successOutput, "Output OK");
 | 
			
		|||
like( $res->perf_output, "/load1=$loadValue;100.000;100.000/", "Test handling of non triplet thresholds (load1)");
 | 
			
		||||
like( $res->perf_output, "/load5=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load5)");
 | 
			
		||||
like( $res->perf_output, "/load15=$loadValue;100.000;110.000/", "Test handling of non triplet thresholds (load15)");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$res = NPTest->testCmd( "./check_load -w 100,100,100 -c 100,100,100 -r" );
 | 
			
		||||
cmp_ok( $res->return_code, 'eq', 0, "load not over 100");
 | 
			
		||||
like( $res->output, $successScaledOutput, "Output OK");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,9 +8,9 @@ use strict;
 | 
			
		|||
use Test::More tests => 8;
 | 
			
		||||
use NPTest;
 | 
			
		||||
 | 
			
		||||
my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/';
 | 
			
		||||
my $failureOutput = '/^SWAP CRITICAL - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/';
 | 
			
		||||
my $warnOutput    = '/^SWAP WARNING - [0-9]+\% free \([0-9]+ MB out of [0-9]+ MB\)/';
 | 
			
		||||
my $successOutput = '/^SWAP OK - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/';
 | 
			
		||||
my $failureOutput = '/^SWAP CRITICAL - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/';
 | 
			
		||||
my $warnOutput    = '/^SWAP WARNING - [0-9]+\% free \([0-9]+MB out of [0-9]+MB\)/';
 | 
			
		||||
 | 
			
		||||
my $result;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue