How can I retrieve IP address from host?

I am trying to obtain an IP address from a host. The available Ping nodes does not seem to return the IP address, so I tried the EXEC node with the following command:


This worked, but the object returned is not well formatted, so I could not extract the IP address easily.
The complete msg object looks like this:

{"_msgid":"ef79c141.ca169","payload":"Address:\t11.22.33.44:53\n\nNon-authoritative answer:\nNon-authoritative answer:\nName:\\nAddress:\n\n"}

I appreciate if anyone could point me in the right direction. I just need the ip address from this whole message.

You could (in a function node) use a regular expression or the string split method.

Thanks @Steve-Mcl, but I am trying to keep it simple.
I tried the following EXEC command and it seems to work so far:

getent hosts | awk '{ print $1 }'

The message payload contains the IP address only, which is what I wanted.

That wasn't your question though, you asked...

Hey ho, all well that ends well.

If you are making less than 1,000 calls per month, you could use a free account.
I've used them for years, and very reliable.

A GET call;

returns a payload.ip of "" plus lots of other information if you need/want it.

1 Like

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