From 8cff506f07e375b1828f91b2c4e34191e70216c6 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Fri, 14 Aug 2020 22:27:12 +0200 Subject: [PATCH] Plugin multi_tcp_ping: gracefully handle DNS resolution problems Previously the plugin exited with an error, if the target name could not be resolved. Now this problem is handled just like an "unreachable" situation. Thanks, nitram2342! Closes: #1091 --- plugins/ping/multi_tcp_ping | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/ping/multi_tcp_ping b/plugins/ping/multi_tcp_ping index ee88033d..a1b1dbeb 100755 --- a/plugins/ping/multi_tcp_ping +++ b/plugins/ping/multi_tcp_ping @@ -108,7 +108,9 @@ sub ping_host { $p->service_check(1); $p->{port_num} = $host->[1] || $defaults{port}; - ($ret, $time, $ip) = $p->ping($host->[0]); + eval { + ($ret, $time, $ip) = $p->ping($host->[0]); + }; $time = $defaults{unreachable} if !$ret; print "${addr}.value $time\n";