added a test to spectre at startup to make sure it can connect to each webgui site

added a spectre ping function which will be useful for monitoring services like nagios and the wremonitor
removed references to the old theme systemm
This commit is contained in:
JT Smith 2006-04-28 15:23:34 +00:00
parent 363404b598
commit 5635534b4c
7 changed files with 151 additions and 23 deletions

View file

@ -19,19 +19,21 @@ use WebGUI::Config;
$|=1; # disable output buffering
my $help;
my $shutdown;
my $ping;
my $daemon;
my $run;
my $debug;
GetOptions(
'help'=>\$help,
'ping'=>\$ping,
'shutdown'=>\$shutdown,
'daemon'=>\$daemon,
'debug' =>\$debug,
'run' => \$run
);
if ($help || !($shutdown||$daemon||$run)) {
if ($help || !($ping||$shutdown||$daemon||$run)) {
print <<STOP;
S.P.E.C.T.R.E. is the Supervisor of Perplexing Event-handling Contraptions for
@ -49,6 +51,8 @@ if ($help || !($shutdown||$daemon||$run)) {
debug to standard out so that you can see exactly what
it's doing.
--ping Checks to see if Spectre is alive.
--run Starts Spectre without forking it as a daemon.
--shutdown Stops the running Spectre server.
@ -81,6 +85,18 @@ if ($shutdown) {
my $result = $remote->post('admin/shutdown');
die $POE::Component::IKC::ClientLite::error unless defined $result;
undef $remote;
} elsif ($ping) {
my $remote = create_ikc_client(
port=>$config->get("port"),
ip=>'127.0.0.1',
name=>rand(100000),
timeout=>10
);
die $POE::Component::IKC::ClientLite::error unless $remote;
my $result = $remote->post_respond('admin/ping');
die $POE::Component::IKC::ClientLite::error unless defined $result;
print "Spectre is Alive!\n" if ($result eq "pong");
undef $remote;
} elsif ($run) {
Spectre::Admin->new($config, $debug);
} elsif ($daemon) {