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

Don't set Notification#no_more_notifications on custom notifications #7818

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Feb 6, 2020

... as it has nothing to do with reminder notifications.

fixes #6333

Edit

Imagine you get a problem notification. The above if branch does SetNoMoreNotifications(true), so that (the only) GetNoMoreNotifications() in NotificationComponent prevent reminders if none configured.

Now, if you send a custom notification, w/o my change the else branch does SetNoMoreNotifications(false), so that the NotificationComponent sends a reminder next time despite none configured.

@Al2Klimov Al2Klimov requested a review from dnsmichi February 6, 2020 15:53
@Al2Klimov Al2Klimov marked this pull request as ready for review February 6, 2020 15:53
@Al2Klimov Al2Klimov added this to the 2.13.0 milestone Mar 17, 2020
@N-o-X N-o-X requested review from N-o-X and removed request for dnsmichi September 3, 2020 06:33
@Al2Klimov Al2Klimov modified the milestones: 2.13.0, 2.14.0 Jun 2, 2021
@Al2Klimov
Copy link
Member Author

@cla-bot check

@cla-bot cla-bot bot added the cla/signed label Aug 4, 2021
@Al2Klimov Al2Klimov added the bug Something isn't working label Aug 10, 2021
@julianbrost julianbrost removed the request for review from N-o-X January 12, 2023 12:42
@julianbrost julianbrost removed this from the 2.14.0 milestone Jan 23, 2023
@Al2Klimov Al2Klimov added the area/notifications Notification events label May 17, 2023
@Al2Klimov Al2Klimov requested a review from julianbrost December 4, 2023 14:35
@Al2Klimov
Copy link
Member Author

What unit test cases would you like to prove this didn't break anything?

Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly the referenced issues are very different ones. The OP of #7758 is reporting that the no_more_notifications is still set even after the Host has recovered while in Downtime and the Downtime has ended (either cancelled manually or ended automatically). This can even be found in the debug logs he provided.

Host goes down:

[2020-01-22 16:45:10 +0100] notice/ClusterEvents: Discarding 'send custom notification' message for checkable 'test-host-notification-bug-3' from 'xyz-mon-sat1.xyz.de': Unauthorized access.
[2020-01-22 16:45:10 +0100] information/Checkable: Checkable 'test-host-notification-bug-3' has 1 notification(s). Checking filters for type 'Problem', sends will be logged.
[2020-01-22 16:45:10 +0100] notice/Notification: Attempting to send notifications of type 'Problem' for notification object 'test-host-notification-bug-3!test-host-notification-bug-delay'.
[2020-01-22 16:45:10 +0100] notice/Notification: Not sending notifications for notification object 'test-host-notification-bug-3!test-host-notification-bug-delay': before specified begin time (10 seconds)

A moment later the notification is send and sets no_more_notifications to true.

[2020-01-22 16:45:25 +0100] notice/NotificationComponent: Attempting to send reminder notification 'test-host-notification-bug-3!test-host-notification-bug-delay'.
[2020-01-22 16:45:25 +0100] notice/Notification: Attempting to send reminder notifications of type 'Problem' for notification object 'test-host-notification-bug-3!test-host-notification-bug-delay'.
[2020-01-22 16:45:25 +0100] debug/Notification: User 'test-user-notification-bug' notification 'test-host-notification-bug-3!test-host-notification-bug-delay', Type 'Problem', TypeFilter: Problem (FType=32, TypeFilter=104)
[2020-01-22 16:45:25 +0100] debug/Notification: User 'test-user-notification-bug' notification 'test-host-notification-bug-3!test-host-notification-bug-delay', State 'Down', StateFilter: Critical and Down (FState=32, StateFilter=36)
[2020-01-22 16:45:25 +0100] information/Notification: Sending reminder 'Problem' notification 'test-host-notification-bug-3!test-host-notification-bug-delay' for user 'test-user-notification-bug'

During the downtime, the host recovers and the Recovery notification is suppressed. Afterwards, the downtime is ended/canceled and no notification is set due to filter types and ends up here and leaves no_more_notifications unchanged.

if (!(ftype & GetTypeFilter())) {
Log(LogNotice, "Notification")
<< "Not sending " << (reminder ? "reminder " : "") << "notifications for notification object '"
<< notificationName << "': type '"
<< NotificationTypeToString(type) << "' does not match type filter: "
<< NotificationFilterToString(GetTypeFilter(), GetTypeFilterMap()) << ".";
/* Ensure to reset no_more_notifications on Recovery notifications,
* even if the admin did not configure them in the filter.
*/
{
ObjectLock olock(this);
if (type == NotificationRecovery && GetInterval() <= 0)
SetNoMoreNotifications(false);
}
return;
}

2020-01-22 16:53:05 +0100] notice/Notification: Attempting to send notifications of type 'DowntimeEnd' for notification object 'test-host-notification-bug-3!test-host-notification-bug-delay'.
[2020-01-22 16:53:05 +0100] notice/Notification: Not sending notifications for notification object 'test-host-notification-bug-3!test-host-notification-bug-delay': type 'DowntimeEnd' does not match type filter: Custom, Problem and Recovery.

So, how is your PR supposed to solve the problem? That would make it even worse and wouldn't reset it if the filter types would contain DowntimeEnd.

The OP of #9046, on the other hand, reports that sending custom notifications implicitly resets the "no_more_notifications" flag and causes problem notifications to be sent again while interval is set to 0.

@Al2Klimov Al2Klimov force-pushed the bugfix/no_more_notifications-7758 branch from 9cc81a1 to 3cfa9bd Compare March 14, 2024 15:32
@Al2Klimov
Copy link
Member Author

#9046 test

This PR

sends the custom notification and that's it.

Bildschirmfoto 2024-03-14 um 17 06 39

master

sends another problem one afterwards.

Bildschirmfoto 2024-03-14 um 17 10 17

@Al2Klimov Al2Klimov requested a review from yhabteab March 14, 2024 16:13
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes doesn't fix #7758

Please remove this!

Bildschirmfoto 2024-04-04 um 10 23 30

@Al2Klimov Al2Klimov added this to the 2.15.0 milestone Apr 4, 2024
@Al2Klimov Al2Klimov changed the title Don't set Notification#no_more_notifications on others than problem/recovery Don't set Notification#no_more_notifications on custom notifications Apr 4, 2024
@Al2Klimov
Copy link
Member Author

Because it says nothing (could be every other not fixed issue number) or because it fixes the mentioned issue?

@yhabteab
Copy link
Member

yhabteab commented Apr 4, 2024

Because it says nothing (could be every other not fixed issue number)

Exactly! It has nothing to do with PR at all!

@Al2Klimov Al2Klimov force-pushed the bugfix/no_more_notifications-7758 branch from 3cfa9bd to 35a7057 Compare November 15, 2024 12:03
@yhabteab yhabteab removed the request for review from julianbrost November 15, 2024 12:07
@yhabteab yhabteab enabled auto-merge November 15, 2024 12:07
@yhabteab yhabteab merged commit 2931aea into master Nov 15, 2024
27 checks passed
@yhabteab yhabteab deleted the bugfix/no_more_notifications-7758 branch November 15, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/notifications Notification events bug Something isn't working cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reminder notifications get send out even with interval=0 when forcing CUSTOM notification via webinterface
3 participants