64 Commits

Author SHA1 Message Date
Julian Brost
9fc426e20e Don't trigger a fixed downtime like a flexible one
When creating a fixed downtime that starts immediately while the checkable is
in a non-OK state, previously the code path for flexible downtimes was used to
trigger this downtime. This is fixed by this commit which resolves two issued:

1. Missing downtime start notification: notifications work differently for
   fixed and flexible downtimes. This resulted in missing downtime start
   notifications under the conditions described above.
2. Incorrect downtime trigger time: this code path would incorrectly assume the
   timestamp of the last checkable as the trigger time which is incorrect for
   fixed downtimes.
2022-01-20 11:45:38 +01:00
Julian Brost
4a1e6528ea
Merge pull request #8889 from Icinga/bugfix/trigger-fixed-downtimes-immediately-212
Downtime#Start(): trigger fixed downtimes immediately instead of waiting for the timer
2021-07-08 15:33:11 +02:00
Alexander A. Klimov
2dcba12765 Introduce Downtime#config_owner_hash
refs #8309
2021-07-07 15:42:18 +02:00
Alexander A. Klimov
13d3d18a7f Downtime#Start(): trigger fixed downtimes immediately instead of waiting for the timer
... not to cause e.g. notifications if a problem occurs
between the downtime start time and the timer routine.
2021-07-07 15:31:46 +02:00
Julian Brost
35c9c656a0 AddDowntime: return Downtime::Ptr instead of String containing the name
At numerous places in the code, something like this is performed:

    String name = Downtime::AddDowntime(...);
    Downtime::Ptr downtime = Downtime::GetByName(name);

However, `downtime` can be a `nullptr` after this as it is possible that
the downtime is deleted in between.

This commit changes the return type of `Downtime::AddDowntime` to return
a Downtime::Ptr instead of the full name of the downtime. `AddDowntime`
performs the very same `GetByName()` operation internally, but handles
the `nullptr` case correctly and throws an exception.
2021-05-25 15:59:55 +02:00
Julian Brost
0cef85cf83 Properly handle service downtime referencing a deleted host
Only two out of three cases were handled properly by the code: host
downtimes referencing a deleted host and service downtimes referencing a
deleted service worked fine. However, if a service downtime references a
deleted host, `Host::GetByName()` returns `nullptr` which isn't
accounted for. Use `Service::GetByNamePair()` instead as this performs a
check for the host being null internally.
2021-05-25 15:59:55 +02:00
Alexander A. Klimov
8b0ba2275a Check !!downtime->GetCheckable() before downtime->GetCheckable()->GetName()
... not to crash while removing a downtime from a disappeared checkable.
2020-09-11 14:47:46 +02:00
Michael Friedrich
743dcad35d Improve logging for downtime/ack events (add, remove, expire)
fixes #7374
2019-08-06 13:28:58 +02: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
Alexander A. Klimov
ce847324bc Downtime::AddDowntime(): place Downtimes in the same zone as the origin ScheduledDowntimes 2019-01-28 18:29:57 +01:00
Alexander A. Klimov
b09e7b287e Validate Zone::GetLocalZone() before using 2019-01-15 19:23:20 +01:00
Michael Friedrich
c4d57afa3d
Merge pull request #6821 from Icinga/bugfix/downtimes-disappear-satellite-6542
Don't delete downtimes in satellite zones
2018-12-18 16:13:36 +01:00
Alexander A. Klimov
c98d6a5254 Downtime#HasValidConfigOwner(): respect Downtime#authoritative_zone
refs #6542
2018-12-17 15:54:31 +01:00
Alexander A. Klimov
5431eae116 Add and populate Downtime#authoritative_zone
refs #6542
2018-12-17 15:54:23 +01:00
Alexander A. Klimov
39e0d787e8 Downtime#HasValidConfigOwner(): wait for ScheduledDowntimes
refs #6542
2018-12-06 15:44:57 +01:00
Michael Friedrich
dab53448bc icinga.com: Update *.{h,c}pp 2018-10-18 09:27:04 +02:00
Gunnar Beutner
17c7131177 Move new downtime constants into the Icinga namespace 2018-08-25 19:35:01 +02:00
Noah Hilverling
01fea22c77 Add child_options to ScheduledDowntime
refs #3935
2018-08-24 14:29:39 +02:00
Michael Friedrich
a8b5d8e64a
Merge pull request #6205 from Icinga/feature/api-verbose-errors
API: Unify verbose error messages
2018-04-17 16:40:11 +02:00
fbachmann
3f75ccbe75 fix bug in Downtime::IsInEffect() method that would always return false if the triggering window for a flexible downtime had passed 2018-04-10 20:16:09 +02:00
Michael Friedrich
c4a6ab0211 Add diagnostic_information as verbose error to config object handlers 2018-04-06 12:26:49 +02:00
Gunnar Beutner
94e6be1a65 Remove unused includes 2018-01-22 09:52:29 +01:00
Gunnar Beutner
9d436605f0 Fix compatibility with CMake < 3.1 2018-01-18 15:12:46 +01:00
Gunnar Beutner
21254fb610 Avoid accessing attributes for validators where not necessary 2018-01-11 08:20:16 +01: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
Gunnar Beutner
b63caaa756 Workaround for GCC bug 51494 2017-12-20 08:02:17 +01:00
Michael Friedrich
a238613fdc
Merge pull request #5825 from Icinga/feature/boost-assign
Replace boost::assign::list_of with initializer lists
2017-11-30 21:20:46 +01:00
Gunnar Beutner
83f17b5bfa Replace boost::assign::list_of with initializer lists 2017-11-30 18:09:38 +01:00
Gunnar Beutner
325e4a2fb9 Use nullptr instead of <Type>::Ptr() 2017-11-30 17:47:09 +01:00
Gunnar Beutner
6739023678 Dynamically create and destroy the timer thread 2017-11-30 17:41:02 +01:00
Gunnar Beutner
858873b940 Replace boost::bind/boost::function with std::bind/std::function 2017-11-27 15:15:11 +01:00
Michael Friedrich
8d56f8e951 Fix that host downtimes might be triggered even if their state is Up
If the checkresult's state is 1, this is internally mapped to Up.
The added downtime will check for triggers and might cause a wrong
downtime start event.

