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
This commit is contained in:
Lars Kruse 2020-08-14 22:27:12 +02:00
parent 9e2b918229
commit 8cff506f07
1 changed files with 3 additions and 1 deletions

View File

@ -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";