# + add - adds a specific host group to the instance
#
-use Data::Dumper;
-
use Spong::Host;
use Spong::HostList;
}
} elsif ( $grps eq "ALL" ) {
foreach $group ( keys %main::GROUPS ) {
+ next if $group eq 'all' && ! $main::HOSTGROUPSALL;
my $object = Spong::HostList->new( $group );
if( $object ) { $groups{$group} = $object; }
}
}
}
+
+# These methods all display summary information about only those machines
+# that are currently registering a problem, or that have services that have
+# not been updated (showing purple) - it also relays information about
+# services that have been acknowledged.
+#
+# brief Hostname and "one" color reflecting overall status of the host
+# standard Table showing hosts vs services and the state of each service
+# full Records for each host showing detailed info about the problems
+
+sub display_problems {
+ my( $self, $type, $format ) = @_;
+ my( $purple, $problem, $problems );
+
+ $purple = $problems = 0;
+ $badgroups = new Spong::HostGroups("");
+ foreach my $group ( $self->groups() ) {
+ $problem = 0;
+ my $badhosts = new Spong::HostList("");
+ foreach my $host ( $group->hosts() ) {
+ if ( $host->has_problem() ) {
+ $problem = $problems = 1;
+ $badhosts->add( $host );
+ } elsif ( $host->has_color( "purple" )) {
+ $purple = 1;
+ }
+ }
+ if ( $problem ) {
+ $badhosts->name($group->name());
+ $badgroups->add($badhosts);
+ }
+ }
+
+ if ( $problems ) {
+ foreach my $group ( $badgroups->groups() ) {
+ my $name = $group->name();
+ print "<p><a href=\"$main::WWWSPONG/group/$name\"><b>"
+ if $type eq "html";
+ print "Group: $name\n";
+ print "</b></a><p>" if $type eq "html";
+ $group->display( $type, $format );
+ }
+ } else {
+ if( $format eq "full" ) {
+ if( $purple ) {
+ print "<p><font color=green><b>" if( $type eq "html" );
+ print "No known problems.\n";
+ print "</b></font>" if( $type eq "html" );
+ print "<p><font size=-1 color=purple>" if( $type eq "html" );
+ print "Although some information is out of date which might ";
+ print "indicate a problem.\n";
+ print "</font>" if( $type eq "html" );
+ } else {
+ print "<p><font color=green><b>" if( $type eq "html" );
+ print "No current problems.\n";
+ print "</b></font>" if( $type eq "html" );
+ }
+ }
+ }
+
+}
+
+
1;