[smokeping-users] Re: Curl probe graph colors?

Niko Tyni ntyni+smokeping-users at mappi.helsinki.fi
Fri Jan 14 12:08:30 MET 2005


On Fri, Jan 14, 2005 at 10:46:56AM +0100, Sebastian Wiesinger wrote:
> It works fine but the graph it outputs has some odd colors:
> 
> http://alita.karotte.org/smokeping/cgi-bin/smokeping.cgi?target=World.USA.ISC
> 
> What are these big green blocks (and the black ones in the Last 24
> Hours)? I've never seen these in normal probes.

Looks like you found a bug in Smokeping. With pings = 5, the smokecol()
subroutine in Smokeping.pm breaks and calculates a wrong color for the
ping deviating most from the median.

Details: in the sub

sub smokecol ($) {
    my $count = ( shift )- 2 ;
    my $half = int($count/2);
    my @items;
    for (my $i=$count; $i> $half; $i--){
        my $color = int(190/$half * ($i-$half))+50;
        push @items, "AREA:cp".($i+2)."#".(sprintf("%02x",$color) x 3);
    };
    for (my $i=$half; $i >= 0; $i--){
        my $color = int(190/$half * ($half - $i))+64;
        push @items, "AREA:cp".($i+2)."#".(sprintf("%02x",$color) x 3);
    };
    return \@items;
}

on the first round of the first for loop: $count = 3, $half = 1, $i = 3
making $color = int(190/1 * (3-1))+50 = 430

As this is >255, it's got more than two digits in hex (1AE).
So the rrdtool graph line gets #1AE1AE1AE as the color. Apparently
it takes just the firs six digits, resulting in RGB value 1A E1 AE,
which seems to match the color you have.

I'll let Tobi figure out the best fix. If you're in a hurry, I'd
suggest changing the pings value to either 4 or 6.
-- 
niko

--
Unsubscribe mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/smokeping-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the smokeping-users mailing list