aboutsummaryrefslogtreecommitdiff
path: root/plugins/t
diff options
context:
space:
mode:
authorGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-08-11 08:26:34 +0000
committerGravatar Ton Voon <tonvoon@users.sourceforge.net> 2006-08-11 08:26:34 +0000
commit0c2be6a608135d8a45c82a1c0ada5e8020bc2409 (patch)
treecc1c96e681de1de347a0e34eadf571d18c39de48 /plugins/t
parent4c50478efce19e079c030574e1b23bf02a50573a (diff)
downloadmonitoring-plugins-0c2be6a608135d8a45c82a1c0ada5e8020bc2409.tar.gz
Catch no responses from any server (1538341 - nmdias)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1467 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t')
-rw-r--r--plugins/t/check_ntp.t57
1 files changed, 57 insertions, 0 deletions
diff --git a/plugins/t/check_ntp.t b/plugins/t/check_ntp.t
new file mode 100644
index 00000000..6ba521f1
--- /dev/null
+++ b/plugins/t/check_ntp.t
@@ -0,0 +1,57 @@
+#! /usr/bin/perl -w -I ..
+#
+# Testing NTP
+#
+# $Id$
+#
+
+use strict;
+use Test::More;
+use NPTest;
+
+plan tests => 4;
+
+my $res;
+
+my $ntp_service = getTestParameter( "NP_GOOD_NTP_SERVICE",
+ "A host providing NTP service",
+ "pool.ntp.org");
+
+my $no_ntp_service = getTestParameter( "NP_NO_NTP_SERVICE",
+ "A host NOT providing the NTP service",
+ "localhost" );
+
+my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
+ "The hostname of system not responsive to network requests",
+ "10.0.0.1" );
+
+my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
+ "An invalid (not known to DNS) hostname",
+ "nosuchhost");
+
+SKIP: {
+ skip "No NTP server defined", 1 unless $ntp_service;
+ $res = NPTest->testCmd(
+ "./check_ntp -H $ntp_service"
+ );
+ cmp_ok( $res->return_code, '==', 0, "Got good NTP result");
+}
+
+SKIP: {
+ skip "No bad NTP server defined", 1 unless $ntp_service;
+ $res = NPTest->testCmd(
+ "./check_ntp -H $no_ntp_service"
+ );
+ cmp_ok( $res->return_code, '==', 2, "Got bad NTP result");
+}
+
+$res = NPTest->testCmd(
+ "./check_ntp -H $host_nonresponsive"
+ );
+cmp_ok( $res->return_code, '==', 2, "Got critical if server not responding");
+
+$res = NPTest->testCmd(
+ "./check_ntp -H $hostname_invalid"
+ );
+cmp_ok( $res->return_code, '==', 3, "Got critical if server hostname invalid");
+