refs #5202
2017-05-11 15:05:50 +02:00
Gunnar Beutner
95093bae3e Move log message
refs #5094
2017-03-27 11:01:14 +02:00
Michael Friedrich
b7caf0820d Ensure that *.icinga.com is used everywhere
fixes #13897
fixes #13277
2017-01-10 17:19:12 +01:00
Gunnar Beutner
56e9a23a65 Don't try to delete Downtime objects that were statically configured
fixes #13275
2016-11-22 15:13:43 +01:00
Michael Friedrich
1bfb91f065 Ensure that DowntimeStart notifications are not immediately sent
fixes #12549
2016-11-11 19:36:19 +01:00
Michael Friedrich
09658f6d0e Add child_options for API action 'schedule-downtime'
fixes #10896
fixes #10897
2016-11-02 09:54:48 +01:00
Gunnar Beutner
e8b0797ec4 Use 'auto' keyword for iterator declarations (part 2)
refs #12561
2016-08-27 19:56:12 +02:00
Gunnar Beutner
288413f046 Replace BOOST_FOREACH with range-based for loops
fixes #12538
2016-08-25 06:46:17 +02:00
Gunnar Beutner
9f8cb8dd36 Clean up the code a bit
refs #11423
2016-08-13 21:43:59 +02:00
Michael Friedrich
8f03adf76f Remove Downtime objects w/o reference to ScheduledDowntime objects
fixes #11423
2016-08-13 15:18:50 +02:00
Michael Friedrich
8389d01998 Fix flexible downtimes expiry time and removal
fixes #12395
2016-08-10 17:15:27 +02:00
Michael Friedrich
c73e4d3328 Fix Downtime validation function signature
refs #11483
2016-07-05 13:17:18 +02:00
Michael Friedrich
399ae42a8c DB IDO: Fix comment/downtime entry_time reset
fixes #11182
2016-06-15 11:28:57 +02:00
Michael Friedrich
3c852311e1 Fix possible crash in Add{Comment,Downtime}
refs #11112
2016-05-11 16:12:09 +02:00
Gunnar Beutner
0b95be7b99 Fix incorrect calculation in Downtime::IsInEffect
fixes #11589
2016-05-11 14:13:43 +02:00
Michael Friedrich
23ab6cf78b Fix: Expired downtimes are not removed
fixes #11711
2016-05-02 15:32:46 +02:00
Gunnar Beutner
974ca9f38b Fix crash in Downtime::DowntimesExpireTimerHandler
fixes #11534
fixes #11559
2016-04-12 12:05:43 +02:00