From beab331fda840f542ac88ec147bc76f39ddc497a Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Thu, 24 Feb 2000 15:19:00 +0000 Subject: [PATCH] added interactive functions for host group overview displays --- src/www-spong.pl | 96 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 6 deletions(-) diff --git a/src/www-spong.pl b/src/www-spong.pl index 20be114..e41dc7b 100755 --- a/src/www-spong.pl +++ b/src/www-spong.pl @@ -24,6 +24,7 @@ $|++; $conf_file = "@@ETCDIR@@/spong.conf"; $hosts_file = "@@ETCDIR@@/spong.hosts"; $groups_file = "@@ETCDIR@@/spong.groups"; +$SPONGVER = "@@VER@@"; ($HOST) = gethostbyname(&Sys::Hostname::hostname()); $HOST =~ tr/A-Z/a-z/; $view = ""; @@ -102,10 +103,18 @@ $cmd = $ENV{'PATH_INFO'}; # Commands that are more applicable to spong running in interactive mode. # These commands control the frame interface, etc... -if( $cmd eq "" || $cmd eq "/" ) { &interactive( "all" ); exit; } +if( $cmd eq "" || $cmd eq "/" ) { + &interactive( "all" ) if $main::SPONG_DEFAULT_VIEW eq "HOST"; + &ovinteractive( "all" ) if $main::SPONG_DEFAULT_VIEW eq "OVERVIEW"; + exit; +} if( $cmd =~ m!^/group/(.*)$! ) { &interactive( $1 ); exit; } if( $cmd =~ m!^/commands/(.*)$! ) { &commands( $1 ); exit; } +if( $cmd =~ m!^/ovcommands/(.*)$! ) { &ovcommands( $1 ); exit; } +if( $cmd =~ m!^/ioverview/(.*)$! ) { &ioverview( $1 ); exit; } +if( $cmd =~ m!^/iovsummary/(.*)$! ) { &iovsummary( $1 ); exit; } + if( $cmd =~ m!^/isummary/(.*)$! ) { &isummary( $1 ); exit; } if( $cmd =~ m!^/ihistory/(.*)$! ) { &ihistory( $1 ); exit; } @@ -157,7 +166,7 @@ sub interactive { print "Content-type: text/html\n\n"; print "\n"; - print "Spong v2.6 - System Status Monitor\n"; + print "Spong v$SPONGVER - System Status Monitor\n"; print ""; print "\n"; @@ -169,6 +178,23 @@ sub interactive { print "\n\n"; } +sub ovinteractive { + my $group = shift; + + print "Content-type: text/html\n\n"; + print "\n"; + print "Spong v$SPONGVER - System Status Monitor\n"; + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "Frameless version not currently available.\n"; + print "\n\n"; +} + # This function fills out the action bar of the interactive spong display. # This lists the functions that you can perform via the web interface. @@ -183,7 +209,7 @@ sub commands { &header( 1 ); print "\n"; - print "Spong v2.6\n"; + print "Spong v$SPONGVER\n"; print "
\n"; print "Ack || \n"; @@ -200,6 +226,39 @@ sub commands { } +sub ovcommands { + my $group = shift; + my $me = $main::WWWSPONG; + + $group = "all" unless $group; +# my $gname = $main::GROUPS{$group}->{'name'} if $main::GROUPS{$group}; +# $gname = "Selected Hosts" unless $gname; + + &header( 1 ); + + print "\n"; + print "Spong v$SPONGVER\n"; + print "
\n"; + + print "Groups || \n"; + print "Group Summary || \n"; + print "Hosts \n"; + print "
\n"; + + print "Ack || \n"; +# print "Summary || \n"; + print "History || \n"; + print "Help\n"; + print "
\n

\n"; + + &ovproblems( $group ); + +# print "


Group: $gname\n
\n"; + print "Updated at ", POSIX::strftime( "%H:%M, on %D", localtime() ), "\n"; + &footer(); +} + + # A couple of slightly different functions to display summary and history # information for people using the wwwspong program interactivly. This just # puts a little header above each output, so that you know what group it @@ -227,6 +286,31 @@ sub ihistory { &footer(); } +sub ioverview { + my $group = shift; +# my $gname = $main::GROUPS{$group}->{'name'} if $main::GROUPS{$group}; +# $gname = "Selected Hosts" unless $gname; + + &header( 1 ); + print "Host Groups\n
\n"; + $main::view = "full"; + &overview($group); + &footer(); +} + +sub iovsummary { + my $group = shift; +# my $gname = $main::GROUPS{$group}->{'name'} if $main::GROUPS{$group}; +# $gname = "Selected Hosts" unless $gname; + + &header( 1 ); + print "Host Groups Summary\n
\n"; + $view = "standard"; + &overview($group); + &footer(); +} + + # This provides a page that lists the groups that are defined in spong, and # you can select a group to monitor (summary information will then only be @@ -389,17 +473,17 @@ sub histservice { sub overview { my( $other ) = @_; - my $view = $main::view || 'standard'; + my $view = $main::view || 'full'; &header(0); - print &query( $SPONGSERVER, "overview", $other, "html", $view ); + print &query( $SPONGSERVER, "overview", '', "html", $view, $other); &footer(); } sub ovproblems { my( $other ) = @_; - my $view = $main::view || 'standard'; + my $view = $main::view || 'full'; &header(0); print &query( $SPONGSERVER, "ovproblems", $other, "html", $view ); -- 2.30.2