1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/io/ping
Sam Machin 2d28a2304f
Update package.jsons for mono-repo (#851)
Update the package.json for each node to point to the directory within the repo that hosts the code for the package in question.  as per https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
2021-11-02 15:22:30 +00:00
..
locales added/improved DE translation of forms (#765) 2021-03-12 13:23:26 +00:00
88-ping.html Add IPv6 support to node (#758) 2021-03-12 12:54:13 +00:00
88-ping.js Tidy Ping to remove unnecessary errors, 2021-04-08 17:07:05 +01:00
LICENSE bump ping package to 0.1 to include i18n 2019-10-26 13:07:44 +01:00
package.json Update package.jsons for mono-repo (#851) 2021-11-02 15:22:30 +00:00
README.md new features: Add Triggered Mode to Ping Node (#643) 2020-04-03 16:07:41 +01:00

node-red-node-ping

A Node-RED node to ping a remote server, for use as a keep-alive check.

Install

Either use the Editor - Menu - Manage Palette - Import option or run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-ping

Gotchas

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

2 On some versions on Raspbian (Raspberry Pi) ping seems to be a root only command. The fix is to allow it as follows

sudo setcap cap_net_raw=ep /bin/ping
sudo setcap cap_net_raw=ep /bin/ping6

Usage

Pings 1 or more devices and returns the trip time in mS as msg.payload.

Returns boolean false if no response received, or if the host is unresolveable.

msg.error will contain any error message if necessary.

msg.topic contains the ip address of the target host.

There are 2 modes - Timed and Triggered.

  • Timed mode - this is the default mode that pings your devices on a timed basis. Default ping is every 20 seconds but can be configured.
  • Triggered mode - this mode permits you to trigger the ping by an input message. If the Target is left blank and msg.payload is a string or array, you can ping 1 or more devices on demand.

Refer to the built in help on the side-bar info panel for more details.