Imported Upstream version 1.4.15
This commit is contained in:
parent
882cdeecca
commit
047baae1ca
386 changed files with 60019 additions and 38317 deletions
21
plugins/tests/certs/expired-cert.pem
Normal file
21
plugins/tests/certs/expired-cert.pem
Normal file
|
@ -0,0 +1,21 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDYzCCAsygAwIBAgIJAJISzcX71f5pMA0GCSqGSIb3DQEBBAUAMH8xCzAJBgNV
|
||||
BAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIxFzAV
|
||||
BgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwGCSqG
|
||||
SIb3DQEJARYPdG9udm9vbkBtYWMuY29tMB4XDTA5MDMwNjAwMTMxNVoXDTA5MDMw
|
||||
NTAwMTMxNlowfzELMAkGA1UEBhMCVUsxEzARBgNVBAgTCkRlcmJ5c2hpcmUxDzAN
|
||||
BgNVBAcTBkJlbHBlcjEXMBUGA1UEChMOTmFnaW9zIFBsdWdpbnMxETAPBgNVBAMT
|
||||
CFRvbiBWb29uMR4wHAYJKoZIhvcNAQkBFg90b252b29uQG1hYy5jb20wgZ8wDQYJ
|
||||
KoZIhvcNAQEBBQADgY0AMIGJAoGBAOQHP4JnzACi4q6quXAiK+gTSffG6yyjEV+K
|
||||
iyutRgBF2MdF03X5ls0wENw/5fnMTrHynl4XoGoV/rD4CR2hGT0m7dv7Vu0MRLlP
|
||||
J1SCiFeMuQS30zzLMJr0A7IW869qRlKQmzxs1JT6XDbSoNQuF154zoxwNsKlMjoX
|
||||
tJSHN2YpAgMBAAGjgeYwgeMwHQYDVR0OBBYEFHWjM9OQldrDLMcAfPnUVfGxlzOp
|
||||
MIGzBgNVHSMEgaswgaiAFHWjM9OQldrDLMcAfPnUVfGxlzOpoYGEpIGBMH8xCzAJ
|
||||
BgNVBAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIx
|
||||
FzAVBgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwG
|
||||
CSqGSIb3DQEJARYPdG9udm9vbkBtYWMuY29tggkAkhLNxfvV/mkwDAYDVR0TBAUw
|
||||
AwEB/zANBgkqhkiG9w0BAQQFAAOBgQDHjoXoGwBamCiNplTt93jH/TO08RATdZP5
|
||||
45hlxv2+PKCjjTiFa2mjAvopFiqmYsr40XYEmpeYMiaOzOW5rBjtqBAT/JJWyfda
|
||||
SCmj3swqyKus63rv/iuokIhZzBdhbB+eOJJrmwT2SEc5KdRaipH0QAGF1nZAAGzo
|
||||
6xW7hkzYog==
|
||||
-----END CERTIFICATE-----
|
15
plugins/tests/certs/expired-key.pem
Normal file
15
plugins/tests/certs/expired-key.pem
Normal file
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICXAIBAAKBgQDkBz+CZ8wAouKuqrlwIivoE0n3xussoxFfiosrrUYARdjHRdN1
|
||||
+ZbNMBDcP+X5zE6x8p5eF6BqFf6w+AkdoRk9Ju3b+1btDES5TydUgohXjLkEt9M8
|
||||
yzCa9AOyFvOvakZSkJs8bNSU+lw20qDULhdeeM6McDbCpTI6F7SUhzdmKQIDAQAB
|
||||
AoGARgI3rHjjuDpKMGg4IMZNBqaNaiZHY9/44IVvrww21rSbFqtIfgsQEpU0R/rS
|
||||
R7xDWPztRGQqmwd/t6OfYNpqHbjO1MWzasVBVnzue5P59Y1xy1h0LZF8+a9GY++0
|
||||
uAGUC24jsXSmypNVzoX+ZKyinA3oYV/etdPYx1W8Ms5XIzUCQQD7xwhMuLok6Kbq
|
||||
UEgiSfBTbx+haP3IiqqMF14z8QoEyD3jchydNaXEYdQxN8jEl2aPrMqTc6x8Jq4/
|
||||
ai0OkB+fAkEA59pAmN81HylV7+CsVjLOSbJqzau7NDxSs2uutxhHZRwz0e25wVer
|
||||
fA03l08u0ebC/TDHkmHV6ikCryM5HU2FNwJAVZJFzd2S1myEHmr+uTisB49jDrbi
|
||||
WkBWypo+mCS6JPnxntXvx7auClq9haTSBY73eqldiFPuMZvr6P2rJqHxPQJBAOTM
|
||||
quaxjti7kATy8N73sD9mBKQGju1TgkFxSK+DFCGhnTnToXY9MAtxd6SoDYoyccYu
|
||||
dyPrzJAR/IYc+mYCdC0CQDKlZuMPVXEgvGaQapzMQ++5yJRvMZF4tWvONBs0OCE9
|
||||
QYarsTi5M20cymMBXHOLZIjqwsni4G/C9kqJSvC75Vg=
|
||||
-----END RSA PRIVATE KEY-----
|
21
plugins/tests/certs/server-cert.pem
Normal file
21
plugins/tests/certs/server-cert.pem
Normal file
|
@ -0,0 +1,21 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDYzCCAsygAwIBAgIJAL8LkpNwzYdxMA0GCSqGSIb3DQEBBAUAMH8xCzAJBgNV
|
||||
BAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIxFzAV
|
||||
BgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwGCSqG
|
||||
SIb3DQEJARYPdG9udm9vbkBtYWMuY29tMB4XDTA5MDMwNTIxNDEyOFoXDTE5MDMw
|
||||
MzIxNDEyOFowfzELMAkGA1UEBhMCVUsxEzARBgNVBAgTCkRlcmJ5c2hpcmUxDzAN
|
||||
BgNVBAcTBkJlbHBlcjEXMBUGA1UEChMOTmFnaW9zIFBsdWdpbnMxETAPBgNVBAMT
|
||||
CFRvbiBWb29uMR4wHAYJKoZIhvcNAQkBFg90b252b29uQG1hYy5jb20wgZ8wDQYJ
|
||||
KoZIhvcNAQEBBQADgY0AMIGJAoGBAKcWMBtNtfY8vZXk0SN6/EYTVN/LOvaOSegy
|
||||
oVdLoGwuwjagk+XmCzvCqHZRp8lnCLay7AO8AQI7TSN02ihCcSrgGA9OT+HciIJ1
|
||||
l5/kEYUAuA1PR6YKK/T713zUAlMzy2tsugx5+xSsSEwsXkmne52jJiG/wuE5CLT0
|
||||
9pF8HQqHAgMBAAGjgeYwgeMwHQYDVR0OBBYEFGioSPQ/rdE19+zaeY2YvHTXlUDI
|
||||
MIGzBgNVHSMEgaswgaiAFGioSPQ/rdE19+zaeY2YvHTXlUDIoYGEpIGBMH8xCzAJ
|
||||
BgNVBAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIx
|
||||
FzAVBgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwG
|
||||
CSqGSIb3DQEJARYPdG9udm9vbkBtYWMuY29tggkAvwuSk3DNh3EwDAYDVR0TBAUw
|
||||
AwEB/zANBgkqhkiG9w0BAQQFAAOBgQCdqasaIO6JiV5ONFG6Tr1++85UfEdZKMUX
|
||||
N2NHiNNUunolIZEYR+dW99ezKmHlDiQ/tMgoLVYpl2Ubho2pAkLGQR+W0ZASgWQ1
|
||||
NjfV27Rv0y6lYQMTA0lVAU93L1x9reo3FMedmL5+H+lIEpLCxEPtAJNISrJOneZB
|
||||
W5jDadwkoQ==
|
||||
-----END CERTIFICATE-----
|
15
plugins/tests/certs/server-key.pem
Normal file
15
plugins/tests/certs/server-key.pem
Normal file
|
@ -0,0 +1,15 @@
|
|||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIICWwIBAAKBgQCnFjAbTbX2PL2V5NEjevxGE1Tfyzr2jknoMqFXS6BsLsI2oJPl
|
||||
5gs7wqh2UafJZwi2suwDvAECO00jdNooQnEq4BgPTk/h3IiCdZef5BGFALgNT0em
|
||||
Civ0+9d81AJTM8trbLoMefsUrEhMLF5Jp3udoyYhv8LhOQi09PaRfB0KhwIDAQAB
|
||||
AoGAfpxclcP8N3vteXErXURrd7pcXT0GECDgNjhvc9PV20RPXM+vYs1AA+fMeeQE
|
||||
TaRqwO6x016aMRO4rz5ztYArecTBznkds1k59pkN/Ne/nsueU4tvGK8MNyS2o986
|
||||
Voohqkaq4Lcy1bcHJb9su1ELjegEr1R76Mz452Hsy+uTbAECQQDcg/tZWKVeh5CQ
|
||||
dOEB3YWHwfn0NDgfPm/X2i2kAZ7n7URaUy/ffdlfsrr1mBtHCfedLoOxmmlNfEpM
|
||||
hXAAurSHAkEAwfk7fEb0iN0Sj9gTozO7c6Ky10KwePZyjVzqSQIiJq3NX8BEaIeb
|
||||
51TXxE5VxaLjjMLRkA0hWTYXClgERFZ6AQJAN7ChPqwzf08PRFwwIw911JY5cOHr
|
||||
NoDHMCUql5vNLNdwBruxgGjBB/kUXEfgw60RusFvgt/zLh1wiii844JDawJAGQBF
|
||||
sYP3urg7zzx7c3qUe5gJ0wLuefjR1PSX4ecbfb7DDMdcSdjIuG1QDiZGmd2f1KG7
|
||||
nwSCOtxk5dloW2KGAQJAQh/iBn0QhfKLFAP5eZBVk8E8XlZuw+S2DLy5SnBlIiYJ
|
||||
GB5I2OClgtudXMv1labFrcST8O9eFrtsrhU1iUGUOw==
|
||||
-----END RSA PRIVATE KEY-----
|
398
plugins/tests/check_http.t
Executable file
398
plugins/tests/check_http.t
Executable file
|
@ -0,0 +1,398 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Test check_http by having an actual HTTP server running
|
||||
#
|
||||
# To create the https server certificate:
|
||||
# openssl req -new -x509 -keyout server-key.pem -out server-cert.pem -days 3650 -nodes
|
||||
# Country Name (2 letter code) [AU]:UK
|
||||
# State or Province Name (full name) [Some-State]:Derbyshire
|
||||
# Locality Name (eg, city) []:Belper
|
||||
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Nagios Plugins
|
||||
# Organizational Unit Name (eg, section) []:
|
||||
# Common Name (eg, YOUR name) []:Ton Voon
|
||||
# Email Address []:tonvoon@mac.com
|
||||
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
use FindBin qw($Bin);
|
||||
|
||||
use HTTP::Daemon;
|
||||
use HTTP::Status;
|
||||
use HTTP::Response;
|
||||
|
||||
my $servers = { http => 0 }; # HTTP::Daemon should always be available
|
||||
eval { require HTTP::Daemon::SSL };
|
||||
if ($@) {
|
||||
diag "Cannot load HTTP::Daemon::SSL: $@";
|
||||
} else {
|
||||
$servers->{https} = 0;
|
||||
}
|
||||
|
||||
# set a fixed version, so the header size doesn't vary
|
||||
$HTTP::Daemon::VERSION = "1.00";
|
||||
|
||||
my $port_http = 50000 + int(rand(1000));
|
||||
my $port_https = $port_http + 1;
|
||||
my $port_https_expired = $port_http + 2;
|
||||
|
||||
# This array keeps sockets around for implementing timeouts
|
||||
my @persist;
|
||||
|
||||
# Start up all servers
|
||||
my @pids;
|
||||
my $pid = fork();
|
||||
if ($pid) {
|
||||
# Parent
|
||||
push @pids, $pid;
|
||||
if (exists $servers->{https}) {
|
||||
# Fork a normal HTTPS server
|
||||
$pid = fork();
|
||||
if ($pid) {
|
||||
# Parent
|
||||
push @pids, $pid;
|
||||
# Fork an expired cert server
|
||||
$pid = fork();
|
||||
if ($pid) {
|
||||
push @pids, $pid;
|
||||
} else {
|
||||
my $d = HTTP::Daemon::SSL->new(
|
||||
LocalPort => $port_https_expired,
|
||||
LocalAddr => "127.0.0.1",
|
||||
SSL_cert_file => "$Bin/certs/expired-cert.pem",
|
||||
SSL_key_file => "$Bin/certs/expired-key.pem",
|
||||
) || die;
|
||||
print "Please contact https expired at: <URL:", $d->url, ">\n";
|
||||
run_server( $d );
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
my $d = HTTP::Daemon::SSL->new(
|
||||
LocalPort => $port_https,
|
||||
LocalAddr => "127.0.0.1",
|
||||
SSL_cert_file => "$Bin/certs/server-cert.pem",
|
||||
SSL_key_file => "$Bin/certs/server-key.pem",
|
||||
) || die;
|
||||
print "Please contact https at: <URL:", $d->url, ">\n";
|
||||
run_server( $d );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
# give our webservers some time to startup
|
||||
sleep(1);
|
||||
} else {
|
||||
# Child
|
||||
#print "child\n";
|
||||
my $d = HTTP::Daemon->new(
|
||||
LocalPort => $port_http,
|
||||
LocalAddr => "127.0.0.1",
|
||||
) || die;
|
||||
print "Please contact http at: <URL:", $d->url, ">\n";
|
||||
run_server( $d );
|
||||
exit;
|
||||
}
|
||||
|
||||
# Run the same server on http and https
|
||||
sub run_server {
|
||||
my $d = shift;
|
||||
MAINLOOP: while (my $c = $d->accept ) {
|
||||
while (my $r = $c->get_request) {
|
||||
if ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) {
|
||||
$c->send_basic_header($1);
|
||||
$c->send_crlf;
|
||||
} elsif ($r->method eq "GET" and $r->url->path =~ m^/file/(.*)^) {
|
||||
$c->send_basic_header;
|
||||
$c->send_crlf;
|
||||
$c->send_file_response("$Bin/var/$1");
|
||||
} elsif ($r->method eq "GET" and $r->url->path eq "/slow") {
|
||||
$c->send_basic_header;
|
||||
$c->send_crlf;
|
||||
sleep 1;
|
||||
$c->send_response("slow");
|
||||
} elsif ($r->url->path eq "/method") {
|
||||
if ($r->method eq "DELETE") {
|
||||
$c->send_error(RC_METHOD_NOT_ALLOWED);
|
||||
} elsif ($r->method eq "foo") {
|
||||
$c->send_error(RC_NOT_IMPLEMENTED);
|
||||
} else {
|
||||
$c->send_status_line(200, $r->method);
|
||||
}
|
||||
} elsif ($r->url->path eq "/postdata") {
|
||||
$c->send_basic_header;
|
||||
$c->send_crlf;
|
||||
$c->send_response($r->method.":".$r->content);
|
||||
} elsif ($r->url->path eq "/redirect") {
|
||||
$c->send_redirect( "/redirect2" );
|
||||
} elsif ($r->url->path eq "/redir_external") {
|
||||
$c->send_redirect(($d->isa('HTTP::Daemon::SSL') ? "https" : "http") . "://169.254.169.254/redirect2" );
|
||||
} elsif ($r->url->path eq "/redirect2") {
|
||||
$c->send_basic_header;
|
||||
$c->send_crlf;
|
||||
$c->send_response(HTTP::Response->new( 200, 'OK', undef, 'redirected' ));
|
||||
} elsif ($r->url->path eq "/redir_timeout") {
|
||||
$c->send_redirect( "/timeout" );
|
||||
} elsif ($r->url->path eq "/timeout") {
|
||||
# Keep $c from being destroyed, but prevent severe leaks
|
||||
unshift @persist, $c;
|
||||
delete($persist[1000]);
|
||||
next MAINLOOP;
|
||||
} else {
|
||||
$c->send_error(RC_FORBIDDEN);
|
||||
}
|
||||
$c->close;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
foreach my $pid (@pids) {
|
||||
if ($pid) { print "Killing $pid\n"; kill "INT", $pid }
|
||||
}
|
||||
};
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "-d") {
|
||||
while (1) {
|
||||
sleep 100;
|
||||
}
|
||||
}
|
||||
|
||||
my $common_tests = 66;
|
||||
my $ssl_only_tests = 6;
|
||||
if (-x "./check_http") {
|
||||
plan tests => $common_tests * 2 + $ssl_only_tests;
|
||||
} else {
|
||||
plan skip_all => "No check_http compiled";
|
||||
}
|
||||
|
||||
my $result;
|
||||
my $command = "./check_http -H 127.0.0.1";
|
||||
|
||||
run_common_tests( { command => "$command -p $port_http" } );
|
||||
SKIP: {
|
||||
skip "HTTP::Daemon::SSL not installed", $common_tests + $ssl_only_tests if ! exists $servers->{https};
|
||||
run_common_tests( { command => "$command -p $port_https", ssl => 1 } );
|
||||
|
||||
$result = NPTest->testCmd( "$command -p $port_https -S -C 14" );
|
||||
is( $result->return_code, 0, "$command -p $port_https -S -C 14" );
|
||||
is( $result->output, 'OK - Certificate will expire on 03/03/2019 21:41.', "output ok" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -p $port_https -S -C 14000" );
|
||||
is( $result->return_code, 1, "$command -p $port_https -S -C 14000" );
|
||||
like( $result->output, '/WARNING - Certificate expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
|
||||
|
||||
# Expired cert tests
|
||||
$result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" );
|
||||
is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" );
|
||||
is( $result->output,
|
||||
'CRITICAL - Certificate expired on 03/05/2009 00:13.',
|
||||
"output ok" );
|
||||
|
||||
}
|
||||
|
||||
sub run_common_tests {
|
||||
my ($opts) = @_;
|
||||
my $command = $opts->{command};
|
||||
if ($opts->{ssl}) {
|
||||
$command .= " --ssl";
|
||||
}
|
||||
|
||||
$result = NPTest->testCmd( "$command -u /file/root" );
|
||||
is( $result->return_code, 0, "/file/root");
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 274 bytes in [\d\.]+ second/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u /file/root -s Root" );
|
||||
is( $result->return_code, 0, "/file/root search for string");
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 274 bytes in [\d\.]+ second/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u /file/root -s NonRoot" );
|
||||
is( $result->return_code, 2, "Missing string check");
|
||||
like( $result->output, qr%^HTTP CRITICAL: HTTP/1\.1 200 OK - string 'NonRoot' not found on 'https?://127\.0\.0\.1:\d+/file/root'%, "Shows search string and location");
|
||||
|
||||
$result = NPTest->testCmd( "$command -u /file/root -s NonRootWithOver30charsAndMoreFunThanAWetFish" );
|
||||
is( $result->return_code, 2, "Missing string check");
|
||||
like( $result->output, qr%HTTP CRITICAL: HTTP/1\.1 200 OK - string 'NonRootWithOver30charsAndM...' not found on 'https?://127\.0\.0\.1:\d+/file/root'%, "Shows search string and location");
|
||||
|
||||
|
||||
my $cmd;
|
||||
$cmd = "$command -u /slow";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, "$cmd");
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
$result->output =~ /in ([\d\.]+) second/;
|
||||
cmp_ok( $1, ">", 1, "Time is > 1 second" );
|
||||
|
||||
$cmd = "$command -u /statuscode/200";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/200 -e 200";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: Status line output matched "200" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/201";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 201 Created - \d+ bytes in [\d\.]+ second /', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/201 -e 201";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: Status line output matched "201" - \d+ bytes in [\d\.]+ second /', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/201 -e 200";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 2, $cmd);
|
||||
like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port \d+: HTTP/1.1 201 Created/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/200 -e 200,201,202";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: Status line output matched "200,201,202" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/201 -e 200,201,202";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: Status line output matched "200,201,202" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /statuscode/203 -e 200,201,202";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 2, $cmd);
|
||||
like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port (\d+): HTTP/1.1 203 Non-Authoritative Information/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j HEAD -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 HEAD - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j POST -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 POST - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j GET -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 GET - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 GET - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -P foo -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 POST - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j DELETE -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 1, $cmd);
|
||||
like( $result->output, '/^HTTP WARNING: HTTP/1.1 405 Method Not Allowed/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j foo -u /method";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 2, $cmd);
|
||||
like( $result->output, '/^HTTP CRITICAL: HTTP/1.1 501 Not Implemented/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -P stufftoinclude -u /postdata -s POST:stufftoinclude";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -j PUT -P stufftoinclude -u /postdata -s PUT:stufftoinclude";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
# To confirm that the free doesn't segfault
|
||||
$cmd = "$command -P stufftoinclude -j PUT -u /postdata -s PUT:stufftoinclude";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /redirect";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 301 Moved Permanently - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -f follow -u /redirect";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -u /redirect -k 'follow: me'";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 301 Moved Permanently - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -f follow -u /redirect -k 'follow: me'";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -f sticky -u /redirect -k 'follow: me'";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
$cmd = "$command -f stickyport -u /redirect -k 'follow: me'";
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
is( $result->return_code, 0, $cmd);
|
||||
like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output );
|
||||
|
||||
# These tests may block
|
||||
print "ALRM\n";
|
||||
|
||||
# stickyport - on full urlS port is set back to 80 otherwise
|
||||
$cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
isnt( $@, "alarm\n", $cmd );
|
||||
is( $result->return_code, 0, $cmd );
|
||||
|
||||
# Let's hope there won't be any web server on :80 returning "redirected"!
|
||||
$cmd = "$command -f sticky -u /redir_external -t 5 -s redirected";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
isnt( $@, "alarm\n", $cmd );
|
||||
isnt( $result->return_code, 0, $cmd );
|
||||
|
||||
# Test an external address - timeout
|
||||
SKIP: {
|
||||
skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL});
|
||||
$cmd = "$command -f follow -u /redir_external -t 5";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
is( $@, "alarm\n", $cmd );
|
||||
}
|
||||
|
||||
$cmd = "$command -u /timeout -t 5";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
is( $@, "alarm\n", $cmd );
|
||||
|
||||
$cmd = "$command -f follow -u /redir_timeout -t 2";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(5);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
isnt( $@, "alarm\n", $cmd );
|
||||
|
||||
}
|
||||
|
80
plugins/tests/check_nt.t
Executable file
80
plugins/tests/check_nt.t
Executable file
|
@ -0,0 +1,80 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Test check_nt by having a stub check_nt daemon
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
use FindBin qw($Bin);
|
||||
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use POSIX;
|
||||
|
||||
my $port = 50000 + int(rand(1000));
|
||||
|
||||
my $pid = fork();
|
||||
if ($pid) {
|
||||
# Parent
|
||||
#print "parent\n";
|
||||
# give our webserver some time to startup
|
||||
sleep(1);
|
||||
} else {
|
||||
# Child
|
||||
#print "child\n";
|
||||
|
||||
my $server = IO::Socket::INET->new(
|
||||
LocalPort => $port,
|
||||
Type => SOCK_STREAM,
|
||||
Reuse => 1,
|
||||
Proto => "tcp",
|
||||
Listen => 10,
|
||||
) or die "Cannot be a tcp server on port $port: $@";
|
||||
|
||||
$server->autoflush(1);
|
||||
|
||||
print "Please contact me at port $port\n";
|
||||
while (my $client = $server->accept ) {
|
||||
my $data = "";
|
||||
my $rv = $client->recv($data, POSIX::BUFSIZ, 0);
|
||||
|
||||
my ($password, $command, $arg) = split('&', $data);
|
||||
|
||||
if ($command eq "4") {
|
||||
if ($arg eq "c") {
|
||||
print $client "930000000&1000000000";
|
||||
} elsif ($arg eq "d") {
|
||||
print $client "UNKNOWN: Drive is not a fixed drive";
|
||||
}
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
END { if ($pid) { print "Killing $pid\n"; kill "INT", $pid } };
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "-d") {
|
||||
sleep 1000;
|
||||
}
|
||||
|
||||
if (-x "./check_nt") {
|
||||
plan tests => 5;
|
||||
} else {
|
||||
plan skip_all => "No check_nt compiled";
|
||||
}
|
||||
|
||||
my $result;
|
||||
my $command = "./check_nt -H 127.0.0.1 -p $port";
|
||||
|
||||
$result = NPTest->testCmd( "$command -v USEDDISKSPACE -l c" );
|
||||
is( $result->return_code, 0, "USEDDISKSPACE c");
|
||||
is( $result->output, q{c:\ - total: 0.93 Gb - used: 0.07 Gb (7%) - free 0.87 Gb (93%) | 'c:\ Used Space'=0.07Gb;0.00;0.00;0.00;0.93}, "Output right" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -v USEDDISKSPACE -l d" );
|
||||
is( $result->return_code, 3, "USEDDISKSPACE d - invalid");
|
||||
is( $result->output, "Free disk space : Invalid drive", "Output right" );
|
||||
|
||||
$result = NPTest->testCmd( "./check_nt -v USEDDISKSPACE -l d" );
|
||||
is( $result->return_code, 3, "Fail if -H missing");
|
||||
|
115
plugins/tests/check_procs.t
Normal file
115
plugins/tests/check_procs.t
Normal file
|
@ -0,0 +1,115 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Test check_procs using input files
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
if (-x "./check_procs") {
|
||||
plan tests => 48;
|
||||
} else {
|
||||
plan skip_all => "No check_procs compiled";
|
||||
}
|
||||
|
||||
my $result;
|
||||
my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin";
|
||||
|
||||
$result = NPTest->testCmd( "$command" );
|
||||
is( $result->return_code, 0, "Run with no options" );
|
||||
like( $result->output, '/^PROCS OK: 95 processes$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 5" );
|
||||
is( $result->return_code, 1, "Checking > 5 processes" );
|
||||
like( $result->output, '/^PROCS WARNING: 95 processes$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 4 -c 44" );
|
||||
is( $result->return_code, 2, "Checking critical" );
|
||||
like( $result->output, '/^PROCS CRITICAL: 95 processes$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 100 -c 200" );
|
||||
is( $result->return_code, 0, "Checking no threshold breeched" );
|
||||
like( $result->output, '/^PROCS OK: 95 processes$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -C launchd -c 5" );
|
||||
is( $result->return_code, 2, "Checking processes filtered by command name" );
|
||||
like( $result->output, '/^PROCS CRITICAL: 6 processes with command name \'launchd\'$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u 501 -w 39 -c 41" );
|
||||
is( $result->return_code, 1, "Checking processes filtered by userid" );
|
||||
like( $result->output, '/^PROCS WARNING: 40 processes with UID = 501 (.*)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -C launchd -u 501" );
|
||||
is( $result->return_code, 0, "Checking processes filtered by command name and userid" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 2:2" );
|
||||
is( $result->return_code, 1, "Checking processes with userid=-2" );
|
||||
like( $result->output, '/^PROCS WARNING: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 3:3" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 past threshold" );
|
||||
like( $result->output, '/^PROCS OK: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a usb" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 and usb in arguments" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with UID = -2 \(nobody\), args \'usb\'/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a UsB" );
|
||||
is( $result->return_code, 0, "Checking case sensitivity of args" );
|
||||
like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" );
|
||||
is( $result->return_code, 0, "Checking regexp search of arguments" );
|
||||
is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501'", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --vsz 1000000" );
|
||||
is( $result->return_code, 0, "Checking filter by VSZ" );
|
||||
like( $result->output, '/^PROCS OK: 24 processes with VSZ >= 1000000$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --rss 100000" );
|
||||
is( $result->return_code, 0, "Checking filter by RSS" );
|
||||
like( $result->output, '/^PROCS OK: 3 processes with RSS >= 100000$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -s S" );
|
||||
is( $result->return_code, 0, "Checking filter for sleeping processes" );
|
||||
like( $result->output, '/^PROCS OK: 44 processes with STATE = S/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -s Z" );
|
||||
is( $result->return_code, 0, "Checking filter for zombies" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with STATE = Z/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -p 1 -c 30" );
|
||||
is( $result->return_code, 2, "Checking filter for parent id = 1" );
|
||||
like( $result->output, '/^PROCS CRITICAL: 39 processes with PPID = 1/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -P 0.71" );
|
||||
is( $result->return_code, 0, "Checking filter for percentage cpu > 0.71" );
|
||||
is( $result->output, 'PROCS OK: 7 processes with PCPU >= 0.71', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -P 0.70" );
|
||||
is( $result->return_code, 0, "Checking filter for percentage cpu > 0.70" );
|
||||
is( $result->output, 'PROCS OK: 8 processes with PCPU >= 0.70', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=CPU -w 8" );
|
||||
is( $result->return_code, 1, "Checking against metric of CPU > 8" );
|
||||
is( $result->output, 'CPU WARNING: 1 warn out of 95 processes', "Output correct" );
|
||||
|
||||
# TODO: Because of a conversion to int, if CPU is 1.45%, will not alert, but 2.01% will.
|
||||
$result = NPTest->testCmd( "$command --metric=CPU -w 1 -u 501 -v" );
|
||||
is( $result->return_code, 1, "Checking against metric of CPU > 1 with uid=501 - TODO" );
|
||||
is( $result->output, 'CPU WARNING: 2 warn out of 40 processes with UID = 501 (tonvoon) [Skype, PubSubAgent]', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" );
|
||||
is( $result->return_code, 1, "Checking against VSZ > 1.2GB" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype]', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" );
|
||||
is( $result->return_code, 1, "Checking against VSZ > 1.2GB" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype]', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=RSS -c 70000 -v" );
|
||||
is( $result->return_code, 2, "Checking against RSS > 70MB" );
|
||||
is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari]', "Output correct" );
|
||||
|
174
plugins/tests/check_snmp.t
Executable file
174
plugins/tests/check_snmp.t
Executable file
|
@ -0,0 +1,174 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Test check_snmp by having an actual SNMP agent running
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
use FindBin qw($Bin);
|
||||
|
||||
# Check that all dependent modules are available
|
||||
eval {
|
||||
require NetSNMP::OID;
|
||||
require NetSNMP::agent;
|
||||
require NetSNMP::ASN;
|
||||
};
|
||||
|
||||
if ($@) {
|
||||
plan skip_all => "Missing required module for test: $@";
|
||||
}
|
||||
|
||||
my $port_snmp = 16100 + int(rand(100));
|
||||
|
||||
|
||||
# Start up server
|
||||
my @pids;
|
||||
my $pid = fork();
|
||||
if ($pid) {
|
||||
# Parent
|
||||
push @pids, $pid;
|
||||
# give our agent some time to startup
|
||||
sleep(1);
|
||||
} else {
|
||||
# Child
|
||||
#print "child\n";
|
||||
|
||||
print "Please contact SNMP at: $port_snmp\n";
|
||||
close(STDERR); # Coment out to debug snmpd problems (most errors sent there are OK)
|
||||
exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp");
|
||||
}
|
||||
|
||||
END {
|
||||
foreach my $pid (@pids) {
|
||||
if ($pid) { print "Killing $pid\n"; kill "INT", $pid }
|
||||
}
|
||||
};
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "-d") {
|
||||
while (1) {
|
||||
sleep 100;
|
||||
}
|
||||
}
|
||||
|
||||
my $tests = 33;
|
||||
if (-x "./check_snmp") {
|
||||
plan tests => $tests;
|
||||
} else {
|
||||
plan skip_all => "No check_snmp compiled";
|
||||
}
|
||||
|
||||
my $res;
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying a multi-line string" );
|
||||
like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - Cisco Internetwork Operating System Software |
|
||||
.1.3.6.1.4.1.8072.3.2.67.0:
|
||||
"Cisco Internetwork Operating System Software
|
||||
IOS (tm) Catalyst 4000 \"L3\" Switch Software (cat4000-I9K91S-M), Version
|
||||
12.2(20)EWA, RELEASE SOFTWARE (fc1)
|
||||
Technical Support: http://www.cisco.com/techsupport
|
||||
Copyright (c) 1986-2004 by cisco Systems, Inc.
|
||||
"').'/m', "String contains all lines");
|
||||
|
||||
# sysContact.0 is "Alice" (from our snmpd.conf)
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0 -o sysContact.0 -o .1.3.6.1.4.1.8072.3.2.67.1");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying multi-line OIDs" );
|
||||
like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - Cisco Internetwork Operating System Software Alice Kisco Outernetwork Oserating Gystem Totware |
|
||||
.1.3.6.1.4.1.8072.3.2.67.0:
|
||||
"Cisco Internetwork Operating System Software
|
||||
IOS (tm) Catalyst 4000 \"L3\" Switch Software (cat4000-I9K91S-M), Version
|
||||
12.2(20)EWA, RELEASE SOFTWARE (fc1)
|
||||
Technical Support: http://www.cisco.com/techsupport
|
||||
Copyright (c) 1986-2004 by cisco Systems, Inc.
|
||||
"
|
||||
.1.3.6.1.4.1.8072.3.2.67.1:
|
||||
"Kisco Outernetwork Oserating Gystem Totware
|
||||
Copyleft (c) 2400-2689 by kisco Systrems, Inc."').'/m', "String contains all lines with multiple OIDs");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.2");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - This should not confuse check_snmp \"parser\" |
|
||||
.1.3.6.1.4.1.8072.3.2.67.2:
|
||||
"This should not confuse check_snmp \"parser\"
|
||||
into thinking there is no 2nd line"').'/m', "Attempt to confuse parser No.1");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.3");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - It\'s getting even harder if the line |
|
||||
.1.3.6.1.4.1.8072.3.2.67.3:
|
||||
"It\'s getting even harder if the line
|
||||
ends with with this: C:\\\\"').'/m', "Attempt to confuse parser No.2");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.4");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - And now have fun with with this: \"C:\\\\\" |
|
||||
.1.3.6.1.4.1.8072.3.2.67.4:
|
||||
"And now have fun with with this: \"C:\\\\\"
|
||||
because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3");
|
||||
|
||||
system("rm /usr/local/nagios/var/check_snmp/*");
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
|
||||
is($res->return_code, 0, "Returns OK");
|
||||
is($res->output, "No previous data to calculate rate - assume okay");
|
||||
|
||||
# Need to sleep, otherwise duration=0
|
||||
sleep 1;
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
|
||||
is($res->return_code, 1, "WARNING - due to going above rate calculation" );
|
||||
is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10=666 ");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
|
||||
is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" );
|
||||
is($res->output, "Time duration between plugin calls is invalid");
|
||||
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" );
|
||||
is($res->return_code, 0, "OK for first call" );
|
||||
is($res->output, "No previous data to calculate rate - assume okay" );
|
||||
|
||||
# Need to sleep, otherwise duration=0
|
||||
sleep 1;
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" );
|
||||
is($res->return_code, 0, "OK as no thresholds" );
|
||||
is($res->output, "SNMP RATE OK - inoctets 666 | inoctets=666 ", "Check label");
|
||||
|
||||
sleep 2;
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" );
|
||||
is($res->return_code, 0, "OK as no thresholds" );
|
||||
is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval");
|
||||
|
||||
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" );
|
||||
is($res->return_code, 0, "OK for first call" );
|
||||
is($res->output, "No previous data to calculate rate - assume okay" );
|
||||
|
||||
# Need to sleep, otherwise duration=0
|
||||
sleep 1;
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" );
|
||||
is($res->return_code, 0, "OK as no thresholds" );
|
||||
is($res->output, "SNMP RATE OK - inoctets_per_minute 39960 | inoctets_per_minute=39960 ", "Checking multiplier");
|
||||
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 -s '\"stringtests\"'" );
|
||||
is($res->return_code, 0, "OK as string matches" );
|
||||
is($res->output, 'SNMP OK - "stringtests" | ', "Good string match" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 -s ring" );
|
||||
is($res->return_code, 2, "CRITICAL as string doesn't match (though is a substring)" );
|
||||
is($res->output, 'SNMP CRITICAL - *"stringtests"* | ', "Failed string match" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 --invert-search -s '\"stringtests\"'" );
|
||||
is($res->return_code, 2, "CRITICAL as string matches but inverted" );
|
||||
is($res->output, 'SNMP CRITICAL - *"stringtests"* | ', "Inverted string match" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 --invert-search -s ring" );
|
||||
is($res->return_code, 0, "OK as string doesn't match but inverted" );
|
||||
is($res->output, 'SNMP OK - "stringtests" | ', "OK as inverted string no match" );
|
||||
|
||||
|
||||
|
110
plugins/tests/check_snmp_agent.pl
Normal file
110
plugins/tests/check_snmp_agent.pl
Normal file
|
@ -0,0 +1,110 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Subagent for testing check_snmp
|
||||
#
|
||||
|
||||
#use strict; # Doesn't work
|
||||
use NetSNMP::OID qw(:all);
|
||||
use NetSNMP::agent;
|
||||
use NetSNMP::ASN qw(ASN_OCTET_STR ASN_COUNTER ASN_COUNTER64 ASN_INTEGER ASN_INTEGER64 ASN_UNSIGNED ASN_UNSIGNED64);
|
||||
#use Math::Int64 qw(uint64); # Skip that module whie we don't need it
|
||||
sub uint64 { return $_ }
|
||||
|
||||
if (!$agent) {
|
||||
print "This program must run as an embedded NetSNMP agent\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $baseoid = '.1.3.6.1.4.1.8072.3.2.67';
|
||||
# Next are arrays of indexes (Type, initial value and increments)
|
||||
# Undef miltipliers are randomized
|
||||
my $multiline = 'Cisco Internetwork Operating System Software
|
||||
IOS (tm) Catalyst 4000 "L3" Switch Software (cat4000-I9K91S-M), Version
|
||||
12.2(20)EWA, RELEASE SOFTWARE (fc1)
|
||||
Technical Support: http://www.cisco.com/techsupport
|
||||
Copyright (c) 1986-2004 by cisco Systems, Inc.
|
||||
';
|
||||
my $multilin2 = "Kisco Outernetwork Oserating Gystem Totware
|
||||
Copyleft (c) 2400-2689 by kisco Systrems, Inc.";
|
||||
my $multilin3 = 'This should not confuse check_snmp "parser"
|
||||
into thinking there is no 2nd line';
|
||||
my $multilin4 = 'It\'s getting even harder if the line
|
||||
ends with with this: C:\\';
|
||||
my $multilin5 = 'And now have fun with with this: "C:\\"
|
||||
because we\'re not done yet!';
|
||||
|
||||
my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR);
|
||||
my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests");
|
||||
my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef);
|
||||
|
||||
# Number of elements in our OID
|
||||
my $oidelts;
|
||||
{
|
||||
my @oid = split(/\./, $baseoid);
|
||||
$oidelts = scalar(@oid);
|
||||
}
|
||||
|
||||
my $regoid = new NetSNMP::OID($baseoid);
|
||||
$agent->register('check_snmp_agent', $regoid, \&my_snmp_handler);
|
||||
|
||||
sub my_snmp_handler {
|
||||
my ($handler, $registration_info, $request_info, $requests) = @_;
|
||||
|
||||
for (my $request = $requests; $request; $request = $request->next) {
|
||||
my $oid = $request->getOID();
|
||||
my $index;
|
||||
my $next_index;
|
||||
|
||||
# Validate the OID
|
||||
my @numarray = $oid->to_array();
|
||||
if (@numarray != $oidelts) {
|
||||
if ($request_info->getMode() == MODE_GETNEXT && @numarray == ($oidelts - 1)) {
|
||||
# GETNEXT for the base oid; set it to the first index
|
||||
push(@numarray, 0);
|
||||
$next_index = 0;
|
||||
} else {
|
||||
# We got a request for the base OID or with extra elements
|
||||
$request->setError($request_info, SNMP_ERR_NOERROR);
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
$index = pop(@numarray);
|
||||
if ($index >= scalar(@fields)) {
|
||||
# Index is out of bounds
|
||||
$request->setError($request_info, SNMP_ERR_NOERROR);
|
||||
next;
|
||||
}
|
||||
|
||||
# Handle the request
|
||||
if ($request_info->getMode() == MODE_GETNEXT) {
|
||||
if (++$index >= scalar(@fields)) {
|
||||
# Index will grow out of bounds
|
||||
$request->setError($request_info, SNMP_ERR_NOERROR);
|
||||
next;
|
||||
}
|
||||
$index = (defined($next_index) ? $next_index : $index);
|
||||
$request->setOID("$baseoid.$index");
|
||||
} elsif ($request_info->getMode() != MODE_GET) {
|
||||
# Everything else is write-related modes
|
||||
$request->setError($request_info, SNMP_ERR_READONLY);
|
||||
next;
|
||||
}
|
||||
|
||||
# Set the response... setValue is a bit touchy about the data type, but accepts plain strings.
|
||||
my $value = sprintf("%s", $values[$index]);
|
||||
$request->setValue($fields[$index], $value);
|
||||
|
||||
# And update the value
|
||||
if (defined($incrts[$index])) {
|
||||
$values[$index] += $incrts[$index];
|
||||
} elsif ($fields[$index] != ASN_OCTET_STR) {
|
||||
my $minus = int(rand(2))*-1;
|
||||
$minus = 1 unless ($minus);
|
||||
my $exp = 32;
|
||||
$exp = 64 if ($fields[$index] == ASN_COUNTER64 || $fields[$index] == ASN_INTEGER64 || $fields[$index] == ASN_UNSIGNED64);
|
||||
$values[$index] = int(rand(2**$exp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
23
plugins/tests/conf/snmpd.conf
Normal file
23
plugins/tests/conf/snmpd.conf
Normal file
|
@ -0,0 +1,23 @@
|
|||
###############################################################################
|
||||
# Access Control
|
||||
###############################################################################
|
||||
|
||||
com2sec readonly localhost public
|
||||
|
||||
group MyROGroup v1 readonly
|
||||
group MyROGroup v2c readonly
|
||||
|
||||
view all included .1 80
|
||||
|
||||
access MyROGroup "" any noauth exact all none none
|
||||
|
||||
syslocation Wonderland
|
||||
syscontact Alice
|
||||
|
||||
|
||||
###############################################################################
|
||||
# Embedded Subagents
|
||||
###############################################################################
|
||||
|
||||
perl do "tests/check_snmp_agent.pl";
|
||||
|
96
plugins/tests/var/ps-axwo.darwin
Normal file
96
plugins/tests/var/ps-axwo.darwin
Normal file
|
@ -0,0 +1,96 @@
|
|||
STAT UID PID PPID VSZ RSS %CPU UCOMM COMMAND
|
||||
Ss 0 1 0 603456 976 0.0 launchd /sbin/launchd
|
||||
Ss 0 10 1 612820 3608 0.0 kextd /usr/libexec/kextd
|
||||
Ss 0 11 1 632980 8680 0.0 DirectoryService /usr/sbin/DirectoryService
|
||||
Ss 0 12 1 602832 720 0.0 notifyd /usr/sbin/notifyd
|
||||
Ss 0 13 1 603916 1136 0.0 syslogd /usr/sbin/syslogd
|
||||
Ss 0 14 1 614928 4928 0.0 configd /usr/sbin/configd
|
||||
Ss 65 15 1 615496 5616 0.0 mDNSResponder /usr/sbin/mDNSResponder -launchd
|
||||
Ss 1 16 1 608960 2212 0.0 distnoted /usr/sbin/distnoted
|
||||
Ss 65 18 1 602432 504 0.0 launchd /sbin/launchd
|
||||
Ss 0 20 1 614836 5844 0.3 securityd /usr/sbin/securityd -i
|
||||
Ss 0 24 1 610536 2704 0.0 ntpd /usr/sbin/ntpd -n -g -p /var/run/ntpd.pid -f /var/db/ntp.drift
|
||||
Ss 0 25 1 602228 496 0.0 update /usr/sbin/update
|
||||
Ss 0 26 1 609900 2320 0.0 SystemStarter /sbin/SystemStarter
|
||||
Ss 0 30 1 834352 36264 0.3 mds /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds
|
||||
Ss 501 31 1 1110572 23948 0.0 loginwindow /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow console
|
||||
Ss 0 32 1 609448 2616 0.0 KernelEventAgent /usr/sbin/KernelEventAgent
|
||||
Ss 0 34 1 609892 2204 0.0 hidd /usr/libexec/hidd
|
||||
Ss 0 35 1 624704 4284 0.0 fseventsd /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Support/fseventsd
|
||||
Ss 0 36 1 610256 2876 0.0 dynamic_pager /sbin/dynamic_pager -F /private/var/vm/swapfile
|
||||
Ss 0 39 1 613408 4140 0.0 diskarbitrationd /usr/sbin/diskarbitrationd
|
||||
Ss 0 43 1 665708 8024 0.0 blued /usr/sbin/blued
|
||||
Ss 0 44 1 609408 2828 0.0 autofsd autofsd
|
||||
Ss 0 45 1 654084 9600 0.0 socketfilterfw /usr/libexec/ApplicationFirewall/socketfilterfw
|
||||
Ss 0 46 1 704764 12788 0.0 ccc_helper /Applications/Carbon Copy Cloner.app/Contents/Resources/ccc_helper.app/Contents/MacOS/ccc_helper 3231BC22-F30F-45D8-BDE8-47A098D57ABD
|
||||
Ss 0 54 1 667956 19212 0.0 coreservicesd /System/Library/CoreServices/coreservicesd
|
||||
Ss 88 56 1 1205840 85700 1.6 WindowServer /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Resources/WindowServer -daemon
|
||||
Ss 0 67 1 602992 612 0.0 llipd /Library/StartupItems/ParallelsTransporter/llipd
|
||||
S 0 83 1 613352 2312 0.0 pvsnatd /Library/StartupItems/Parallels/pvsnatd
|
||||
Ss 0 94 1 712036 15056 0.0 coreaudiod /usr/sbin/coreaudiod
|
||||
Ss 501 102 1 602432 1040 0.0 launchd /sbin/launchd
|
||||
S 501 109 102 1176668 28068 0.0 Spotlight /System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight
|
||||
S 501 110 102 941796 10988 0.0 UserEventAgent /usr/sbin/UserEventAgent -l Aqua
|
||||
S 501 112 102 610028 2056 0.0 pboard /usr/sbin/pboard
|
||||
S 501 114 102 1090056 29196 1.3 Dock /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock -psn_0_24582
|
||||
S 501 115 102 685360 14048 0.0 ATSServer /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/ATSServer
|
||||
S 501 117 102 1121904 94432 0.1 SystemUIServer /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/SystemUIServer -psn_0_32776
|
||||
S 501 118 102 1110388 42064 1.4 Finder /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_36873
|
||||
S 501 123 102 718264 34752 0.0 FileSyncAgent /System/Library/CoreServices/FileSyncAgent.app/Contents/MacOS/FileSyncAgent -launchedByLaunchd
|
||||
S 501 127 102 1048388 25344 0.0 smcFanControl /Applications/smcFanControl.app/Contents/MacOS/smcFanControl -psn_0_53261
|
||||
S 501 128 102 970912 12924 0.0 iTunesHelper /Applications/iTunes.app/Contents/Resources/iTunesHelper.app/Contents/MacOS/iTunesHelper -psn_0_57358
|
||||
S 501 129 102 1095920 23364 1.4 Activity Monitor /Applications/Utilities/Activity Monitor.app/Contents/MacOS/Activity Monitor -psn_0_61455
|
||||
S 501 132 102 657212 8356 0.0 dmnotifyd /System/Library/PrivateFrameworks/DMNotification.framework/Versions/Current/Resources/dmnotifyd
|
||||
Ss -2 133 1 610464 2328 0.0 usbmuxd /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/usbmuxd -launchd
|
||||
Ss 0 136 129 637456 6340 10.6 pmTool /Applications/Utilities/Activity Monitor.app/Contents/Resources/pmTool
|
||||
Ss 501 142 1 676652 8984 0.1 diskimages-helpe /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid F2225770-5EFF-467C-91FD-C990F056B22F -post-exec
|
||||
Ss 0 147 1 627640 5928 0.0 hdiejectd /System/Library/PrivateFrameworks/DiskImages.framework/Resources/hdiejectd
|
||||
S 501 157 102 1045492 27480 0.0 GrowlHelperApp /Library/PreferencePanes/Growl.prefPane/Contents/Resources/GrowlHelperApp.app/Contents/MacOS/GrowlHelperApp -psn_0_81940
|
||||
U 501 158 102 1878012 388136 0.7 Safari /Applications/Safari.app/Contents/MacOS/Safari -psn_0_86037
|
||||
S 501 172 102 645560 11344 0.0 AppleSpell /System/Library/Services/AppleSpell.service/Contents/MacOS/AppleSpell -psn_0_98328
|
||||
S 501 175 102 1055412 33396 0.0 Terminal /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -psn_0_102425
|
||||
Z 501 186 158 0 0 0.0 Meeting Manager (Meeting Manager)
|
||||
S 501 214 102 616988 3808 0.0 ssh-agent /usr/bin/ssh-agent -l
|
||||
Ss 502 217 1 602432 1016 0.0 launchd /sbin/launchd
|
||||
S 501 499 102 1313808 130396 0.3 Mail /Applications/Mail.app/Contents/MacOS/Mail -psn_0_180268
|
||||
S 501 502 102 1091652 52168 0.0 NetNewsWire Lite /Applications/NetNewsWire Lite.app/Contents/MacOS/NetNewsWire Lite -psn_0_184365
|
||||
Ss 502 572 56 818908 20988 0.0 loginwindow /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow
|
||||
S 502 585 217 741824 19056 0.0 Spotlight /System/Library/CoreServices/Spotlight.app/Contents/MacOS/Spotlight
|
||||
S 502 586 217 941900 11044 0.0 UserEventAgent /usr/sbin/UserEventAgent -l Aqua
|
||||
S 502 588 217 757320 18080 0.0 Dock /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock -psn_0_237626
|
||||
S 502 590 217 610072 2068 0.0 pboard /usr/sbin/pboard
|
||||
S 502 592 217 794140 25456 0.0 SystemUIServer /System/Library/CoreServices/SystemUIServer.app/Contents/MacOS/SystemUIServer -psn_0_245820
|
||||
S 502 593 217 845552 30596 0.0 Finder /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder -psn_0_249917
|
||||
S 502 594 217 671780 7872 0.0 ATSServer /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Support/ATSServer
|
||||
U 502 605 217 938844 64964 0.0 Pages /Applications/iWork '08/Pages.app/Contents/MacOS/Pages -psn_0_266305
|
||||
S 502 609 217 644432 10828 0.0 AppleSpell /System/Library/Services/AppleSpell.service/Contents/MacOS/AppleSpell -psn_0_270402
|
||||
S 502 610 217 638552 5216 0.0 AppleSpell /System/Library/Services/AppleSpell.service/Contents/MacOS/AppleSpell -psn_0_274499
|
||||
U 502 710 217 1029148 223312 0.0 Safari /Applications/Safari.app/Contents/MacOS/Safari -psn_0_331857
|
||||
S 502 712 217 904056 62928 0.3 Mail /Applications/Mail.app/Contents/MacOS/Mail -psn_0_335954
|
||||
U 501 998 102 1068272 26532 0.0 Address Book /Applications/Address Book.app/Contents/MacOS/Address Book -psn_0_417894
|
||||
S 502 2228 217 820940 30600 0.0 TextEdit /Applications/TextEdit.app/Contents/MacOS/TextEdit -psn_0_729266
|
||||
S 501 2431 102 1067868 43492 0.0 iCal /Applications/iCal.app/Contents/MacOS/iCal -psn_0_803012
|
||||
S 501 2531 102 1250108 68792 2.4 Skype /Applications/Skype.app/Contents/MacOS/Skype -psn_0_823497
|
||||
Ss 92 3143 1 602432 828 0.0 launchd /sbin/launchd
|
||||
S 501 3491 102 1048620 31256 0.0 TextEdit /Applications/TextEdit.app/Contents/MacOS/TextEdit -psn_0_962795
|
||||
S 501 3536 102 1073340 30524 0.0 Preview /Applications/Preview.app/Contents/MacOS/Preview -psn_0_983280
|
||||
S 501 4045 102 1041544 29168 0.0 PasswordWallet /Applications/PasswordWallet.app/Contents/MacOS/PasswordWallet -psn_0_1138966
|
||||
S 501 4892 114 1064948 43488 0.0 DashboardClient /System/Library/CoreServices/Dock.app/Contents/Resources/DashboardClient.app/Contents/MacOS/DashboardClient
|
||||
S 501 6806 102 1163836 67356 0.0 Colloquy /Applications/Colloquy.app/Contents/MacOS/Colloquy -psn_0_2220574
|
||||
U 501 6969 102 1156804 58764 0.0 Adium /Applications/Adium.app/Contents/MacOS/Adium -psn_0_2294320
|
||||
S 501 7530 102 671612 17440 0.0 helpdatad /System/Library/PrivateFrameworks/HelpData.framework/Versions/A/Resources/helpdatad
|
||||
Ss -2 38255 1 602432 952 0.0 launchd /sbin/launchd
|
||||
S 501 40569 102 1160664 49484 0.0 Dictionary /Applications/Dictionary.app/Contents/MacOS/Dictionary -psn_0_4387887
|
||||
SNs 501 42683 1 744096 21084 0.0 mdworker /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.501
|
||||
S 501 62225 102 711004 18040 0.0 SyncServer /System/Library/Frameworks/SyncServices.framework/Versions/Current/Resources/SyncServer.app/Contents/MacOS/SyncServer
|
||||
SNs -2 62284 1 671812 10880 0.0 mdworker /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.-2
|
||||
Ss 0 62285 1 617056 5472 0.0 cupsd /usr/sbin/cupsd -l
|
||||
S 502 62287 217 632360 10044 0.0 PubSubAgent /System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app/Contents/MacOS/PubSubAgent
|
||||
SNs 502 62288 1 668876 10440 0.0 mdworker /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Versions/A/Support/mdworker MDSImporterWorker com.apple.Spotlight.ImporterWorker.502
|
||||
S 501 62296 102 643688 11980 2.2 PubSubAgent /System/Library/Frameworks/PubSub.framework/Versions/A/Resources/PubSubAgent.app/Contents/MacOS/PubSubAgent
|
||||
Ss 0 4558 175 630816 6960 0.0 login login -pf tonvoon
|
||||
S 501 4559 4558 603600 1736 0.0 bash -bash
|
||||
R+ 0 62297 4559 602388 852 0.0 ps /bin/ps -axwo stat
|
||||
Ss 0 7301 175 630816 6960 0.0 login login -pf tonvoon
|
||||
S 501 7302 7301 603600 1584 0.0 bash -bash
|
||||
S+ 501 41381 7302 615408 4196 0.0 ssh ssh dev.net.altinity
|
84
plugins/tests/var/ps_axwo.debian
Normal file
84
plugins/tests/var/ps_axwo.debian
Normal file
|
@ -0,0 +1,84 @@
|
|||
STAT UID PID PPID VSZ RSS %CPU COMMAND COMMAND
|
||||
S 0 1 0 1504 428 0.0 init init [2]
|
||||
SN 0 2 1 0 0 0.0 ksoftirqd/0 [ksoftirqd/0]
|
||||
S< 0 3 1 0 0 0.0 events/0 [events/0]
|
||||
S< 0 4 3 0 0 0.0 khelper [khelper]
|
||||
S< 0 5 3 0 0 0.0 kacpid [kacpid]
|
||||
S< 0 38 3 0 0 0.0 kblockd/0 [kblockd/0]
|
||||
S 0 48 3 0 0 0.0 pdflush [pdflush]
|
||||
S< 0 51 3 0 0 0.0 aio/0 [aio/0]
|
||||
S 0 50 1 0 0 0.0 kswapd0 [kswapd0]
|
||||
S 0 193 1 0 0 0.0 kseriod [kseriod]
|
||||
S 0 214 1 0 0 0.0 scsi_eh_0 [scsi_eh_0]
|
||||
S 0 221 1 0 0 0.0 khubd [khubd]
|
||||
S 0 299 1 0 0 0.3 kjournald [kjournald]
|
||||
S 0 1148 1 0 0 0.0 pciehpd_event [pciehpd_event]
|
||||
S 0 1168 1 0 0 0.0 shpchpd_event [shpchpd_event]
|
||||
Ss 1 1795 1 1612 276 0.0 portmap /sbin/portmap
|
||||
Ss 0 2200 1 1652 568 0.0 vmware-guestd /usr/sbin/vmware-guestd --background /var/run/vmware-guestd.pid
|
||||
Ss 0 2209 1 2240 532 0.0 inetd /usr/sbin/inetd
|
||||
Ss 0 2319 1 3468 792 0.0 sshd /usr/sbin/sshd
|
||||
Ss 0 2323 1 2468 676 0.0 rpc.statd /sbin/rpc.statd
|
||||
Ss 1 2332 1 1684 488 0.0 atd /usr/sbin/atd
|
||||
Ss 0 2335 1 1764 636 0.0 cron /usr/sbin/cron
|
||||
Ss+ 0 2350 1 1500 348 0.0 getty /sbin/getty 38400 tty1
|
||||
Ss+ 0 2351 1 1500 348 0.0 getty /sbin/getty 38400 tty2
|
||||
Ss+ 0 2352 1 1500 348 0.0 getty /sbin/getty 38400 tty3
|
||||
Ss+ 0 2353 1 1500 348 0.0 getty /sbin/getty 38400 tty4
|
||||
Ss+ 0 2354 1 1500 348 0.0 getty /sbin/getty 38400 tty5
|
||||
Ss+ 0 2355 1 1500 348 0.0 getty /sbin/getty 38400 tty6
|
||||
S 0 6907 1 2308 892 0.0 mysqld_safe /bin/sh /usr/bin/mysqld_safe
|
||||
S 103 6944 6907 123220 27724 0.0 mysqld /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
|
||||
S 0 6945 6907 1488 420 0.0 logger logger -p daemon.err -t mysqld_safe -i -t mysqld
|
||||
S 1001 17778 1 6436 1588 0.0 snmpd /usr/sbin/snmpd -u nagios -Lsd -Lf /dev/null -p/var/run/snmpd.pid
|
||||
Ss 0 17789 1 9496 5556 0.0 snmptrapd /usr/sbin/snmptrapd -t -m ALL -M /usr/share/snmp/mibs:/usr/local/nagios/snmp/load -p /var/run/snmptrapd.pid
|
||||
Ss 0 847 2319 14452 1752 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 857 847 14616 1832 0.0 sshd sshd: tonvoon@pts/3
|
||||
Ss 1000 860 857 2984 1620 0.0 bash -bash
|
||||
S 0 868 860 2588 1428 0.0 bash -su
|
||||
S+ 1001 877 868 2652 1568 0.0 bash -su
|
||||
S 0 6086 3 0 0 0.0 pdflush [pdflush]
|
||||
Ss 0 17832 2319 14452 1752 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 18155 17832 14620 1840 0.0 sshd sshd: tonvoon@pts/0
|
||||
Ss 1000 18156 18155 2984 1620 0.0 bash -bash
|
||||
S 0 18518 18156 2588 1428 0.0 bash -su
|
||||
S 1001 18955 18518 2672 1600 0.0 bash -su
|
||||
Ss 0 21683 2319 14452 1756 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 21742 21683 14620 1896 0.0 sshd sshd: tonvoon@pts/1
|
||||
Ss 1000 21743 21742 2984 1620 0.0 bash -bash
|
||||
S 0 21748 21743 2592 1432 0.0 bash -su
|
||||
S 1001 21757 21748 2620 1540 0.0 bash -su
|
||||
Ss 0 2334 2319 14452 1756 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 2343 2334 14620 1840 0.0 sshd sshd: tonvoon@pts/2
|
||||
Ss 1000 2344 2343 2984 1620 0.0 bash -bash
|
||||
S 0 2349 2344 2592 1432 0.0 bash -su
|
||||
S+ 1001 2364 2349 2620 1520 0.0 bash -su
|
||||
T 1001 2454 2364 2096 1032 0.0 vi vi configure.in.rej
|
||||
S+ 1001 8500 21757 69604 52576 0.0 opsview_web_ser /usr/bin/perl -w ./script/opsview_web_server.pl -f -d
|
||||
Ss 0 7609 2319 14452 1756 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 7617 7609 14460 1828 0.0 sshd sshd: tonvoon@pts/4
|
||||
Ss 1000 7618 7617 2984 1620 0.0 bash -bash
|
||||
S 0 7623 7618 2592 1432 0.0 bash -su
|
||||
S+ 1001 7632 7623 2620 1528 0.0 bash -su
|
||||
Ss 1001 12678 1 20784 17728 0.0 opsviewd opsviewd
|
||||
Ss 0 832 1 14512 6360 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
S 33 842 832 14648 6596 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
S 33 843 832 14512 6504 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
S 33 844 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
S 33 845 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
S 33 846 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
Ss 7 4081 1 2464 884 0.0 lpd /usr/sbin/lpd -s
|
||||
S 33 26484 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL
|
||||
Ss 1001 22324 1 20252 1612 0.1 nagios ../../bin/nagios -d /usr/local/nagios/etc/nagios.cfg
|
||||
Ss 0 23336 2319 14452 1756 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 23339 23336 14620 1840 0.0 sshd sshd: tonvoon@pts/5
|
||||
Ss 1000 23340 23339 2996 1636 0.0 bash -bash
|
||||
S 0 23367 23340 3020 1628 0.0 bash bash
|
||||
S 1001 23370 23367 3064 1748 0.0 bash bash
|
||||
Ss 1001 23783 1 3220 764 0.0 ndo2db /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
|
||||
Ss 1001 23784 1 6428 4948 0.0 import_ndologsd import_ndologsd
|
||||
S+ 1001 9803 18955 4132 1936 0.0 ssh ssh altinity@cube02.lei.altinity
|
||||
S 1001 22505 22324 20256 1616 0.0 nagios ../../bin/nagios -d /usr/local/nagios/etc/nagios.cfg
|
||||
S 1001 22506 22505 1676 608 0.0 check_ping /usr/local/nagios/libexec/check_ping -H 192.168.10.23 -w 3000.0,80% -c 5000.0,100% -p 1
|
||||
S 1001 22507 22506 1660 492 0.0 ping /bin/ping -n -U -w 10 -c 1 192.168.10.23
|
||||
R+ 1001 22508 23370 2308 680 0.0 ps ps axwo stat uid pid ppid vsz rss pcpu comm args
|
1
plugins/tests/var/root
Normal file
1
plugins/tests/var/root
Normal file
|
@ -0,0 +1 @@
|
|||
Root
|
Loading…
Add table
Add a link
Reference in a new issue