Xymon Mailing List Archive search

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

4 messages in this thread

list Elizabeth Schwartz · Tue, 17 May 2011 21:32:36 -0400 ·
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
list Vernon Everett · Wed, 18 May 2011 09:56:22 +0800 ·
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
quoted from 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

list Jason Kincl · Wed, 18 May 2011 07:46:17 -0500 ·
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. 
quoted from Vernon Everett
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
list David W Gore · Wed, 18 May 2011 23:31:51 +0000 ·
My solution, which I have implemented for quite a number of tests, is to
do something similar to what xymon already does which is to use the
xymon message client file.

For instance add a section to hobbitclient-sunos.sh, Solaris client used
as an example:

echo [Qdata]
cat my/q_file_results.txt # be careful what you do here if it is a
script or something that can potentially hang the client look at the
vmstat and iostat lines

From the server:

Using PERL as an example scripting language:
	
	foreach my $host ( @hostList )
      {
      	@qData = `path2/bin/xymon localhost "clientlog $host
section=Qdata"`;
	}

Here is an example from the command line:

xymon at xymon1> ~/server/bin/xymon localhost "clientlog xymon1
section=who"
[xymon at xymon1 all]$ ~/server/bin/xymon localhost "clientlog xymon1
section=who"

[who]
xymon    pts/0        May 18 22:48 (10.2.3.4)

Just make your own section on all the clients in the
hobbitclient-[OS].sh script.

~David

-----Original Message-----
From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf
Of Jason Kincl
Sent: Wednesday, May 18, 2011 12:46
To: Xymon
Subject: Re: [Xymon] Elegant way to run an aggregate ext test over
multipleclients?
quoted from Jason Kincl

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=ql
ength
quoted from Jason Kincl
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