Xymon Mailing List Archive search

Elegant way to run an aggregate ext test over multiple clients?

list Jason Kincl
Wed, 18 May 2011 07:46:17 -0500
Message-Id: <user-8e6e5d8ee8d3@xymon.invalid>

Another option could be to send your Q message as a "data" message instead of a "status" message, then set up a xymon_channel on the server that listens for data messages and when you see your Q data message come along, to do the calculations and report a single status back to xymon. The webpage scraping is probably easier though, but I just thought of it and wanted to bounce the idea. 
On May 17, 2011, at 8:56 PM, Vernon Everett wrote:
That's probably how I would do it.
I have done something similar to this before, but I no longer have
access to the code.

You need to get all the values together in one script, and grabbing
the web page is a pretty quick and easy way to do so.
A command you may find useful, is this
sed -e :a -e 's/<[^>]*>//g;/</N;//ba'
It will strip most HTML tags, making parsing a lot easier.
However, if Q is being graphed, it will already be on a line by
itself, so you may be able to simply
grep "^Q=[1-9][0-9]*$"
or
grep "^Q:[1-9][0-9]*$"
Depending on how your scripts send the data.

Hope it works..
   Vernon


On Wed, May 18, 2011 at 9:32 AM, Elizabeth Schwartz
<user-c61747246f66@xymon.invalid> wrote:
Suppose I have a five-server cluster, and on each server there's a
calculated value, call it Q, and an ext test "qlength" that operates
on Q and returns a color and a message containing Q.

We want to make a server-side test that does some alerting based on
aggregate values of Q across all five servers in the cluster. Not a
combo test, we want to do math, like Sum (Q1...Qn) >Threshold.


*One* way to get Q for each server is to write a server-side ext test
that loops a wget over each host, something like:

      wget  /dev/null
http://xymon/xymon-cgi/svcstatus.sh\?HOST=myhost.example.com\&SERVICE=qlength

then parse each server's Q info out of the html and do my arithmetic,
but is there a more direct way?

thanks for any pointers clues or code snippets
Betsy

Jason