On Tue, June 23, 2015 12:50 pm, Mark Felder wrote:
On Tue, Jun 23, 2015, at 13:57, Thomas Eckert wrote:
Brothers,
currently Iâm building a fronted for the various query-commands that can be sent to
xymond. It is still in itâs early stages but I found myself using it daily already. So others may benefit too.Itâs named
xymonq(âxymon queryâ).Two examples may give a basic idea:
- Get a list of hosts on page
dc1: Traditionally this looks like this:$ xymon 127.0.0.1 "xymondboard page=dc1 test=info fields=hostname"
With xymonq
$ xymonq -P dc1 -L
- Get disk information this group of hosts:
$ for my_host in $(xymon 127.0.0.1 "xymondboard page=dc1 test=info fields=hostname"); do echo âHOST=$my_host" xymon 127.0.0.1 "xymondlog $my_host.disk" done
And again the short version with xymonq:
$ xymonq -q clientlog -P dc1 -s df
More information and download here: http://www.it-eckert.com/software/xymonq/ <http://www.it-eckert.com/software/xymonq/>
Feedback welcome!
This looks really useful. Thanks!!
Nifty!
One thing that might be useful is a sort of large-volume mode, optionally shifting some of the processing from separate TCP xymond queries to a local grep string, at the expense of network transfer instead.
We often use a perl one-liner (normally in a scriptlet, but on the CL here) to re-wrap the resulting test message into newlines with the hostname pre-pended on each line. Since it's a pipe, it's quick, and this lets us grep lines after the fact:
]$ xymon localhost "xymondboard test=disk fields=hostname,msg" | perl -ne 'm/^(\S+)|/ and $meh=$1 and s/(\\n|<br\/>)/\n$meh: /g and print;' | grep /boot
server01.example.com|status: /dev/sda1 495844 39330 430914
9% /boot
server02.example.com|status: /dev/sda1 99150 62675 31355
67% /boot
server03.example.com|status: /dev/sda1 99150 60628 33402
65% /boot
server04.example.com|status: /dev/sda1 99150 62856 31174
67% /boot
etc... (The "<br>" check is so we can use this for HTML content returned in an HTTP check too.)
-jc