# Ping Network Devices From a List

**URL:** https://discourse.nodered.org/t/ping-network-devices-from-a-list/43563
**Category:** General
**Created:** [2 April 2021 16:13 UTC](https://discourse.nodered.org/t/ping-network-devices-from-a-list/43563 "2021-04-02T16:13:33Z")
**Posts on this page:** 1
**Showing post:** 12

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [2 April 2021 17:51 UTC](https://discourse.nodered.org/t/ping-network-devices-from-a-list/43563/12 "2021-04-02T17:51:32Z")

</div>

That flow is a bit much for something simple. It is also out of date due to the node-red-node-ping now able to ping multiple devices.

This is a basic working demo...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/8/18876d7a76b3e11ee76e127427e10d216649f1c0.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/b/cb4fddeea52bca7b28846a51a8345dd23ce622ce.png)

...

- Import the flow
- adjust the ping list in the inject.
  - alternatively get this list from a database or other place - just ensure it is the same format.

- select your bot in the telegram node

flow...

```auto
[{"id":"e9e310aa.76a0d","type":"debug","z":"83a23089.dc697","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1610,"y":80,"wires":[]},{"id":"8614c5fd.bf5588","type":"inject","z":"83a23089.dc697","name":" ***Setup devices to ping here***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"name\":\"router\",\"host\":\"192.168.1.1\"},{\"name\":\"nvr\",\"host\":\"192.168.1.50\"},{\"name\":\"cam1\",\"host\":\"192.168.1.38\"},{\"name\":\"bad device\",\"host\":\"192.168.2.99\"}]","payloadType":"json","x":1230,"y":80,"wires":[["29069ffe.93c78"]]},{"id":"29069ffe.93c78","type":"ping","z":"83a23089.dc697","mode":"triggered","name":"","host":"","timer":"20","inputs":1,"x":1450,"y":80,"wires":[["e9e310aa.76a0d","9774ee36.6c7ff"]]},{"id":"9774ee36.6c7ff","type":"function","z":"83a23089.dc697","name":"Prepare telegram message (if bad)","func":"if(msg.payload === false) {\n msg.payload = {};\n msg.payload.type = 'message';\n msg.payload.content = `Ping to '${msg.ping.name}' (${msg.ping.host}) failed`;\n msg.payload.chatId = 11111111\n return msg;\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1380,"y":160,"wires":[["f275d6de.1e4fc8","8d95831d.c0745"]]},{"id":"f275d6de.1e4fc8","type":"debug","z":"83a23089.dc697","name":"to Telegram node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1650,"y":160,"wires":[]},{"id":"8d95831d.c0745","type":"telegram sender","z":"83a23089.dc697","name":"","bot":"fa7a9376.321ce","haserroroutput":false,"outputs":1,"x":1650,"y":220,"wires":[[]]},{"id":"fa7a9376.321ce","type":"telegram bot","botname":"mybot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"","usesocks":false,"sockshost":"","socksport":"","socksusername":"","sockspassword":"","bothost":"","botpath":"","localbotport":"","publicbotport":"","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

```

* * *

# PS: when you post code or flow - always put it in a code block

`````  
`code goes between backticks otherwise it looks rubbish and actually doesn't work due to forum formatting!!!`  
`````

---

_[View the full topic](https://discourse.nodered.org/t/ping-network-devices-from-a-list/43563)._
