2014-07-27 19:05:23 +02:00
node-red-node-ping
==================
2016-02-12 14:14:12 +01:00
A < a href = "http://nodered.org" target = "_new" > Node-RED< / a > node to ping a
remote server, for use as a keep-alive check.
2014-07-27 19:05:23 +02:00
Install
-------
2019-10-26 14:07:44 +02:00
Either use the Editor - Menu - Manage Palette - Import option or run the following command in your Node-RED user directory - typically `~/.node-red`
2014-07-27 19:05:23 +02:00
npm install node-red-node-ping
2018-12-07 17:55:16 +01:00
2018-12-05 14:46:08 +01:00
**Gotchas**
2016-01-09 17:56:46 +01:00
2018-12-07 17:55:16 +01:00
1 Ubuntu Snap containers are strict and do not like giving external commands (like ping) external access. To allow ping to work you must manually add the network-observe interface
sudo snap connect node-red:network-observe
2018-12-05 14:46:08 +01:00
2 On some versions on Raspbian (Raspberry Pi) `ping` seems to be a root only command.
2016-01-09 17:56:46 +01:00
The fix is to allow it as follows
sudo setcap cap_net_raw=ep /bin/ping
sudo setcap cap_net_raw=ep /bin/ping6
2014-07-27 19:05:23 +02:00
Usage
-----
2016-02-13 12:15:02 +01:00
Pings a machine and returns the trip time in mS as `msg.payload` .
2016-02-12 14:14:12 +01:00
Returns boolean `false` if no response received, or if the host is unresolveable.
2019-10-26 14:07:44 +02:00
2016-02-13 12:15:02 +01:00
`msg.error` will contain any error message if necessary.
2014-07-27 19:05:23 +02:00
2016-02-13 12:15:02 +01:00
`msg.topic` contains the ip address of the target host.
2014-07-27 19:05:23 +02:00
Default ping is every 20 seconds but can be configured.