aboutsummaryrefslogtreecommitdiff
path: root/plugins/t
diff options
context:
space:
mode:
authorGravatar Sven Nierlein <sven@nierlein.de> 2012-04-09 22:12:21 +0200
committerGravatar Sven Nierlein <sven@nierlein.de> 2012-04-09 22:16:39 +0200
commit83655083af68ddd87e5177f3dc4365b6d5721ed5 (patch)
tree0dcef0520f32a2168892a25a86c5635ff025b172 /plugins/t
parent019c9263708d48f2140eeaafb6577ce9ad013c5e (diff)
downloadmonitoring-plugins-83655083af68ddd87e5177f3dc4365b6d5721ed5.tar.gz
check_by_ssh: added -F config file to specify alternative ssh config
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_by_ssh.t13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/t/check_by_ssh.t b/plugins/t/check_by_ssh.t
index 5f2c534d..cca72c96 100644
--- a/plugins/t/check_by_ssh.t
+++ b/plugins/t/check_by_ssh.t
@@ -17,9 +17,14 @@ my $ssh_key = getTestParameter( "NP_SSH_IDENTITY",
"A key allowing access to NP_SSH_HOST",
"~/.ssh/id_dsa");
+my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE",
+ "A config file with ssh settings",
+ "~/.ssh/config");
+
+
plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key);
-plan tests => 40;
+plan tests => 42;
# Some random check strings/response
my @responce = ('OK: Everything is fine!',
@@ -85,6 +90,12 @@ $result = NPTest->testCmd(
cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)");
is($result->output, $responce[4], "Return proper status text even with unknown status codes");
+$result = NPTest->testCmd(
+ "./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'"
+ );
+cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)");
+is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)");
+
# Multiple active checks
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1' -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'"