Changeset 320
- Timestamp:
- Jul 20, 2018, 1:43:36 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nagios-velvice/velvice.cgi
r319 r320 65 65 66 66 sub alertcolor { 67 my ($color, $downtime) = @_; 67 my ($status, $downtime) = @_; 68 69 my %STATUS_DB = ( 70 CRITICAL => {id => 3, color => '#F88888'} 71 WARNING => {id => 2, color => '#FFFF00'} 72 PENDING => {id => 1, color => '#E0E0E0'} 73 ); 74 75 my $color = '#0000FF'; 76 $color = $STATUS_DB{$status}->{'color'} if exists $STATUS_DB{$status}; 68 77 69 78 $downtime = $downtime - $config->{'color-downtime'}{'day-min'}; # same color first days … … 107 116 108 117 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 ); 118 my $color = alertcolor($status, $downtime); 117 119 118 120 my $status_id = 0; 119 $status_id = $ status_db{$status} if exists $status_db{$status};121 $status_id = $STATUS_DB{$status}->{'id'} if exists $STATUS_DB{$status}; 120 122 121 123 #$hostcount{$host}++; … … 201 203 my $output = HTML::Entities::encode($srv->plugin_output) =~ s/^[A-Z_\s]+?[:-]//r; 202 204 203 my $color = $status eq 'CRITICAL' ? '#F88888' : '#FFFF00'; 204 $color = alertcolor($color, $downtime); 205 my $color = alertcolor($status, $downtime); 205 206 my $stylecolor = "style='background:$color;'"; 206 207 $htmlpage .= " <tr>\n"; … … 280 281 my $hostname = $host_stat->host_name; 281 282 my $downtime = downtime($host_stat->last_state_change); 282 my $color = alertcolor(' #F88888', $downtime);283 my $color = alertcolor('CRITICAL', $downtime); 283 284 $htmlpage .= " <tr style='background:$color'>\n"; 284 285 $htmlpage .= " <td><a class='hoop' href=\"$config->{'nagios-server'}{'status-cgi'}?host=" . uri_encode($hostname) . "\">$hostname</a></td>\n";
Note: See TracChangeset
for help on using the changeset viewer.