[smokeping-users] Re: How to stop alert from triggering on each cycle?

Marc Haber mh+smokeping-users at zugschlus.de
Mon May 9 07:57:29 MEST 2005


Hi Tobi,

On Sun, May 08, 2005 at 09:57:28PM +0200, Tobias Oetiker wrote:
> Today Marc Haber wrote:
> > Additionally the manpage text ">10%,*10*,>10% will fire if more than
> > 10% of the packets have been losst twice over the last 10 samples." is
> > wrong. It will fire if more than 10% of the packets have been lost
> > _at_ _least_ twice over the last 10 samples.
> 
> sorry yes ... exactly as wrong as if I say, you loose your driving
> license if you are caught driving faster than 100 MPH twice, since
> this would imply that you would NOT lookse the license if you were
> caught three times ... right ? :-) in any event, I changed the
> docus in the 2.0 svn archive to not further confuse readers ...

Thanks for the clarification.

This makes writing smokeping alerts, IMO, unnecessarily hard and
error-prone. Unfortunately, I don't quite understand the code that
builds the alerts subroutine in init_alerts and agree that this code
is already complicated enough.

I don't know enough about object oriented perl to write correct code,
but I'd like to suggest something nevertheless. I hope that you
understand me.

That code needs to be in the update_rrds subroutine.

if ( $tree->{alerts} ) {
  $tree->{stack} = {loss=>['S'],rtt=>['S']} unless defined $tree->{stack};
  my $x = $tree->{stack};
  my $lastalert = &{$cfg->{Alerts}{$_}{sub}}($x);
  my ($loss,$rtt) = (split /:/,
      $probeobj->rrdupdate_string($tree))[1,2];
  <snip>

  if ( &{$cfg->{Alerts}{$_}{sub}}($x) ){
    # we got a match
    <snip>
    do_log("Alert $_ triggered for $line");
    <snip>
    if ( ! $lastalert ) {
      # generate actual notifications
    }
  } else {
    if ( $lastalert ) {
      do_log("Alert $_ not triggered any more for $line");
      # generate "all is fine" notifications
    }
}

That way, smokeping would only set messages when an alert matches for
the first time in a row, and when a row of alerts finishs, by first
determining if the alert matched in the last round, and only sending
notifications if the status changed. It's a small change and would
make notifications _much_ easier.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835

--
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://lists.ee.ethz.ch/smokeping-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the smokeping-users mailing list