[Xymon] how to get list of IP addresses used by Xymon for each host entry

J.C. Cleaver cleaver at terabithia.org
Fri Dec 11 06:31:44 CET 2015


On Thu, December 10, 2015 7:14 pm, FARRIOR, Andy wrote:

>
> if your hosts.cfg file looks like this:
>
> 0.0.0.0  foo  # dns
> 10.1.1.2 bar # testip ntp
>
> and the DNS lookup for foo is 10.1.1.1, what xymon command would I issue
> in a script to get a list of the IP addresses Xymon has associated with
> each host?
>
>
> so, for the above example, the result would be:
>
> 10.1.1.1 foo # tests
> 10.1.1.2 bar # tests
>
>
> I'm looking for a way to get the IP addresses Xymon is using for each
> host.


It depends a little on what you want. In a real sense, xymon doesn't
systematically maintain a list of addresses used for the host. The only
component that looks them up (xymonnet) does a fresh DNS lookup for each
one with "0.0.0.0" that it finds. It's using the c-ares library for that,
but it basically follows the same rules as the normal system resolver. It
shouldn't be any different than scripting a 'host $SERVERNAME' call
against hosts with no IP configured and parsing the result. Since xymonnet
is executed, and then exits and is restarted at the next poll cycle,
there's nothing that can really get cached either.


If you want to see what IP actually *happened*, you could try something
like this to get at the results of the 'conn' tests if you're using 4.3.18
or higher.

xymon localhost "xymondboard test=conn fields=hostname,msg" | perl -pe
's/^([\w.-]+)\W.*&\w+\s([\d.]+).*/\1 \2/'


All of the other ways of pulling data from xymond (like below) will just
return the configured IP itself... the 0.0.0.0.

xymon localhost "hostinfo fields=XMH_HOSTNAME,XMH_IP"


HTH,
-jc




More information about the Xymon mailing list