From 2a08e0d8ca5f3e2f64ca2771e20764a953515d2f Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Mon, 22 Dec 2008 12:55:28 +0000 Subject: minor fixes --- lib/Smokeping/matchers/ExpLoss.pm | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'lib/Smokeping') diff --git a/lib/Smokeping/matchers/ExpLoss.pm b/lib/Smokeping/matchers/ExpLoss.pm index f8ee9db..90afdcc 100644 --- a/lib/Smokeping/matchers/ExpLoss.pm +++ b/lib/Smokeping/matchers/ExpLoss.pm @@ -1,32 +1,31 @@ package Smokeping::matchers::ExpLoss; - =head1 NAME Smokeping::matchers::ExpLoss - exponential weighting matcher for packet loss -wirh RMON-like thresholds +with RMON-like thresholds =head1 DESCRIPTION -Match against exponential weighted average of last samples. Two thresholds -- rising and falling - produce hysteresis loop like in RMON alert subsystem. -If the "average" reaches "rising" threshold, matcher go to the "match" state -and hold It until the "average" drop under the "falling" threshold. +Match against exponential weighted average of last samples, thus new values +are more valuable as old ones. Two thresholds - rising and falling - produce +hysteresis loop like in RMON alert subsystem. If the average reaches the +"rising" threshold, matcher go to the "match" state and hold It until the +average drops under the "falling" threshold. Call the matcher with the following sequence: type = matcher - edgetrigger = yes pattern = CheckLoss(hist => , rising=> \ - [,falling => ] [,start=>] [,fast=>]) + [,falling => ] [,skip=>] [,fast=>]) Arguments: hist - number of samples to weight against; weight will be disposed with exponetial decreasing manner from newest to oldest, so that the - oldest sample would have 1% significance; + oldest sample would have 1% significance; rising - rising threshold for packet loss, 0-100% falling - falling threshold for packet loss, default is - start - wait number of sample before "fire" alerts. - fast - use samples for fast transition: if values of last + skip - skip number of samples after startup before "fire" alerts. + fast - use samples for fast transition: if the values of last samples more then - take "match" state, if less then - take "no match" state. @@ -73,7 +72,7 @@ sub new(@) { my $rules = { hist => '\d+', rising => '\d+(\.\d+)?', - falling => '\d+(\.\d+)?', + falling => '\d+(\.\d+)?', skip => '\d+', fast => '\d+', }; @@ -106,7 +105,7 @@ sub Test($$) { my $alfa = 1-0.01**(1/$hist); my $rising = $self->{param}{rising}; - my $falling = $self->{param}{falling}; + my $falling = (defined $self->{param}{falling} || $rising); my $result = 0; # initialize the filter as zero; my $loss; @@ -142,10 +141,10 @@ sub Test($$) { # some debug stuff if (0) { - my $d = localtime(time); + my $d = `date`; chomp $d; my $array = join ":", @{ $data->{loss}}; - system "echo $d $data->{target} $array $result. >> /tmp/matcher.log" if $rising == 0; + `echo $d $data->{target} $array $result. >> /tmp/matcher.log` if $rising == 0; } return $res; } -- cgit v1.2.3-24-g4f1b