2014-07-27 18:05:23 +01:00
node-red-node-ping
==================
2016-02-12 13:14:12 +00: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 18:05:23 +01:00
Install
-------
2016-03-02 13:18:24 +00:00
Run the following command in your Node-RED user directory - typically `~/.node-red`
2014-07-27 18:05:23 +01:00
npm install node-red-node-ping
2018-12-07 16:55:16 +00:00
2018-12-05 13:46:08 +00:00
**Gotchas**
2016-01-09 16:56:46 +00:00
2018-12-07 16:55:16 +00: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 13:46:08 +00:00
2 On some versions on Raspbian (Raspberry Pi) `ping` seems to be a root only command.
2016-01-09 16:56:46 +00: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 18:05:23 +01:00
Usage
-----
2016-02-13 11:15:02 +00:00
Pings a machine and returns the trip time in mS as `msg.payload` .
2016-02-12 13:14:12 +00:00
Returns boolean `false` if no response received, or if the host is unresolveable.
2016-02-13 11:15:02 +00:00
`msg.error` will contain any error message if necessary.
2014-07-27 18:05:23 +01:00
2016-02-13 11:15:02 +00:00
`msg.topic` contains the ip address of the target host.
2014-07-27 18:05:23 +01:00
Default ping is every 20 seconds but can be configured.