\n"; } &show_button(); print &ui_hr(); print &ui_buttons_start(); if ($access{'sched'}) { # Open scheduled monitoring form print &ui_buttons_row("edit_sched.cgi", $text{'index_sched'}, $text{'index_scheddesc'}); } if ($access{'edit'}) { # Email templates button print &ui_buttons_row("list_tmpls.cgi", $text{'index_tmpls'}, $text{'index_tmplsdesc'}); } if (!$config{'index_status'}) { # Refresh now print &ui_buttons_row("refresh.cgi", $text{'index_refresh'}, $text{'index_refreshdesc'}); } print "\n"; &remote_finished(); &ui_print_footer("/", $text{'index'}); sub service_table { # Table header local @tds = $access{'edit'} ? ( "width=5" ) : ( ); print &ui_columns_start([ $access{'edit'} ? ( "" ) : ( ), $text{'index_desc'}, $text{'index_host'}, $config{'index_status'} ? ( $text{'index_up'} ) : $oldstatus ? ( $text{'index_last'} ) : ( ), ], 100, 0, \@tds); # One row per monitor foreach $s (@_) { local @cols; local $esc = &html_escape($s->{'desc'}); $esc = "$esc" if ($s->{'nosched'} == 1); if ($access{'edit'}) { push(@cols, &ui_link("edit_mon.cgi?id=$s->{'id'}",$esc)); } else { push(@cols, $esc); } push(@cols, &nice_remotes($s)); # Work out and show all the up icons local @ups; if ($config{'index_status'}) { # Showing the current status .. first check dependency @stats = &service_status($s, 1); if ($s->{'depend'}) { $ds = &get_service($s->{'depend'}); if ($ds) { @dstats = &service_status($ds, 1); if ($dstats[0]->{'up'} != 1) { @stats = map { { 'up' => -4 } } @stats; } } } @ups = map { $_->{'up'} } @stats; @remotes = map { $_->{'remote'} } @stats; } elsif ($oldstatus) { # Getting status from last check $stat = &expand_oldstatus($oldstatus{$s->{'id'}}); @remotes = &expand_remotes($s); @ups = map { defined($stat->{$_}) ? ( $stat->{$_} ) : ( ) } @remotes; } if (!@ups) { push(@cols, ""); } else { local @icons; for(my $i=0; $i<@ups; $i++) { $up = $ups[$i]; $h = $remotes[$i]; $h = $text{'index_local'} if ($h eq '*'); push(@icons, ""); } push(@cols, join("", @icons)); } if ($access{'edit'}) { print &ui_checked_columns_row(\@cols, \@tds, "d", $s->{'id'}); } else { print &ui_columns_row(\@cols, \@tds); } } print &ui_columns_end(); } sub show_button { if ($access{'edit'}) { print &ui_form_start("edit_mon.cgi"); print &ui_submit($text{'index_madd'}); my @opts; foreach $h (sort { $a->[1] cmp $b->[1] } &list_handlers()) { if (!$h->[2]) { push(@opts, [ $h->[0], $h->[1] ]); } } print &ui_select("type", undef, \@opts); print &ui_form_end(); } }