summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobi Oetiker <tobi@oetiker.ch>2007-05-30 14:34:09 +0200
committerTobi Oetiker <tobi@oetiker.ch>2007-05-30 14:34:09 +0200
commit1bdc6ae9270bf77bc983ef661142c89e12464466 (patch)
tree9ca923cf03c10661ae0d7d7f1f0415642fe31208
parent72804714f5a4a15706215c0ea3f0b4a288b3428f (diff)
downloadsmokeping-1bdc6ae9270bf77bc983ef661142c89e12464466.tar.gz
smokeping-1bdc6ae9270bf77bc983ef661142c89e12464466.tar.xz
draw smoke properly even when there is a lot of loss
-rw-r--r--CHANGES2
-rw-r--r--lib/Smokeping.pm16
2 files changed, 10 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 59807ea..9fc15b9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+* fixed smoke when there is a lot of 'loss' -- tobi
+
* do not use 127.0.0.1 when testing echoping and curl functionality. There may be someone
behind this address. -- Michael Hanselmann public hansmi ch
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index 6676a40..36e97d6 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -697,13 +697,13 @@ sub smokecol ($) {
return [] unless $count > 2;
my $half = $count/2;
my @items;
- for (my $i=$count; $i > $half; $i--){
- my $color = int(190/$half * ($i-$half))+50;
- push @items, "AREA:cp".($i)."#".(sprintf("%02x",$color) x 3);
- };
- for (my $i=int($half); $i > 0; $i--){
- my $color = int(190/$half * ($half - $i + 1))+64;
- push @items, "AREA:cp".($i)."#".(sprintf("%02x",$color) x 3);
+ my $itop=$count;
+ my $ibot=1;
+ for (; $itop > $ibot; $itop--,$ibot++){
+ my $color = int(190/$half * ($half-$ibot))+50;
+ push @items, "CDEF:smoke${ibot}=cp${ibot},UN,UNKN,cp${itop},cp${ibot},-,IF";
+ push @items, "AREA:cp${ibot}";
+ push @items, "STACK:smoke${ibot}#".(sprintf("%02x",$color) x 3);
};
return \@items;
}
@@ -1006,7 +1006,7 @@ sub get_detail ($$$$;$){
'--color', 'BACK#ffffff',
'--color', 'CANVAS#ffffff',
(map {"DEF:ping${_}=${rrd}:ping${_}:AVERAGE"} 1..$pings),
- (map {"CDEF:cp${_}=ping${_},$max->{$start},MIN"} 1..$pings),
+ (map {"CDEF:cp${_}=ping${_},0,$max->{$start},LIMIT"} 1..$pings),
("DEF:loss=${rrd}:loss:AVERAGE"),
@upargs,# draw the uptime bg color
@lossargs, # draw the loss bg color