$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 = "";
# 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; }
print "Content-type: text/html\n\n";
print "<html><head>\n";
- print "<title>Spong v2.6 - System Status Monitor</title></head>\n";
+ print "<title>Spong v$SPONGVER - System Status Monitor</title></head>\n";
print "<frameset cols=\"240,*\" border=5 frameboard=no>";
print "<frame src=\"$main::WWWSPONG/commands/$group\" marginwidth=5 ";
print "marginheight=5 noshade>\n";
print "</noframes>\n</html>\n";
}
+sub ovinteractive {
+ my $group = shift;
+
+ print "Content-type: text/html\n\n";
+ print "<html><head>\n";
+ print "<title>Spong v$SPONGVER - System Status Monitor</title></head>\n";
+ print "<frameset cols=\"240,*\" border=5 frameboard=no>";
+ print "<frame src=\"$main::WWWSPONG/ovcommands/\" marginwidth=5 ";
+ print "marginheight=5 noshade>\n";
+ print "<frame src=\"$main::WWWSPONG/ioverview/\" marginwidth=10 ";
+ print "marginheight=5 noshade name=\"right\" border=1>\n";
+ print "</frameset>\n";
+ print "<noframe>\n";
+ print "Frameless version not currently available.\n";
+ print "</noframes>\n</html>\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.
&header( 1 );
print "<base target=right>\n";
- print "<font size=+2><b>Spong v2.6</b></font>\n";
+ print "<font size=+2><b>Spong v$SPONGVER</b></font>\n";
print "<hr>\n";
print "<a href=\"$main::WWWACK\">Ack</a> || \n";
}
+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 "<base target=right>\n";
+ print "<font size=+2><b>Spong v$SPONGVER</b></font>\n";
+ print "<hr>\n";
+
+ print "<a href=\"$me/ioverview/\">Groups</a> || \n";
+ print "<a href=\"$me/iovsummary/\">Group Summary</a> || \n";
+ print "<a href=\"$me/group/all\" target=\"_top\">Hosts</a> \n";
+ print "<hr>\n";
+
+ print "<a href=\"$main::WWWACK\">Ack</a> || \n";
+# print "<a href=\"$me/isummary/$group\">Summary</a> || \n";
+ print "<a href=\"$me/ihistory/all\">History</a> || \n";
+ print "<a href=\"$me/help\">Help</a>\n";
+ print "<hr>\n<p>\n";
+
+ &ovproblems( $group );
+
+# print "<p><hr><a href=\"$me/groups\">Group</a>: <b>$gname</b>\n<hr>\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
&footer();
}
+sub ioverview {
+ my $group = shift;
+# my $gname = $main::GROUPS{$group}->{'name'} if $main::GROUPS{$group};
+# $gname = "Selected Hosts" unless $gname;
+
+ &header( 1 );
+ print "<font size=+2><b>Host Groups</b></font>\n<hr>\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 "<font size=+2><b>Host Groups Summary</b></font>\n<hr>\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
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 );