# Pass several objects in one step to "Advanced Ping"

**URL:** https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161
**Category:** General
**Created:** [1 August 2021 11:54 UTC](https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161 "2021-08-01T11:54:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Golonder](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Golonder](https://discourse.nodered.org/u/Golonder)
#### Post date: [1 August 2021 11:54 UTC](https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161/1 "2021-08-01T11:54:53Z")

</div>

Hi,

I am using the "advanced ping" node to check if my network hardware is still up and running.  
this node requires a msg.host value to ping to.  
I would like to send him a list of msg.host value so that I do not have to handle them one by one.

Is there a possibility to return more than one object in a single step ?

Thats what I tried, but it does not work:

```auto
var x = {};
var y = [];

x.host = '10.0.0.21';
y[0] = x;

x.host = '10.0.0.40';
y[1] = x;

x.host = '10.0.0.160';
y[2] = x;

y.forEach(i,x)
{
    i++;
    return x;
}

```

---

<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: [1 August 2021 12:33 UTC](https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161/2 "2021-08-01T12:33:40Z")

</div>

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...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/6/d60a150f8ac940eebf03d9f0696048122e5a2217.png)

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

### Author: ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)
#### Post date: [1 August 2021 12:41 UTC](https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161/3 "2021-08-01T12:41:28Z")

</div>

Or you could do something like this:

```auto
let y = [{ host: "10.0.0.21" }, { host: "10.0.0.40" }, { host: "10.0.0.160" }];

y.forEach(function (element) {
    node.send(element);
});

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 September 2021 12:42 UTC](https://discourse.nodered.org/t/pass-several-objects-in-one-step-to-advanced-ping/49161/4 "2021-09-30T12:42:02Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
