On Thu, Apr 12, 2018 at 05:43:03PM +0200, Uwe Kleine-König wrote: > Package: monitoring-plugins-basic > Version: 2.2-3 > Severity: normal > > Hello, > > I want to monitor a host called www.xn--kleine-knig-yfb.de (or > www.kleine-könig.de). Both ways to write this hostname are incompatible with > check_ping: > > $ /usr/lib/nagios/plugins/check_ping -H www.xn--kleine-knig-yfb.de -w > 5,5% -c 10,10% -vvv > CMD: /bin/ping6 -n -U -w 10 -c 5 www.xn--kleine-knig-yfb.de > Got stderr: ping: www.xn--kleine-knig-yfb.de: Parameter string not > correctly encoded > /bin/ping6 -n -U -w 10 -c 5 www.xn--kleine-knig-yfb.de > CRITICAL - Could not interpret output from ping command > > $ /usr/lib/nagios/plugins/check_ping -H www.kleine-könig.de -w 5,5% -c > 10,10% -vvv > check_ping: Invalid hostname/address - www.kleine-könig.de > Usage: > check_ping -H <host_address> -w <wrta>,<wpl>% -c <crta>,<cpl>% > [-p packets] [-t timeout] [-4|-6] > > "funny" enough, ping6 supports both variants: > > $ /bin/ping6 -n -U -w 10 -c 5 www.xn--kleine-knig-yfb.de > PING www.xn--kleine-knig-yfb.de(2a01:4f8:c0c:3a97::2) 56 data bytes > 64 bytes from 2a01:4f8:c0c:3a97::2: icmp_seq=1 ttl=64 time=0.092 ms > 64 bytes from 2a01:4f8:c0c:3a97::2: icmp_seq=2 ttl=64 time=0.039 ms > 64 bytes from 2a01:4f8:c0c:3a97::2: icmp_seq=3 ttl=64 time=0.068 ms > 64 bytes from 2a01:4f8:c0c:3a97::2: icmp_seq=4 ttl=64 time=0.046 ms > 64 bytes from 2a01:4f8:c0c:3a97::2: icmp_seq=5 ttl=64 time=0.061 ms > > --- www.xn--kleine-knig-yfb.de ping statistics --- > 5 packets transmitted, 5 received, 0% packet loss, time 4092ms > rtt min/avg/max/mdev = 0.039/0.061/0.092/0.019 ms
I looked at the code for a while, and the culprit for
www.xn--kleine-knig-yfb.de not working is that spopen() (in
plugins/popen.c) does LC_ALL=C:
$ env LC_ALL=C /bin/ping6 -n -U -w 10 -c 5 www.xn--kleine-knig-yfb.de
ping: www.xn--kleine-knig-yfb.de: Parameter string not correctly encoded
And with LC_ALL=C it's also not surprising that the domain with ö
doesn't work.
So the obvious ways to fix the problem are:
- let spopen() use C.UTF-8
- fix ping to be able to work with www.xn--kleine-knig-yfb.de even with
LC_ALL=C .
I'll open a bug against iputils-ping for the latter assuming people fear
to switch away from 7-bit ascii.
Best regards
Uwe
signature.asc
Description: PGP signature

