[Xymon] Xymon Digest, Vol 23, Issue 13

Steff Watkins s.watkins at nhm.ac.uk
Fri Dec 14 13:20:36 CET 2012


> Message: 1
> Date: Thu, 13 Dec 2012 14:58:06 +0000
> From: K?rfer, Thomas <t.koerfer at gevasys.de>
> To: 'Claessens Jurgen' <Jurgen.Claessens at cegeka.be>,
> 	"'xymon at xymon.com'"	<xymon at xymon.com>
> Subject: Re: [Xymon] multiple content checks in one column
> Message-ID:
> 	<6CFF4C170D04D1449B04463D52476E0E794E46 at exchange2010.gevas
> ys.intern>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> The combo test is not realy what I need.
> My problem is, that there are round about 20 content tests on one service
> and up to 5 services on one host, what results in an output of 100 columns for
> tests of this one host.
> The host page looks realy strange with a host of hundreds of columns.
> 
> That's why I would like to combine the service based content tests to one
> group / column with an output like a multiple http test - if this is possible.
> 
> b.r.
> TK

Sorry if I haven't picked up on all the details here, I haven't had the time to keep track of what's happening on list all that closely.

The interactives dept here have a requirement to check multiple independent local web resources but they want it all to be under one test, with one set of warnings. They want the actual webpages/resources to be tested rather than a blanket "is the webserver up?" type test.

The end result is a script that picks up the list of URLs to test and then runs a HTTP::Request (from the Perl module) to determine whether the actual URI is valid and available.

It collates all the individual results into an array and as each result comes in, it is checked to see if it is an alert state or not. If it is an alert state, then a status global is set to 'RED'.

This output is collected together and wrapped up in HTML. The first line of output gives the status global which is what the server picks up on to determine whether the test is red/green.

At the end of the tests,  the script then calls the server/bin/bb binary with the details of the Xymon server and dumps the prettified test output to the server. This is held on the server and included in the test's page on Hobbit.

The following is the format/output section of the script (forgive the kludgeyness of it, it's meant to be more functional than pretty):

-------
@TestResults = ();
$MainResult='GREEN';

# Go through the list of URLs, one at a time, putting the chosen URL into $wpage
foreach $wpage (@pages) {

... put the various webserver/remote system tests and checks in here

# If the result is a '200 OK' or a '302 Found' then the webpage is 'present'
  if (($results =~ /200/) || ($results =~ /302/))
  {
   $Outline="&green $wpage  Success\r\n";
   push(@TestResults,$Outline);
  }
# If result != [200|302] then unhappy webpage! :(
  else
  {
   $Outline="&red $wpage  Fail[$results]\r\n";
   push(@TestResults,$Outline);
   $MainResult='RED';
  }
 }

# At this point we have an array @TestResults containing all the results of
# the webpage checks. We now need to pass that info up to the xymon system

# Get the current date/time
 $testdate=`date`;
 chomp($testdate);

# Now format the report line that goes back to the xymon system.
$LineOut="'status webcheck.webcheck $MainResult $testdate - webcheck $MainResult\n\n";

# Add the results of the webpage tests
foreach $Line1 (@TestResults) {
 $LineOut = $LineOut . $Line1."\n";
}

# Now make up the commandline and execute it
$Args=("/usr/local/hobbit/server/bin/bb $XymonServerIPAddr "."$LineOut");
system($Args);
-------

It's  not elegant but it is functional. It's installed on and is driven by the xymon server which causes the results pages to properly map into each other.

So basically you're running your own tests, collecting and formatting the output of which the first line is the important "status handshake" with the Xymon server and then using Xymon's own utilities (server/bin/bb) to transfer that output back to the server.

By doing this I currently have about 40 individual webpages and resources being checked but only one status (webcheck.webcheck) and one Xymon page gets changed.

Apologies if I've not understood your request correctly. You're welcome to use part or all of the code above in your own projects if you choose.

Regards,
Steff Watkins

-----
Steff Watkins                   Natural History Museum, Cromwell Road, London,SW75BD
Systems programmer               Email: s.watkins at nhm.ac.uk
Systems Team                     Phone: +44 (0)20 7942 6000 opt 2
========
"Many were increasingly of the opinion that they'd all made a big mistake in coming down from the trees in the first place. And some said that even the trees had been a bad move, and that no one should ever have left the oceans." - HHGTTG





More information about the Xymon mailing list