Using the core node-red-node-ping
you can ping 1 or multiple nodes...
from the built in help...
Triggered
In Triggered mode, you must connect an input wire and pass a msg
in to trigger the ping operation.
If Target
is populated, this will be used as the host/ip. The Target must be is a CSV list of hosts / IPs e.g. "192.168.0.1"
or "192.168.0.1, www.google.com"
If Target is left empty, you can pass a CSV string or an array of hosts in msg.payload
.
- string - a CSV list of hosts / IPs e.g.
"192.168.0.1"
or "192.168.0.1, www.google.com"
- array - an array of hosts as strings or objects. Note : The object must contain at minimum
.host
. Optionally, you can add a timeout
property between 1000 & 30000 (default is 5000 / 5 seconds). Additionally, you can add whatever other properties you wish to this object and when the ping result is returned, it will be passed to the next node in msg.ping
for use downstream
e.g...
[{"id":"76aa3560b32c2762","type":"ping","z":"1683bd9a.5e0a02","protocol":"Automatic","mode":"triggered","name":"","host":"","timer":"20","inputs":1,"x":1870,"y":1320,"wires":[["5cf32978c7d096fb"]]},{"id":"326dc067f7428bb2","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"192.168.1.38\",{\"host\":\"192.168.1.1\",\"name\":\"The router\"},{\"host\":\"myapiserver.com\",\"name\":\"external API\",\"timeout\":20000,\"support\":\"support@myapiserver.com\"}]","payloadType":"json","x":1870,"y":1260,"wires":[["76aa3560b32c2762"]]},{"id":"5cf32978c7d096fb","type":"debug","z":"1683bd9a.5e0a02","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1870,"y":1380,"wires":[]}]