47 Commits

Author SHA1 Message Date
Julian Brost
7d0a43f926 Use Checkable::GetStateBeforeSuppression() only where relevant
This fixes an issue where recovery notifications get lost if they happen
outside of a notification time period.

Not all calls to `Checkable::NotificationReasonApplies()` need
`GetStateBeforeSuppression()` to be checked. In fact, for one caller,
`FireSuppressedNotifications()` in
`lib/notification/notificationcomponent.cpp`, the state before suppression may
not even be initialized properly, so that the default value of OK is used which
can lead to incorrect return values. Note the difference between suppressions
happening on the level of the `Checkable` object level and the `Notification`
object level. Only the first sets the state before suppression in the
`Checkable` object, but so far, also the latter used that value incorrectly.

This commit moves the check of `GetStateBeforeSuppression()` from
`Checkable::NotificationReasonApplies()` to the one place where it's actually
relevant: `Checkable::FireSuppressedNotifications()`. This made the existing
call to `NotificationReasonApplies()` unneccessary as it would always return
true: the `type` argument is computed based on the current check result, so
there's no need to check it against the current check result.
2024-10-11 13:21:10 +02:00
Alexander A. Klimov
83021f8231 CONTEXT: use << everywhere to unify usages 2022-11-30 11:06:51 +01:00
Julian Brost
51cd7e7b0b Take host state into account when sending suppressed notifications
Checkable::FireSuppressedNotifications() compares the time of the current
checkable with the last recovery time of parents to avoid notification right
after a parent recovered and before the current checkable was checked.

This commit makes this check also include to host if the checkable is a
service.  This makes the behavior consistent with the documentation that states
there is an implicit dependency on the host (which isn't realized as implicitly
generating a Dependency object unfortunately).
2022-04-19 16:13:15 +02:00
Julian Brost
90848f602b Checkable: Add test for state notifications after a suppression ends 2022-03-03 14:25:23 +01:00
Julian Brost
39cee3538a Checkable: improve state notifications after suppression ends
This commit changes the Checkable notification suppression logic (notifications
are currently suppressed on the Checkable if it is unreachable, in a downtime,
or acknowledged) to that after the suppression reason ends, a state
notification is sent if and only if the first hard state after is different
from the last hard state from before. If the checkable is in a soft state after
the suppression ends, the notification is further suppressed until a hard state
is reached.

To achieve this behavior, a new attribute state_before_suppression is added to
Checkable. This attribute is set to the last hard state the first time either a
PROBLEM or a RECOVERY notification is suppressed. Compared to from before,
neither of these two flags in the suppressed_notification will ever be cleared
while the supression is still ongoing but only after the suppression ended and
the current state is compared with the old state stored in
state_before_suppression.
2022-03-03 14:25:23 +01:00
Julian Brost
6390911262
Merge pull request #9123 from Icinga/bugfix/icinga2-crashes-when-sending-notifications-8186
Avoid "type" key in dicts being part of object state attrs
2022-01-19 11:48:40 +01:00
Alexander A. Klimov
eb71fb7529 Avoid "type" key in dicts being part of object state attrs
not to confuse the state file deserializator with e.g. `"type":32` on startup.
That would unexpectedly restore null (not `{"type":32}`) as there's no type "32".

