Changeset 319
- Timestamp:
- Jul 20, 2018, 12:24:13 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nagios-velvice/velvice.cgi
r293 r319 15 15 use strict; 16 16 use warnings; 17 use version; our $VERSION = version->declare('0.8. 9');17 use version; our $VERSION = version->declare('0.8.10'); 18 18 19 19 use CGI; … … 98 98 }} 99 99 100 SRV: 100 101 for my $srv ($log->list_services_on_host($host)) { 101 if ($log->service($host, $srv)->status ne 'OK') { 102 push @serviceproblems, $log->service($host, $srv); 103 $hostcount{$host}++; 102 my $status = $log->service($host, $srv)->status; 103 104 next SRV if $status eq 'OK'; 105 106 push @serviceproblems, $log->service($host, $srv); 107 108 my $downtime = downtime($log->service($host, $srv)->last_state_change); 109 my $color = $status eq 'CRITICAL' ? '#F88888' : '#FFFF00'; 110 $color = alertcolor($color, $downtime); 111 112 my %status_db = ( 113 CRITICAL => 3, 114 WARNING => 2, 115 PENDING => 1, 116 ); 117 118 my $status_id = 0; 119 $status_id = $status_db{$status} if exists $status_db{$status}; 120 121 #$hostcount{$host}++; 122 $hostcount{$host} ||= {count => 0, color => $color, status_id => $status_id, downtime => $downtime}; 123 $hostcount{$host}->{'count'}++; 124 if (($status_id >= $hostcount{$host}->{'status_id'}) and ($downtime < $hostcount{$host}->{'downtime'})) { 125 $hostcount{$host}->{'downtime'} = $downtime; 126 $hostcount{$host}->{'status_id'} = $status_id; 127 $hostcount{$host}->{'color'} = $color; 104 128 } 105 129 } … … 182 206 $htmlpage .= " <tr>\n"; 183 207 if ($hostname ne $current_host) { 184 $current_host = $hostname; 185 $htmlpage .= " <td $stylecolor rowspan='$hostcount{$hostname}'>" 208 $current_host = $hostname; 209 my $rowspan = $hostcount{$hostname}->{'count'}; 210 my $rowcolor = "style='background:" . $hostcount{$hostname}->{'color'} . ";'"; 211 $htmlpage .= " <td $rowcolor rowspan='$rowspan'>" 186 212 . "<a href=\"$cgi_script_name?check=" . uri_encode($hostname) . '">↯</a></td>' . "\n"; 187 $htmlpage .= " <td $ stylecolor class='hoop' rowspan='$hostcount{$hostname}'>"213 $htmlpage .= " <td $rowcolor class='hoop' rowspan='$rowspan'>" 188 214 . "<a href=\"$config->{'nagios-server'}{'status-cgi'}?host=" . uri_encode($hostname) . "\">$hostname</a></td>\n"; 189 215 }
Note: See TracChangeset
for help on using the changeset viewer.