Changeset 261


Ignore:
Timestamp:
Jun 25, 2018, 10:25:30 PM (2 years ago)
Author:
g7moreau
Message:
  • Change color-downtime min and max entries to day-min and day-max
Location:
trunk/nagios-velvice
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/nagios-velvice/velvice.cgi

    r260 r261  
    1515use strict;
    1616use warnings;
    17 use version; our $VERSION = version->declare('0.6.5');
     17use version; our $VERSION = version->declare('0.6.6');
    1818
    1919use CGI;
     
    3838$config->{'host-mapping'}                 ||= {};
    3939$config->{'color-downtime'}               ||= {};
    40 $config->{'color-downtime'}{'min'}        ||= 3;
    41 $config->{'color-downtime'}{'max'}        ||= 50;
    42 $config->{'color-downtime'}{'factor'}     ||= 0.7;
     40$config->{'color-downtime'}{'day-min'}    ||= 3;
     41$config->{'color-downtime'}{'day-max'}    ||= 50;
     42$config->{'color-downtime'}{'factor'}     ||=  0.7;
    4343$config->{'remote-action'}                ||= {};
    4444
     
    6464   my ($color, $downtime) = @_;
    6565
    66    $downtime = $downtime - $config->{'color-downtime'}{'min'}; # same color first days
    67    $downtime = $config->{'color-downtime'}{'max'} if $downtime > $config->{'color-downtime'}{'max'}; # max 50 days for color
     66   $downtime = $downtime - $config->{'color-downtime'}{'day-min'}; # same color first days
     67   $downtime = $config->{'color-downtime'}{'day-max'} if $downtime > $config->{'color-downtime'}{'day-max'}; # max 50 days for color
    6868   $downtime =  0 if $downtime <  0;
    6969
    70    my $factor = ($downtime * $config->{'color-downtime'}{'factor'}) / $config->{'color-downtime'}{'max'};
     70   my $factor = ($downtime * $config->{'color-downtime'}{'factor'}) / $config->{'color-downtime'}{'day-max'};
    7171   return Color::Calc::color_light_html($color, $factor);
    7272   }
     
    204204         $interval =  240 if $interval <  240;
    205205         $interval = 3000 if $interval > 3000;
    206          my $future = $now + 20 + int(rand($interval - 20)); # 5 * 60 = 300
     206         my $future = $now + 20 + int(rand($interval - 20)); # 5 * 60 = 300
    207207
    208208         $htmlpage .= " -- <b>CHECK</b> [$now/" . ($future - $now) . "]";
  • trunk/nagios-velvice/velvice.sample.yml

    r256 r261  
    1111
    1212color-downtime:
    13    min:     3
    14    max:    50
    15    factor:  0.7
     13   day-min:  3
     14   day-max: 50
     15   factor:   0.7
    1616
    1717remote-action:
Note: See TracChangeset for help on using the changeset viewer.