Skip to content

Commit

Permalink
12897 FIX check_icmp: Failed to resolve multiple addresses
Browse files Browse the repository at this point in the history
In Checkmk versions 2.0.0i1 to 2.0.0p5 the active check "check_icmp"
(a.k.a. <i>PING</i> service) failed when configured for a host
with multiple IP addresses.

Change-Id: I6c6656f075b3375d9ab4b495604ac8c8789f2970
  • Loading branch information
mo-ki committed May 31, 2021
1 parent e62ac27 commit f1d1c26
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .werks/12897
@@ -0,0 +1,14 @@
Title: check_icmp: Failed to resolve multiple addresses
Class: fix
Compatible: compat
Component: checks
Date: 1622116447
Edition: cre
Knowledge: doc
Level: 1
State: unknown
Version: 2.1.0i1

In Checkmk versions 2.0.0i1 to 2.0.0p5 the active check "check_icmp"
(a.k.a. <i>PING</i> service) failed when configured for a host
with multiple IP addresses.
6 changes: 5 additions & 1 deletion checks/check_icmp
Expand Up @@ -59,7 +59,11 @@ def check_icmp_arguments(params):
else: # custom
args.append(target[1])

return args
# Unfortunately, we must return a single string here.
# Otherwise shell quoting will be applied to every element
# of the list, which will interfere with macro replacements like
# "$HOST_ADDRESSES_4$" -> "1.2.3.4 5.6.7.8"
return ' '.join(args)


def check_icmp_description(params):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/checks/test_check_icmp.py
Expand Up @@ -11,7 +11,7 @@


@pytest.mark.parametrize("params,expected_args",
[({}, ["-w", "200.00,80%", "-c", "500.00,100%", "$HOSTADDRESS$"])])
[({}, "-w 200.00,80% -c 500.00,100% $HOSTADDRESS$")])
def test_check_icmp_argument_parsing(params, expected_args):
"""Tests if all required arguments are present."""
active_check = ActiveCheck("check_icmp")
Expand Down

0 comments on commit f1d1c26

Please sign in to comment.