2020-04-03 17:07:41 +02:00
|
|
|
<script type="text/html" data-help-name="ping">
|
2019-10-26 13:54:17 +02:00
|
|
|
<p>Pings a machine and returns the trip time in mS as <code>msg.payload</code>.</p>
|
2020-04-03 17:07:41 +02:00
|
|
|
<h3>Output</h3>
|
|
|
|
<dl class="message-properties">
|
|
|
|
<dt>payload <span class="property-type">number</span></dt>
|
2020-04-03 17:50:09 +02:00
|
|
|
<dd> the trip time in mS, or boolean <i>false</i> if no response.</dd>
|
2020-04-03 17:07:41 +02:00
|
|
|
<dt>topic <span class="property-type">string</span></dt>
|
2020-04-03 17:50:09 +02:00
|
|
|
<dd> the target host or ip address.</dd>
|
|
|
|
<dt>[ping] <span class="property-type">object</span></dt>
|
|
|
|
<dd> an object containing <code>host</code> and any other properties sent in the array object.<br>
|
|
|
|
<b>Note</b>: This object is only appended when using triggered mode and an array for input payload. It is
|
|
|
|
intended for advanced users and permits scenarios where you need additional properties to be tagged into your result for use downstream.</dd>
|
2020-04-03 17:07:41 +02:00
|
|
|
</dl>
|
|
|
|
<h3>Details</h3>
|
|
|
|
<p>Returns <b>false</b> if no response received, or if the host is unresolveable.</p>
|
2019-10-26 13:54:17 +02:00
|
|
|
<p>Default ping is every 20 seconds but can be configured.</p>
|
2020-04-03 17:07:41 +02:00
|
|
|
|
2021-03-12 13:54:13 +01:00
|
|
|
<h4>Protocol...</h4>
|
|
|
|
<ul>
|
|
|
|
<li><b>Automatic</b><br>
|
|
|
|
<P>Will use any Protocol, IPv4 or IPv6, to reach host; based on your operating system network settings</P>
|
|
|
|
</li>
|
|
|
|
<li><b>IPv4</b><br>
|
|
|
|
<P>Forces use of IPv4 to reach host. Will fail if no route availibe</P>
|
|
|
|
</li>
|
|
|
|
<li><b>IPv6</b><br>
|
|
|
|
<P>Forces use of IPv6 to reach host. Will fail if no route availibe</P>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2020-04-03 17:07:41 +02:00
|
|
|
<h4>Mode...</h4>
|
|
|
|
<ul>
|
|
|
|
<li><b>Timed</b><br>
|
2020-04-03 17:50:09 +02:00
|
|
|
<P>In Timed mode, the fields <code>Target</code> and <code>Ping (S)</code> must be populated.</P>
|
|
|
|
<p>Target must be a CSV list of hosts / IPs e.g. <code>"192.168.0.1"</code> or <code>"192.168.0.1, www.google.com"</code></p>
|
|
|
|
<p>Ping (S) is the number of seconds between pings</p>
|
2020-04-03 17:07:41 +02:00
|
|
|
</li>
|
|
|
|
<li><b>Triggered</b><br>
|
2020-04-03 17:50:09 +02:00
|
|
|
<p>In Triggered mode, you must connect an input wire and pass a <code>msg</code> in to trigger the ping operation.</p>
|
|
|
|
<p>If <code>Target</code> is populated, this will be used as the host/ip. The Target must be is a CSV list of
|
|
|
|
hosts / IPs e.g. <code>"192.168.0.1"</code> or <code>"192.168.0.1, www.google.com"</code></p>
|
|
|
|
|
|
|
|
<p>If Target is left empty, you can pass a CSV string or an array of hosts in <code>msg.payload</code>.
|
2020-04-03 17:07:41 +02:00
|
|
|
<ul>
|
2020-04-03 17:50:09 +02:00
|
|
|
<li><b>string</b> - a CSV list of hosts / IPs e.g. <code>"192.168.0.1"</code> or <code>"192.168.0.1, www.google.com"</code> </li>
|
|
|
|
<li><b>array</b> - an array of hosts as strings or objects. <b>Note</b>: The object must contain at minimum <code>.host</code>.
|
|
|
|
Optionally, you can add a <code>timeout</code> 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 <code>msg.ping</code> for use downstream</li>
|
2020-04-03 17:07:41 +02:00
|
|
|
<li>Example array payload input: <pre>[
|
|
|
|
"192.168.0.99",
|
|
|
|
{
|
2020-04-03 17:50:09 +02:00
|
|
|
"host":"192.168.0.1",
|
2020-04-03 17:07:41 +02:00
|
|
|
"name":"The router"
|
2020-04-03 17:50:09 +02:00
|
|
|
},
|
2020-04-03 17:07:41 +02:00
|
|
|
{
|
2020-04-03 17:50:09 +02:00
|
|
|
"host":"myapiserver.com",
|
|
|
|
"name":"external API",
|
2020-04-03 17:07:41 +02:00
|
|
|
"timeout": 20000,
|
|
|
|
"support":"support@myapiserver.com"
|
|
|
|
}
|
|
|
|
]</pre> </li>
|
|
|
|
</ul>
|
|
|
|
</p>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2020-04-03 17:50:09 +02:00
|
|
|
<p><b>Note</b>: if running inside Ubuntu Snap you will need to manually start the network-observe interface.
|
|
|
|
<code>snap connect node-red:network-observe</code>.</p>
|
2019-10-26 13:54:17 +02:00
|
|
|
</script>
|