[Xymon] host grepping

Henrik Størner henrik at hswn.dk
Sun Jan 19 23:07:20 CET 2014


Den 14-01-2014 16:35, Galen Johnson skrev:
> I'll have a look at that.  However, at first glance, it still requires
> that you know the hostname of the server that you are monitoring.  This
> is a bit problematic for amazon hosted servers that all begin with ec2
> (^ec2).  I am setting up the NAME to be my key for the actual server
> since most of the servers are not in DNS (apparently zenoss can work
> with  amazon using tags which I may end up "re-discovering" for
> myself).

I took this as a suggestion to implement some searching features for 
'hostinfo' and 'xymondboard' commands which I have wanted to do for some 
time.

Essentially, 4.3.14 lets you search on any of the tags defined in 
hosts.cfg. So you can e.g. get all of the hosts.cfg entries whose IP 
begins with 192.168 with

    xymon 127.0.0.1 "hostinfo XMH_IP=^192.168"

or all entries with a NAME containing "iis"

    xymon 127.0.0.1 "hostinfo XMH_DISPLAYNAME=iis"

The XMH_* names are listed in the xymon-xmh(5) man-page.

You can also pick the data that is included in the output. 'hostinfo' by 
default gives you the hostname, the ip and the raw hosts.cfg entry, but 
you can add a "fields" parameter to limit the output:

    xymon 127.0.0.1 "hostinfo tag=^http fields=ip,hostname,matchedtag"

searches for all the hosts that have a tag beginning with "http" (i.e. 
all hosts with a web-check) and outputs the IP, hostname and the 
http-tags that matched the search pattern. Much like xymongrep does.


The change is a bit large for posting to the mailing list, but I plan to 
ship 4.3.14 in a few days - the alert-crashing bug introduced in 4.3.13 
is reason enough for a quick update.


Regards,
Henrik




More information about the Xymon mailing list