refs #8186
2021-12-13 17:56:12 +01:00
Alexander Aleksandrovič Klimov
aa0baf6f69
Merge pull request #8099 from Icinga/feature/std-mutex
Use std::mutex, not boost::mutex
2021-02-04 10:19:04 +01:00
Alexander A. Klimov
c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Alexander Aleksandrovič Klimov
8d1e958275
Make code doc more readable
Co-authored-by: Julian Brost <julian.brost@icinga.com>
2021-01-27 15:43:37 +01:00
Alexander A. Klimov
5547488cd5 Introduce Checkable#NotificationReasonSuppressed()
refs #8509
2020-12-14 13:27:58 +01:00
Alexander A. Klimov
668bf06424 Don't fire suppressed notifications if last parent recovery >= last check result 2020-12-02 12:03:19 +01:00
Alexander A. Klimov
c515822649 Re-send notifications previously suppressed by their time periods
refs #6167
2020-07-29 17:13:41 +02:00
Michael Friedrich
d242b41704 Revert "Make NotificationResult available for events: Cluster and Features"
This reverts commit 566e59bbfa385ec1a023c32a1feb895791950032.
2020-01-07 14:20:59 +01:00
Michael Friedrich
8098f4d54d Improve type logging for notifications 2019-07-16 13:46:16 +02:00
Alexander A. Klimov
b95e92ea5f Stash notifications until object authority has been updated once
refs #7086
2019-07-11 13:07:50 +02:00
Michael Friedrich
a3c6797310 Fix compiler warnings and style 2019-07-10 11:51:58 +02:00
Alexander A. Klimov
ffa7b749cb Wait until the next check result if it's expected to arrive soon before re-sending a suppressed notification
refs #5919
2019-07-09 16:38:50 +02:00
Alexander A. Klimov
ed56fa34dc Re-send suppressed notifications
refs #5919
2019-07-09 16:38:50 +02:00
Michael Friedrich
566e59bbfa Make NotificationResult available for events: Cluster and Features 2019-03-28 11:42:28 +01:00
Michael Friedrich
d14a88235d Replace Copyright header with a short version, part I
CLion -> replace in path
2019-02-25 14:48:22 +01:00
Michael Friedrich
7ce30a86b8 Enhance notification logging
- More details from the local context (notification, user, checkable, command names)
- Notice logs for when this notification object is paused in HA enabled zones
- Notice logs for interval=0 reminder notifications
- Object name for skipping recovery notifications when problem hasn't been notified before
2019-02-07 15:42:09 +01:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Bas Couwenberg
0891380789 Fix spelling errors.
* occured -> occurred
 * dosen't -> doesn't
2018-07-21 10:38:09 +02:00
Gunnar Beutner
ac155d1dda Apply clang-tidy fix 'modernize-redundant-void-arg' 2018-01-04 12:24:57 +01:00
Michael Insel
158ae2188e Change copyright header for 2018 2018-01-02 12:08:55 +01:00
Jean Flach
2636e6a77a Whitespace fix
What does this change?
* Remove use of spaces for formatting
These could be found by using `grep -r -l -P '^\t+ +[^*]'
* Removal of training whitespaces
* A few lines longer than 120 chars
2017-12-20 14:53:52 +01:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Michael Friedrich
a13e6b3e87 Fix that custom notifications do not reset force_next_notification
This attribute is stored in the state file forever as well.
Will cause forced notifications ignoring state/type filters.

fixes #12670
2016-11-17 11:53:35 +01:00
Gunnar Beutner
288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Michael Friedrich
e28f30a727 Enhance log messages for {,reminder} notifications
refs #12402
2016-08-12 14:49:29 +02:00
Gunnar Beutner
8a714d66f1 Ensure that sent notifications are synced between Icinga instances
fixes #11562
2016-06-15 11:27:01 +02:00
Gunnar Beutner
0eb0992d5e Fix custom notifications in a HA zone
fixes #9242
2016-06-07 12:44:12 +02:00
Gunnar Beutner
599929b0f6 Update copyright headers for 2016 2016-01-12 08:29:59 +01:00
Gunnar Beutner
050c520b2a Convert Comment/Downtime to config objects
fixes #9777
2015-10-28 17:56:29 +01:00
Michael Friedrich
d7970f5bb1 Implement modified attributes v2
refs #9081
refs #9093
2015-08-15 20:07:10 +02:00
Gunnar Beutner
a3e0c9d898 Add missing mutex for AddNotification/RemoveNotification
fixes #8311
2015-01-29 13:21:22 +01:00
Michael Friedrich
78bfd0204c Update copyright year 2015-01-22 12:00:23 +01:00
Gunnar Beutner
478f03b49a Replace boost::shared_ptr with boost::intrusive_ptr
refs #7622
2014-11-09 16:54:41 +01:00
Gunnar Beutner
2d5e9514a5 Refactor logging code 2014-10-19 17:52:17 +02:00
Gunnar Beutner
b18f57a745 Remove logger_fwd.hpp 2014-10-19 14:50:39 +02:00
Jean-Marcel Flach
df3da5f1f3 Change log message for checking/sending notifications
fixes #6719
2014-09-03 13:23:19 +02:00
Michael Friedrich
3ecec31af3 Change log message identifier for libicinga.
Refs #6346
2014-05-28 14:42:00 +02:00
Gunnar Beutner
632026cd9f Rename C++ header files.
Fixes #6291
2014-05-25 16:27:14 +02:00
Gunnar Beutner
9c3e399188 Remove unnecessary includes.
Fixes #6189
2014-05-11 18:11:32 +02:00
Gunnar Beutner
45270f1bb8 Refactor the agent and cluster components.
Refs #6107
2014-05-08 09:13:04 +02:00
Gunnar Beutner
23e9630682 Implement host checks.
Refs #5919
2014-04-04 15:57:54 +02:00