FuncNet simple test

This is a test of the FuncNet service.
Test filesDownload the files for this test
Test runRun test now
Support reference#202-331
This test script actually just queries the last results of the same monitoring program we use to populate the online status page at
http://funcnet.eu/current-status/
and returns a success, warning or error value appropriately. If the last test was performed more than half an hour ago, a warning is raised even if it passed.
Show/hide recent test logs
view log 5 days agoWARNING

Test began: 2012-05-14 10:27:56 Test ended: 2012-05-14 10:27:56 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 1 week agoWARNING

Test began: 2012-05-11 22:55:08 Test ended: 2012-05-11 22:55:09 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 2 weeks agoWARNING

Test began: 2012-05-07 18:12:39 Test ended: 2012-05-07 18:12:40 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 3 weeks agoWARNING

Test began: 2012-04-26 07:44:25 Test ended: 2012-04-26 07:44:26 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 4 weeks agoWARNING

Test began: 2012-04-22 13:00:08 Test ended: 2012-04-22 13:00:08 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 4 weeks agoWARNING

Test began: 2012-04-20 21:02:26 Test ended: 2012-04-20 21:02:27 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 1 month agoWARNING

Test began: 2012-04-18 10:17:39 Test ended: 2012-04-18 10:17:40 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 1 month agoWARNING

Test began: 2012-04-15 23:09:50 Test ended: 2012-04-15 23:09:50 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 1 month agoWARNING

Test began: 2012-04-12 23:43:29 Test ended: 2012-04-12 23:43:30 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
view log 1 month agoWARNING

Test began: 2012-04-10 19:53:18 Test ended: 2012-04-10 19:53:19 Result : Test warning ------ stderr and stdout follow ------ The front-end service is showing a status of TIMEOUTDownload this log...
This test consists of the following files:
frontend_registry_test.pl
#!/usr/bin/perl
# Checks the status of the last registry test and reports appropriately.
use warnings;
use strict;
use XML::XPath;
use XML::XPath::XMLParser;
use LWP::UserAgent;
use Date::Manip;
# Get the output from the last status check
my $ua = LWP::UserAgent->new;
my $monitor_url = "http://gene3d.biochem.ucl.ac.uk:8090/FuncNetServiceMonitor/service-monitor.xml";
my $response = $ua->get( $monitor_url );
unless( $response->is_success )
{
warn "Could not retrieve $monitor_url: ", $response->status_line, "\n";
exit 2;
}
my $xpath = XML::XPath->new( xml => $response->content );
# Get the time at which the service was last tested
my $nodeset = $xpath->find( '/services/service[name="FrontEndService"]/timestamp/text()' );
my @nodes = $nodeset->get_nodelist;
if( @nodes > 1 )
{
warn "Found more than one matching timestamp node\n";
exit 3;
}
if( @nodes == 0 )
{
warn "Found no matching timestamp node\n";
exit 4;
}
# We will check to see if the last status test was more than 30mins ago,
# but we won't actually perform this until we've tested for actual errors
my $timestamp = ParseDateString( XML::XPath::XMLParser::as_string( $nodes[ 0 ] ) );
my $half_an_hour_ago = DateCalc( "now", "- 30minutes" );
# Get the actual status node
$nodeset = $xpath->find( '/services/service[name="FrontEndService"]/status/text()' );
@nodes = $nodeset->get_nodelist;
if( @nodes > 1 )
{
warn "Found more than one matching status node\n";
exit 5;
}
if( @nodes == 0 )
{
warn "Found no matching status node\n";
exit 6;
}
my $status = XML::XPath::XMLParser::as_string( $nodes[ 0 ] );
if( $status ne 'OK' )
{
warn "The front-end service is showing a status of $status\n";
if( $status eq 'ERROR' )
{
exit 1;
}
else
{
exit 7;
}
}
# Now look at time of test -- warning if too old
if( Date_Cmp( $timestamp, $half_an_hour_ago ) < 0 )
{
warn "The service shows OK but the status test was last performed at "
. UnixDate( $timestamp, "%T on %A the %E of %B, %Y" ) . "\n";
exit 8;
}
»
- Login to post comments