remove source-dist branch
This commit is contained in:
commit
27dcec3fa7
416 changed files with 128456 additions and 0 deletions
33
plugins/t/check_disk.t
Normal file
33
plugins/t/check_disk.t
Normal file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Disk Space Tests via check_disk
|
||||
#
|
||||
# $Id: check_disk.t,v 1.2 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 10; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/^DISK OK - /';
|
||||
my $failureOutput = '/^DISK CRITICAL - /';
|
||||
|
||||
my $mountpoint_valid = getTestParameter( "mountpoint_valid", "NP_MOUNTPOINT_VALID", "/",
|
||||
"The path to a valid mountpoint" );
|
||||
|
||||
my $mountpoint_invalid = getTestParameter( "mountpoint_invalid", "NP_MOUNTPOINT_INVALID", "/missing",
|
||||
"The path to a invalid (non-existent) mountpoint" );
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_disk 100 100 ${mountpoint_valid}", 0, $successOutput );
|
||||
$t += checkCmd( "./check_disk -w 0 -c 0 ${mountpoint_valid}", 0, $successOutput );
|
||||
$t += checkCmd( "./check_disk -w 1\% -c 1\% ${mountpoint_valid}", 0, $successOutput );
|
||||
$t += checkCmd( "./check_disk 0 0 ${mountpoint_valid}", 2, $failureOutput );
|
||||
$t += checkCmd( "./check_disk 100 100 ${mountpoint_invalid}", 2, '/not found/' );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
42
plugins/t/check_dns.t
Normal file
42
plugins/t/check_dns.t
Normal file
|
@ -0,0 +1,42 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Domain Name Server (DNS) Tests via check_dns
|
||||
#
|
||||
# $Id: check_dns.t,v 1.3 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 6; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/DNS OK: [\.0-9]+ seconds response time/';
|
||||
|
||||
my $hostname_valid = getTestParameter( "hostname_valid", "NP_HOSTNAME_VALID", "localhost",
|
||||
"A valid (known to DNS) hostname" );
|
||||
|
||||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
|
||||
my $dns_server = getTestParameter( "dns_server", "NP_DNS_SERVER", undef,
|
||||
"A non default (remote) DNS server" );
|
||||
|
||||
my $t;
|
||||
|
||||
#
|
||||
# Default DNS Server
|
||||
#
|
||||
$t += checkCmd( "./check_dns -H $hostname_valid -t 5", 0, $successOutput );
|
||||
$t += checkCmd( "./check_dns -H $hostname_invalid -t 1", 2 );
|
||||
|
||||
#
|
||||
# Specified DNS Server
|
||||
#
|
||||
$t += checkCmd( "./check_dns -H $hostname_valid -s $dns_server -t 5", 0, $successOutput );
|
||||
$t += checkCmd( "./check_dns -H $hostname_invalid -s $dns_server -t 1", 2 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
43
plugins/t/check_fping.t
Normal file
43
plugins/t/check_fping.t
Normal file
|
@ -0,0 +1,43 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# FPing Tests via check_fping
|
||||
#
|
||||
# $Id: check_fping.t,v 1.2 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
|
||||
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 $t;
|
||||
|
||||
if ( -x "./check_fping" )
|
||||
{
|
||||
$t += checkCmd( "./check_fping $host_responsive", 0, $successOutput );
|
||||
$t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
|
||||
$t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_fping", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
34
plugins/t/check_ftp.t
Normal file
34
plugins/t/check_ftp.t
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# File Transfer Protocol (FTP) Test via check_ftp
|
||||
#
|
||||
# $Id: check_ftp.t,v 1.3 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
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 $successOutput = '/FTP OK -\s+[0-9]?\.?[0-9]+ second response time/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_ftp $host_tcp_ftp -wt 300 -ct 600", 0, $successOutput );
|
||||
$t += checkCmd( "./check_ftp $host_nonresponsive -wt 0 -ct 0 -to 1", 2 );
|
||||
$t += checkCmd( "./check_ftp $hostname_invalid -wt 0 -ct 0", 2 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
42
plugins/t/check_hpjd.t
Normal file
42
plugins/t/check_hpjd.t
Normal file
|
@ -0,0 +1,42 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# HP JetDirect Test via check_hpjd
|
||||
#
|
||||
# $Id: check_hpjd.t,v 1.2 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/^Printer ok - /';
|
||||
my $failureOutput = '/Timeout: No [Rr]esponse from /';
|
||||
|
||||
my $host_tcp_hpjd = getTestParameter( "host_tcp_hpjd", "NP_HOST_TCP_HPJD", undef,
|
||||
"A host (usually a printer) providing the HP-JetDirect Services" );
|
||||
|
||||
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 $t;
|
||||
|
||||
if ( -x "./check_hpjd" )
|
||||
{
|
||||
$t += checkCmd( "./check_hpjd $host_tcp_hpjd", 0, $successOutput );
|
||||
$t += checkCmd( "./check_hpjd $host_nonresponsive", 2, $failureOutput );
|
||||
$t += checkCmd( "./check_hpjd $hostname_invalid", 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_hpjd", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
36
plugins/t/check_http.t
Normal file
36
plugins/t/check_http.t
Normal file
|
@ -0,0 +1,36 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# HyperText Transfer Protocol (HTTP) Test via check_http
|
||||
#
|
||||
# $Id: check_http.t,v 1.4 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost",
|
||||
"A host providing the HTTP Service (a 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 $successOutput = '/(HTTP\s[o|O][k|K]\s)?\s?HTTP\/1.[01]\s[0-9]{3}\s(OK|Found)\s-\s+[0-9]+\sbytes\sin\s+([0-9]+|[0-9]+\.[0-9]+)\sseconds/';
|
||||
|
||||
my %exceptions = ( 2 => "No Web Server present?" );
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_http $host_tcp_http -wt 300 -ct 600", { 0 => 'continue', 2 => 'skip' }, $successOutput, %exceptions );
|
||||
$t += checkCmd( "./check_http $host_nonresponsive -wt 1 -ct 2", 2 );
|
||||
$t += checkCmd( "./check_http $hostname_invalid -wt 1 -ct 2", 2 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
39
plugins/t/check_imap.t
Normal file
39
plugins/t/check_imap.t
Normal file
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Internet Mail Access Protocol (IMAP) Server Tests via check_imap
|
||||
#
|
||||
# $Id: check_imap.t,v 1.2 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
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 %exceptions = ( 2 => "No IMAP Server present?" );
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_imap $host_tcp_imap", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_imap -H $host_tcp_imap -p 143 -w 9 -c 9 -t 10 -e '* OK'", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_imap $host_tcp_imap -p 143 -wt 9 -ct 9 -to 10 -e '* OK'", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_imap $host_nonresponsive", 2 );
|
||||
$t += checkCmd( "./check_imap $hostname_invalid", 2 );
|
||||
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
25
plugins/t/check_load.t
Normal file
25
plugins/t/check_load.t
Normal file
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Load Average Tests via check_load
|
||||
#
|
||||
# $Id: check_load.t,v 1.4 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/^OK - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
|
||||
my $failureOutput = '/^CRITICAL - load average: [0-9]\.?[0-9]+, [0-9]\.?[0-9]+, [0-9]\.?[0-9]+/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_load -w 100,100,100 -c 100,100,100", 0, $successOutput );
|
||||
$t += checkCmd( "./check_load -w 0,0,0 -c 0,0,0", 2, $failureOutput );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
33
plugins/t/check_mysql.t
Normal file
33
plugins/t/check_mysql.t
Normal file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# MySQL Database Server Tests via check_mysql
|
||||
#
|
||||
# $Id: check_mysql.t,v 1.3 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 2; plan tests => $tests}
|
||||
|
||||
my $t;
|
||||
|
||||
my $failureOutput = '/Access denied for user: /';
|
||||
|
||||
if ( -x "./check_mysql" )
|
||||
{
|
||||
my $mysqlserver = getTestParameter( "mysql_server", "NP_MYSQL_SERVER", undef,
|
||||
"A MySQL Server");
|
||||
|
||||
$t += checkCmd( "./check_mysql -H $mysqlserver -P 3306", 2, $failureOutput );
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_mysql", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
37
plugins/t/check_ping.t
Normal file
37
plugins/t/check_ping.t
Normal file
|
@ -0,0 +1,37 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Ping Response Tests via check_ping
|
||||
#
|
||||
# $Id: check_ping.t,v 1.3 2005/09/15 08:39:23 tonvoon Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 8; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/PING (ok|OK) - Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
my $failureOutput = '/Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
|
||||
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 $t;
|
||||
|
||||
$t += checkCmd( "./check_ping $host_responsive 100 100 1000 1000 -p 1", 0, $successOutput );
|
||||
$t += checkCmd( "./check_ping $host_responsive 0 0 0 0 -p 1", 2, $failureOutput );
|
||||
$t += checkCmd( "./check_ping $host_nonresponsive 0 0 0 0 -p 1 -to 1", 2 );
|
||||
$t += checkCmd( "./check_ping $hostname_invalid 0 0 0 0 -p 1 -to 1", 3 );
|
||||
$t += checkCmd( "./check_ping -w 100,10% -c 200,20%" , 3 , "/You must specify a server address or host name.*/");
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
38
plugins/t/check_pop.t
Normal file
38
plugins/t/check_pop.t
Normal file
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Post Office Protocol (POP) Server Tests via check_pop
|
||||
#
|
||||
# $Id: check_pop.t,v 1.2 2005/07/25 01:47:14 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
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_pop = getTestParameter( "host_tcp_pop", "NP_HOST_TCP_POP", $host_tcp_smtp,
|
||||
"A host providing an POP 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 %exceptions = ( 2 => "No POP Server present?" );
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_pop $host_tcp_pop", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_pop -H $host_tcp_pop -p 110 -w 9 -c 9 -t 10 -e '+OK'", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_pop $host_tcp_pop -p 110 -wt 9 -ct 9 -to 10 -e '+OK'", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_pop $host_nonresponsive", 2 );
|
||||
$t += checkCmd( "./check_pop $hostname_invalid", 2 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
24
plugins/t/check_procs.t
Normal file
24
plugins/t/check_procs.t
Normal file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Process Tests via check_procs
|
||||
#
|
||||
# $Id: check_procs.t,v 1.3 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 10; plan tests => $tests}
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_procs -w 100000 -c 100000", 0, '/^PROCS OK: [0-9]+ process(es)?$/' );
|
||||
$t += checkCmd( "./check_procs -w 100000 -c 100000 -s Z", 0, '/^PROCS OK: [0-9]+ process(es)? with /' );
|
||||
$t += checkCmd( "./check_procs -w 0 -c 10000000", 1, '/^PROCS WARNING: [0-9]+ process(es)?$/' );
|
||||
$t += checkCmd( "./check_procs -w 0 -c 0", 2, '/^PROCS CRITICAL: [0-9]+ process(es)?$/' );
|
||||
$t += checkCmd( "./check_procs -w 0 -c 0 -s S", 2, '/^PROCS CRITICAL: [0-9]+ process(es)? with /' );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
34
plugins/t/check_smtp.t
Normal file
34
plugins/t/check_smtp.t
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Simple Mail Transfer Protocol (SMTP) Test via check_smtp
|
||||
#
|
||||
# $Id: check_smtp.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
my $host_tcp_smtp = getTestParameter( "host_tcp_smtp", "NP_HOST_TCP_SMTP", "mailhost",
|
||||
"A host providing an STMP 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 %exceptions = ( 2 => "No SMTP Server present?" );
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_smtp $host_tcp_smtp", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_smtp -H $host_tcp_smtp -p 25 -t 1 -w 9 -c 9 -t 10 -e 220", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_smtp -H $host_tcp_smtp -p 25 -wt 9 -ct 9 -to 10 -e 220", 0, undef, %exceptions );
|
||||
$t += checkCmd( "./check_smtp $host_nonresponsive", 2 );
|
||||
$t += checkCmd( "./check_smtp $hostname_invalid", 3 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
57
plugins/t/check_snmp.t
Normal file
57
plugins/t/check_snmp.t
Normal file
|
@ -0,0 +1,57 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Simple Network Management Protocol (SNMP) Test via check_snmp
|
||||
#
|
||||
# $Id: check_snmp.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 12; plan tests => $tests}
|
||||
|
||||
my $t;
|
||||
|
||||
if ( -x "./check_snmp" )
|
||||
{
|
||||
my $host_snmp = getTestParameter( "host_snmp", "NP_HOST_SNMP", "localhost",
|
||||
"A host providing an SNMP Service");
|
||||
|
||||
my $snmp_community = getTestParameter( "snmp_community", "NP_SNMP_COMMUNITY", "public",
|
||||
"The SNMP Community string for SNMP Testing" );
|
||||
|
||||
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 %exceptions = ( 3 => "No SNMP Server present?" );
|
||||
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:",
|
||||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - \d+/', %exceptions );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1",
|
||||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - 1\s*$/', %exceptions );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0 -c 1:",
|
||||
{ 1 => 'continue', 3 => 'skip' }, '/^SNMP WARNING - \*1\*\s*$/', %exceptions );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w :0 -c 0",
|
||||
{ 2 => 'continue', 3 => 'skip' }, '/^SNMP CRITICAL - \*1\*\s*$/', %exceptions );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:", 3, '/SNMP problem - /' );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:", 3, '/SNMP problem - /' );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_snmp", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
25
plugins/t/check_swap.t
Normal file
25
plugins/t/check_swap.t
Normal file
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Swap Space Tests via check_swap
|
||||
#
|
||||
# $Id: check_swap.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 6; plan tests => $tests}
|
||||
|
||||
my $t;
|
||||
|
||||
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\)/';
|
||||
|
||||
$t += checkCmd( "./check_swap -w 1048576 -c 1048576", 0, $successOutput ); # 1MB free
|
||||
$t += checkCmd( "./check_swap -w 1\% -c 1\%", 0, $successOutput ); # 1% free
|
||||
$t += checkCmd( "./check_swap -w 100\% -c 100\%", 2, $failureOutput ); # 100% free (always fails)
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
34
plugins/t/check_tcp.t
Normal file
34
plugins/t/check_tcp.t
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# TCP Connection Based Tests via check_tcp
|
||||
#
|
||||
# $Id: check_tcp.t,v 1.3 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
|
||||
my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost",
|
||||
"A host providing the HTTP Service (a 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 $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput );
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test
|
||||
$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
$t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
40
plugins/t/check_time.t
Normal file
40
plugins/t/check_time.t
Normal file
|
@ -0,0 +1,40 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# System Time Tests via check_time
|
||||
#
|
||||
# $Id: check_time.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
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 $successOutput = '/^TIME OK - [0-9]+ second time difference/';
|
||||
|
||||
my $t;
|
||||
|
||||
# standard mode
|
||||
$t += checkCmd( "./check_time -H $host_udp_time -w 999999,59 -c 999999,59 -t 60", 0, $successOutput );
|
||||
$t += checkCmd( "./check_time -H $host_udp_time -w 999999 -W 59 -c 999999 -C 59 -t 60", 0, $successOutput );
|
||||
|
||||
# reverse compatibility mode
|
||||
$t += checkCmd( "./check_time $host_udp_time -wt 59 -ct 59 -cd 999999 -wd 999999 -to 60", 0, $successOutput );
|
||||
|
||||
# failure mode
|
||||
$t += checkCmd( "./check_time -H $host_nonresponsive -t 1", 2 );
|
||||
$t += checkCmd( "./check_time -H $hostname_invalid -t 1", 3 );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
33
plugins/t/check_udp.t
Normal file
33
plugins/t/check_udp.t
Normal file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# UDP Connection Based Tests via check_udp
|
||||
#
|
||||
# $Id: check_udp.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 3; plan tests => $tests} #TODO# Update to 4 when the commented out test is fixed
|
||||
|
||||
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 $successOutput = '/^Connection accepted on port [0-9]+ - [0-9]+ second response time$/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_udp -H $host_udp_time -p 37 -wt 300 -ct 600", 0, $successOutput );
|
||||
$t += checkCmd( "./check_udp $host_nonresponsive -p 37 -wt 0 -ct 0 -to 1", 2 );
|
||||
#TODO# $t += checkCmd( "./check_udp $hostname_invalid -p 37 -wt 0 -ct 0 -to 1", 2 ); # Currently returns 0 (ie success)
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
25
plugins/t/check_users.t
Normal file
25
plugins/t/check_users.t
Normal file
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Logged in Users Tests via check_users
|
||||
#
|
||||
# $Id: check_users.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 4; plan tests => $tests}
|
||||
|
||||
my $successOutput = '/^USERS OK - [0-9]+ users currently logged in/';
|
||||
my $failureOutput = '/^USERS CRITICAL - [0-9]+ users currently logged in/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_users 1000 1000", 0, $successOutput );
|
||||
$t += checkCmd( "./check_users 0 0", 2, $failureOutput );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue