From: Stephen L Johnson Date: Mon, 7 Feb 2000 03:23:11 +0000 (+0000) Subject: added support for HostList Summary display using command overview X-Git-Tag: spong-2_7-alpha5~102 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9e76768e9580e29954543eb1a20fc746665c53a;p=spong.git added support for HostList Summary display using command overview --- diff --git a/src/spong-server.pl b/src/spong-server.pl index f6ea842..816371a 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -23,6 +23,7 @@ use Spong::HistoryList; use Spong::History; use Spong::Daemon; use Spong::Log; +use Spong::HostGroups; use Sys::Hostname; use File::Path; @@ -312,6 +313,7 @@ sub listen_for_queries { if( $query eq "info" ) { &show_info( @args ); } if( $query eq "service" ) { &show_service( @args, $other ); } if( $query eq "histservice" ) { &show_hist_service( @args, $other ); } + if( $query eq "overview" ) { &show_overview( @args, $other ); } close( CLIENT ); select $output; @@ -678,6 +680,19 @@ sub show_hist_service { } } +sub show_overview { + my( $hosts, $type, $view, $other ) = @_; + my( $g ); + $other = "ALL" if ! $other; + eval { $g = Spong::HostGroups->new( $other ); }; + if ( $g ) { + print $g->display( $type, $view ); + } else { + print &fmt_error($type,"Invalid request, group $other does not exist"),"\n"; + } + +} + diff --git a/src/www-spong.pl b/src/www-spong.pl index 0b63ff0..9fe5c53 100755 --- a/src/www-spong.pl +++ b/src/www-spong.pl @@ -47,7 +47,7 @@ if( $ENV{'SCRIPT_NAME'} eq "" ) { my %opt; my @options = ( "help", "summary:s", "problems:s", "history:s", "host=s", "services=s", "stats=s", "config=s", "info=s", "service=s", - "histservice=s", + "histservice=s", "overview", "brief", "standard", "full" ); $actionbar = 0; @@ -82,6 +82,8 @@ if( $ENV{'SCRIPT_NAME'} eq "" ) { $opt=1; } + if ( defined $opt{'overview'} ) { &overview( $opt{'overview'} ); $opt= 1; } + if( ! $opt ) { &summary( "all" ); } exit(0); @@ -133,6 +135,8 @@ if( $cmd =~ m!^/service/(.*)/(.*)$! ) { &service( $1, $2 ); exit; } if( $cmd =~ m!^/histservice/(.*)/(.*)/(.*)$! ) { &histservice( $1, "$2 $3" ); exit; } +if( $cmd =~ m!^/overview/(.*)$! ) { &overview( $1 ); exit;} + # Need to do something when an invalid request comes through... exit(0); @@ -380,6 +384,16 @@ sub histservice { $time ); &footer(); } + +sub overview { + my( $other ) = @_; + my $view = $main::view || 'standard'; + + &header(0); + print &query( $SPONGSERVER, "overview", $other, "html", $view ); + &footer(); + +}