[SOLVED] Network binding ping does not work with some devices - how to debug

  • Platform information:
    • Hardware:Intel NUC i3 8GB RAM
    • OS: Debian, Docker
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 4.2.1

I try to get a sitemap that shows the online-status for a few devices.
Some work, some do not (are always offline), some are unreliable (toggle between online/offline)

One that reliably does not work

Thing network:pingdevice:guenter-macbook [ hostname="guenter-macbook", refreshInterval=1030, retry=2, timeout=800,  cacheDeviceStateTimeInMS=900, use_system_ping="false" ]
Switch Guenter_Macbook_Present "Guenter Macbook" (gPresence) { channel="network:pingdevice:guenter-macbook:online" }

ping and arping works for all devices (arping also when run from within the openHAB Docker container, ping is not installed but I guess it would work the same)

I tried deleting the cache and tmp but didn’t change anything.
All bindings were installed using config files (no Paper UI)

Is there a way to get more debug information?

I haven’t found a namespace to enable for TRACE logging that would provide more details.

Do the “some” devices that don’t work even allow the ICMP protocol which is responsible for ping etc?

The Network Binding Docs state that ping and arping is used.

Did you try to install it?

This means I could ping all devices from outside Docker (from another machine)
and I could arping them even from inside the openHAB Docker container.
I didn’t think to gain more information if I also try ping from within the Docker container as well.

I’d rather know if there is a way to get some log output from the built-in (Java) ping feature and from arping calls for these things.
I wasn’t even able to figure out if these devices are pinged by openHAB at all.

?

in userdata/logs/events.log I found

2019-04-18 14:47:06.415 [hingStatusInfoChangedEvent] - 'network:pingdevice:guenter-macbook' changed from INITIALIZING to ONLINE

But in the sitemap

Switch Guenter_Macbook_Present "Guenter Macbook" (gPresence) { channel="network:pingdevice:guenter-macbook:online" }

is shown as “off”

The openhab.log contains now

2019-04-18 14:47:06.253 [TRACE] [me.config.core.internal.ConfigMapper] - Setting value (String) guenter-macbook to field 'hostname' in configuration class org.openhab.binding.network.internal.NetworkHandlerConfiguration
2019-04-18 14:47:06.254 [TRACE] [me.config.core.internal.ConfigMapper] - Skipping field 'port', because config has no entry for port
2019-04-18 14:47:06.255 [TRACE] [me.config.core.internal.ConfigMapper] - Setting value (Integer) 2 to field 'retry' in configuration class org.openhab.binding.network.internal.NetworkHandlerConfiguration
2019-04-18 14:47:06.256 [TRACE] [me.config.core.internal.ConfigMapper] - Setting value (Integer) 1030 to field 'refreshInterval' in configuration class org.openhab.binding.network.internal.NetworkHandlerConfiguration
2019-04-18 14:47:06.257 [TRACE] [me.config.core.internal.ConfigMapper] - Setting value (Integer) 800 to field 'timeout' in configuration class org.openhab.binding.network.internal.NetworkHandlerConfiguration
2019-04-18 14:47:06.357 [DEBUG] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine 'arping --help'
2019-04-18 14:47:06.411 [DEBUG] [lipse.smarthome.io.net.exec.ExecUtil] - exit code '0', result 'ARPing 2.14, by Thomas Habets <thomas@habets.se>
usage: arping [ -0aAbdDeFpPqrRuUv ] [ -w <us> ] [ -W <sec> ] [ -S <host/ip> ]
              [ -T <host/ip ] [ -s <MAC> ] [ -t <MAC> ] [ -c <count> ]
              [ -C <count> ] [ -i <interface> ] <host/ip/MAC | -B>

Options:

    -0     Use this option to ping with source IP address 0.0.0.0. Use this
           when you haven't configured your interface yet.  Note that  this
           may  get  the  MAC-ping  unanswered.   This  is  an alias for -S
           0.0.0.0.
    -a     Audiable ping.

but it looks like happens only once when I start the openHAB Docker container

Okay so you setup the item and sitemap manually.
Did you check the paperUI if the device is listen as Online there?
I would try to set it up via paperUI and see if the error still exists

In PaperUI I found

actually the screenshots are from HabMin

I installed ping in Docker as you suggested and it can not ping these devices.
Seems I made some mistake or mixed something up when I tested it previously.

So this one should be sorted out. Thanks a lot for your support.

It remains the issue why it is not using arping which is working with guenter-macbook even from within the container.

It might be Adventures implementing reliable network detection using arping

I don’t know exactly what solved it but now it’s working fine.
iPhones and MacBook are a bit unreliable, but that’s an iPhone/Macbook speciality.

I installed ping in the openHAB docker container
and forwarded 67 to 6767 on the host machine to enable DHCP support.

Still a bit unsatisfactory are the limited possibilities to diagnose what’s going on exactly.
What methods returned what results with which device?
What are the error messages when something failed?

Thanks @BrutalBirdie this just helped me, have recently updated to OH3 running in docker on synology from OH2.5 running on a Pi. Looks like the OH3 image doesn’t include iputils-ping.

Bash’d in running container

apt-get update
apt-get install iputils-ping

Saved “thing” using the network binding again and all good to go, noted that icmp_state arp_state are now populated as per image below.

3 Likes

Works fine and solved my same problem when migrating to OH Docker 3.2, thx!