]> git.etc.gen.nz Git - spong.git/commitdiff
added support for HostList Summary display using command overview
authorStephen L Johnson <sjohnson@monsters.org>
Mon, 7 Feb 2000 03:23:11 +0000 (03:23 +0000)
committerStephen L Johnson <sjohnson@monsters.org>
Mon, 7 Feb 2000 03:23:11 +0000 (03:23 +0000)
src/spong-server.pl
src/www-spong.pl

index f6ea8428c1b2cefdce6d6592704b8e1e8cb09072..816371aac9aee4e359b17f6a185ba8b149e5a9b7 100755 (executable)
@@ -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";
+   }
+
+}
+
 
 
 
index 0b63ff0b1b019c5a0ecfbb3281848bc96ea7052a..9fe5c533bc220fd94a753c5f73cd72215b6d8268 100755 (executable)
@@ -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();
+
+}