[Xymon] host grepping

Galen Johnson Galen.Johnson at sas.com
Wed Jan 15 04:56:45 CET 2014


Actually, I think this will make my sed command more sane.  I can at least be sure that splitting on the pipe will ensure I have a complete section regardless of whitespace.

=G=

________________________________
From: Galen Johnson
Sent: Tuesday, January 14, 2014 10:35 AM
To: Jeremy Laidman
Cc: John Thurston; xymon at xymon.com
Subject: RE: [Xymon] host grepping

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).  Here is what I ended up doing (yet it's kludgey and could like be done better using an awk script but my awk is very rusty)...

XYMONCFG=$XYMON_HOME/server/bin/xymoncfg
XYMON_NAME=`$XYMONCFG | $GREP $BBHOSTNAME | $SED -e 's/ /\n/g' | grep NAME`

yes...that is ugly and will likely suck for anything but my particular case.  That's why I was hoping xymongrep could be extended to handle grepping for more than just test names.

=G=

________________________________
From: Jeremy Laidman <jlaidman at rebel-it.com.au>
Sent: Tuesday, January 14, 2014 12:27 AM
To: Galen Johnson
Cc: John Thurston; xymon at xymon.com
Subject: Re: [Xymon] host grepping

On 10 January 2014 10:01, Galen Johnson <Galen.Johnson at sas.com<mailto:Galen.Johnson at sas.com>> wrote:
Feature request: It would be handy to have xymongrep handle more than just test lookups to save some scripting time.  I think it would be awesome if it was extended to allow you to reference a host and have it return the tests for just that host (especially when it may be spread across multiple entries) and allow an argument to get the CLIENT, NAME or other modifier as needed.

Does this help:

$ $XYMON $XYMSRV 'hostinfo host=^hostname'
hostname.example.com<http://hostname.example.com>|192.168.67.101|testip|delayred=dns:15,conn:15|delayyellow=dns:10,conn:10|dns=SOA:example.com<http://example.com>|TRENDS:*,vmstat:vmstat\pvmstat3


>From the "xymon" man page:

       hostinfo [CRITERIA]
              Retrieves the current configuration of a  host  (i.e.
              the  hosts.cfg(5) definition). CRITERIA selects which
              host(s) to report, and is identical to  the  CRITERIA
              in the xymondboard command.

              The  response  is one line for each host that matches
              the CRITERIA, or all hosts if no criteria  is  speci-
              fied.  The  line  is  composed of a number of fields,
              separated by a pipe-sign. The first two  fields  will
              always  be  the  hostname  and  the  IP-address.  The
              remaining fields - if any - are the hosts.cfg tags in
              no particular order.

I like this one because a client can query its own configuration remotely, or the test and configuration functions of the Xymon server can (potentially) be distributed.

J

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140115/32c9ca97/attachment.html>


More information about the Xymon mailing list