[Bio] / FigWebServices / server_check.cgi Repository:
ViewVC logotype

View of /FigWebServices/server_check.cgi

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (annotate)
Wed Jul 13 19:08:36 2005 UTC (14 years, 8 months ago) by olson
Branch: MAIN
Check the status of the SEED server. Return an HTTP error code if there is a problem.

Used for nagios monitoring of SEED servers.

# Check to see if the SEED server is up and running.

use FIG;
use CGI;
use strict;

my $cgi = new CGI;

my $fig;
eval {
    $fig = new FIG;

if ($@)
    my $err = $@;
    # Cannot create a FIG, often happens if the database is down.

    if ($err =~ /Could not connect to DBI:.*could not connect to server/)
	print $cgi->header(-status => "501 Database not available $FIG_Config::dbms $FIG_Config::db $FIG_Config::dbport");
	print $cgi->p("Could not connect to relational database of type $FIG_Config::dbms named $FIG_Config::db on port $FIG_Config::dbport.");
	my $e = $err;
	$e =~ s/\n.*$//;
	print $cgi->header(-status => "502 Error constructing FIG: $e");
	print $cgi->p("Could not construct fig object:");
	print $cgi->pre($err);


print $cgi->header();
print $cgi->p("Server OK");
print "\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3