Help with TCP-Ping

Been a while since OI have posted. Have hit a bit of snag in relation to pinging a node on my network.

Originally was using the 'ping' node but couldn't workout how to ping an IP address with a non-standard port. So I have implemented tcp-ping and everything is great, except I am unsure how to use the output of tcp-ping to trigger an email.

Here's the output I receive from tcp-ping...

tcp-ping-output

Previoulsy when using the 'ping' node if the ping failed it would send a 'failed' status in the msg.payload which would then trigger an email. But as you can see tcp-ping sends a number of parameters, but all I want to know is when the ping fails.

Here's the flow...

I am thinking I need to add something to the Ping Check node, but having tried a few things, and being hopeless in json coding, here I am.

Any tips/hints greatly appreciated.

From the data you show, what would you define as success and what as failure? It might be simpler if you told it to only do one ping request rather than three

Have you tried changing your Ping Check node to check if msg.payload.success == 0 ?

Why not add a switch node set to check if msg.failed > 0

Of course, you cannot do a standard ICMP ping to a port since ping only hits the lowest level of the network stack - effectively the network card itself. That is why occasionally, you can get a return from a ping when the rest of the device isn't working correctly.

I tried what you suggested, and tried this config... here's the debug ping message.

pingfailmsg

And here's the code I placed in the switch node...

SwitchNodePing

But it didn't appear to have any output in the debug?

Yes, that is what has been happening. The system had stopped working, but was still responding to the ping node. So that is why I wanted to ping a specific port.

Or if you prefer, msg.payload.failed > 0
(Though I think zero success is better than a non zero failure to indicate a communication problem .)

Seems the msg.payload.success == 0 is working, so perhaps I go with that. Thank you for the advice.

The ping node is able to auto trigger every 60 seconds, but I am not sure if tcp-ping does the same? Or do I need to add an inject node to trigger the tcp-ping every 60 seconds?

Oops, sorry about that I didn’t look closely enough at the first debug to see it was in msg.payload. Glad it is working but now you have to determine why one ping worked and the other did not.

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