Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification on Edgetrigger Alerts #183

Closed
dekenberg opened this issue Jun 18, 2019 · 7 comments
Closed

Clarification on Edgetrigger Alerts #183

dekenberg opened this issue Jun 18, 2019 · 7 comments

Comments

@dekenberg
Copy link
Contributor

dekenberg commented Jun 18, 2019

I would like some clarification on the edgetrigger behavior for Alerts.

I implemented a loss alert with the trigger pattern ==0%, ==0%, ==0% and edgetrigger was set to yes. The expected behavior is that there would be 1 email alert which raised the alert - and then 1 email when the alert was cleared.

The behavior being seen is emails being sent every polling cycle stating that the alert was raised.

I dove into Smokeping.pm and added some syslog to debug and found something that I can't explain the rationale. Currently on Line 2020-2024 $tree->{'prevmatch'.$s}{$_} is either set to 0 or is incremented by 1. This increment can make prevmatch any positive value, while match can only be 0 or 1. It breaks the edgetrigger functionality due to the condition on line 1882 if ($edgetrigger and $prevmatch != $match) and causes this block to resolve to true when it should actually be false. I would like some clarification on if this is intended or if this is an oversight from #52

@karatha
Copy link

karatha commented Jun 20, 2019

Dear Team,
Can you offer a quick solution for this edgetrigger issue?
My postbox flooded by alerts mail.

@oetiker
Copy link
Owner

oetiker commented Jun 20, 2019

unfortunately, edge trigger was not in the original design ... it may not work correctly under all circumstances ... I would suggest using two patterns:

>0%, ==0%, ==0%
==0%, ==0%, >%0

@dekenberg
Copy link
Contributor Author

@karatha from my initial testing I found that reverting the if else blocks from #52 seems to restore the functionality - but I am still working on testing a wider range of alerts

@karatha
Copy link

karatha commented Jun 20, 2019

I appreciate your helpfulness. It seem i solved my issue based on oetiker suggestion. I was excited because i have just upgrade from debian 8 to 10 and after the stormy night my postbox flooded due to I'm monitoring ~ 80 sites with smokeping.
Thanks for your effort to developed this nice and reliable monitoring tool.

@meleschi
Copy link

meleschi commented Jul 29, 2019

I am also seeing this issue with edgetrigger. I have moved to two separate alerts like Oetiker suggested above and the email flood has abated...

For reference, I changed my alerts to this (please ignore their names, they haven't been updated in the config):

+someloss
type = loss
priority = 2
edgetrigger = yes
pattern = ==0%,==0%,>80%
comment = Detected >80% loss

+lossdetect
type = loss
priority = 1
edgetrigger = yes
pattern = >80%,==0%,==0%
comment = Recover from >80% loss

As @karatha stated above, thank you @oetiker for making this tool. It's proved immensely helpful and makes my job much easier when it comes to understanding the state of my systems and network.

@dfrli
Copy link
Contributor

dfrli commented Sep 20, 2019

There is also a Debian bug report about this issue:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=934170
It also contains the simple fix to make the prevmatch condition boolean by replacing
if ($edgetrigger and $prevmatch != $match)
with
if ($edgetrigger and ($prevmatch == 0 ? 0 : 1) != $match)
which makes the whole edgetrigger functionality working again as expected.
I hope @oetiker can correct this in the source code.

@oetiker
Copy link
Owner

oetiker commented Sep 23, 2019

thanks!

@oetiker oetiker closed this as completed Sep 23, 2019
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Feb 2, 2021
Integrate upstream patch[1] to fix mail loop issue #183[2].

This is a one-line patch without complexity who can be removed
as soon as the upstream releases a new version.

[1] oetiker/SmokePing@e9004e8
[2] oetiker/SmokePing#183

PR:		253161
Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@563789 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Feb 2, 2021
Integrate upstream patch[1] to fix mail loop issue #183[2].

This is a one-line patch without complexity who can be removed
as soon as the upstream releases a new version.

[1] oetiker/SmokePing@e9004e8
[2] oetiker/SmokePing#183

PR:		253161
Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue Feb 2, 2021
Integrate upstream patch[1] to fix mail loop issue #183[2].

This is a one-line patch without complexity who can be removed
as soon as the upstream releases a new version.

[1] oetiker/SmokePing@e9004e8
[2] oetiker/SmokePing#183

PR:		253161
Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@563789 35697150-7ecd-e111-bb59-0022644237b5
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
Integrate upstream patch[1] to fix mail loop issue #183[2].

This is a one-line patch without complexity who can be removed
as soon as the upstream releases a new version.

[1] oetiker/SmokePing@e9004e8
[2] oetiker/SmokePing#183

PR:		253161
Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants