summaryrefslogtreecommitdiffstats
path: root/plugins-root/t/check_icmp.t
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-06-20 10:04:34 +0200
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-06-20 10:04:34 +0200
commit2bea8e9522af1c454d1a6a618402f9f342730406 (patch)
treeea18c8e0cefd18ab3694540a321811e62ff8adac /plugins-root/t/check_icmp.t
parent20e938bb542d361ad1468ab24330f554445aefb1 (diff)
downloadmonitoring-plugins-2bea8e9522af1c454d1a6a618402f9f342730406.tar.gz
check_icmp: Remove signal handling and timeouts
The timeout option was redundant in that the runtime of check_icmp was always limited by the input parameters and therefore timeout gets removed with this commit to avoid that confusion. The rest of the signal handlings was removed too, since the added complexity does not provide sufficient returns. If check_icmp gets a signal, it now dies like most other programs instead of trying to save some things and return a (arguably wrong) result.
Diffstat (limited to 'plugins-root/t/check_icmp.t')
-rw-r--r--plugins-root/t/check_icmp.t30
1 files changed, 15 insertions, 15 deletions
diff --git a/plugins-root/t/check_icmp.t b/plugins-root/t/check_icmp.t
index 2c1d12e6..e68617cd 100644
--- a/plugins-root/t/check_icmp.t
+++ b/plugins-root/t/check_icmp.t
@@ -33,12 +33,12 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
33my $res; 33my $res;
34 34
35$res = NPTest->testCmd( 35$res = NPTest->testCmd(
36 "$sudo ./check_icmp -H $host_responsive -w 10000ms,100% -c 10000ms,100%" 36 "$sudo ./check_icmp -H $host_responsive -w 100ms,100% -c 100ms,100%"
37 ); 37 );
38is( $res->return_code, 0, "Syntax ok" ); 38is( $res->return_code, 0, "Syntax ok" );
39 39
40$res = NPTest->testCmd( 40$res = NPTest->testCmd(
41 "$sudo ./check_icmp -H $host_responsive -w 0ms,0% -c 10000ms,100%" 41 "$sudo ./check_icmp -H $host_responsive -w 0ms,0% -c 100ms,100%"
42 ); 42 );
43is( $res->return_code, 1, "Syntax ok, with forced warning" ); 43is( $res->return_code, 1, "Syntax ok, with forced warning" );
44 44
@@ -48,32 +48,32 @@ $res = NPTest->testCmd(
48is( $res->return_code, 2, "Syntax ok, with forced critical" ); 48is( $res->return_code, 2, "Syntax ok, with forced critical" );
49 49
50$res = NPTest->testCmd( 50$res = NPTest->testCmd(
51 "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -t 2" 51 "$sudo ./check_icmp -H $host_nonresponsive -w 100ms,100% -c 100ms,100%"
52 ); 52 );
53is( $res->return_code, 2, "Timeout - host nonresponsive" ); 53is( $res->return_code, 2, "Timeout - host nonresponsive" );
54 54
55$res = NPTest->testCmd( 55$res = NPTest->testCmd(
56 "$sudo ./check_icmp -w 10000ms,100% -c 10000ms,100%" 56 "$sudo ./check_icmp -w 100ms,100% -c 100ms,100%"
57 ); 57 );
58is( $res->return_code, 3, "No hostname" ); 58is( $res->return_code, 3, "No hostname" );
59 59
60$res = NPTest->testCmd( 60$res = NPTest->testCmd(
61 "$sudo ./check_icmp -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 0 -t 2" 61 "$sudo ./check_icmp -H $host_nonresponsive -w 100ms,100% -c 100ms,100% -n 1 -m 0"
62 ); 62 );
63is( $res->return_code, 0, "One host nonresponsive - zero required" ); 63is( $res->return_code, 0, "One host nonresponsive - zero required" );
64 64
65$res = NPTest->testCmd( 65$res = NPTest->testCmd(
66 "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 1 -t 2" 66 "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 100ms,100% -c 100ms,100% -n 1 -m 1"
67 ); 67 );
68is( $res->return_code, 0, "One of two host nonresponsive - one required" ); 68is( $res->return_code, 0, "One of two host nonresponsive - one required" );
69 69
70$res = NPTest->testCmd( 70$res = NPTest->testCmd(
71 "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" 71 "$sudo ./check_icmp -H $host_responsive -H $host_nonresponsive -w 100ms,100% -c 100ms,100% -n 1 -m 2"
72 ); 72 );
73is( $res->return_code, 2, "One of two host nonresponsive - two required" ); 73is( $res->return_code, 2, "One of two host nonresponsive - two required" );
74 74
75$res = NPTest->testCmd( 75$res = NPTest->testCmd(
76 "$sudo ./check_icmp -H $host_responsive -s 127.0.15.15 -w 10000ms,100% -c 10000ms,100% -n 1 -m 2" 76 "$sudo ./check_icmp -H $host_responsive -s 127.0.15.15 -w 100ms,100% -c 100ms,100% -n 1 -m 2"
77 ); 77 );
78is( $res->return_code, 0, "IPv4 source_ip accepted" ); 78is( $res->return_code, 0, "IPv4 source_ip accepted" );
79 79
@@ -83,35 +83,35 @@ $res = NPTest->testCmd(
83is( $res->return_code, 0, "Try max packet size" ); 83is( $res->return_code, 0, "Try max packet size" );
84 84
85$res = NPTest->testCmd( 85$res = NPTest->testCmd(
86 "$sudo ./check_icmp -H $host_responsive -R 100,100 -n 1 -t 2" 86 "$sudo ./check_icmp -H $host_responsive -R 100,100 -n 1"
87 ); 87 );
88is( $res->return_code, 0, "rta works" ); 88is( $res->return_code, 0, "rta works" );
89$res = NPTest->testCmd( 89$res = NPTest->testCmd(
90 "$sudo ./check_icmp -H $host_responsive -P 80,90 -n 1 -t 2" 90 "$sudo ./check_icmp -H $host_responsive -P 80,90 -n 1"
91 ); 91 );
92is( $res->return_code, 0, "pl works" ); 92is( $res->return_code, 0, "pl works" );
93 93
94$res = NPTest->testCmd( 94$res = NPTest->testCmd(
95 "$sudo ./check_icmp -H $host_responsive -J 80,90 -t 2" 95 "$sudo ./check_icmp -H $host_responsive -J 80,90"
96 ); 96 );
97is( $res->return_code, 0, "jitter works" ); 97is( $res->return_code, 0, "jitter works" );
98 98
99$res = NPTest->testCmd( 99$res = NPTest->testCmd(
100 "$sudo ./check_icmp -H $host_responsive -M 4,3 -t 2" 100 "$sudo ./check_icmp -H $host_responsive -M 4,3"
101 ); 101 );
102is( $res->return_code, 0, "mos works" ); 102is( $res->return_code, 0, "mos works" );
103 103
104$res = NPTest->testCmd( 104$res = NPTest->testCmd(
105 "$sudo ./check_icmp -H $host_responsive -S 80,70 -t 2" 105 "$sudo ./check_icmp -H $host_responsive -S 80,70"
106 ); 106 );
107is( $res->return_code, 0, "score works" ); 107is( $res->return_code, 0, "score works" );
108 108
109$res = NPTest->testCmd( 109$res = NPTest->testCmd(
110 "$sudo ./check_icmp -H $host_responsive -O -t 2" 110 "$sudo ./check_icmp -H $host_responsive -O"
111 ); 111 );
112is( $res->return_code, 0, "order works" ); 112is( $res->return_code, 0, "order works" );
113 113
114$res = NPTest->testCmd( 114$res = NPTest->testCmd(
115 "$sudo ./check_icmp -H $host_responsive -O -S 80,70 -M 4,3 -J 80,90 -P 80,90 -R 100,100 -t 2" 115 "$sudo ./check_icmp -H $host_responsive -O -S 80,70 -M 4,3 -J 80,90 -P 80,90 -R 100,100"
116 ); 116 );
117is( $res->return_code, 0, "order works" ); 117is( $res->return_code, 0, "order works" );