14317 Commits

Author SHA1 Message Date
Julian Brost
aee8fb2045
Merge pull request #10323 from Icinga/doc-11-cli-commands-update
Update Icinga 2 CLI Commands Documentation
2025-05-12 14:39:01 +02:00
Yonas Habteab
241e1f9437 Fix broken SELinux policy on Fedora >=41 systems
`sbindir` can be both `/usr/sbin` or `/usr/bin` depending on the used OS
hence we need to make sure that this pattern matches on both paths.
2025-05-12 13:56:36 +02:00
Yonas Habteab
4596b44171 Reset no_more_notifications on filter mismatch correctly
Previously, if you enable flapping for a Checkable but the corresponding
`Notification` object does not have `FlappingStart` or `FlappingEnd`
types set, the `no_more_notifications` flag wasn't reset to false again.
This commit ensures that this flag is always reset on `Recovery` even
the type filter does not match including when we miss the `Recovery` due
to Flapping state.
2025-05-12 12:03:13 +02:00
Yonas Habteab
9166326876 Notification: Reset notified problem users on flapping end as well 2025-05-12 12:03:13 +02:00
Yonas Habteab
86365a4e2b Notification: Clear last notified state per user on flapping end as well 2025-05-12 12:03:13 +02:00
Yonas Habteab
89f12c2323 Notification: Reset no_more_notifications only on recovery 2025-05-12 12:03:13 +02:00
Yonas Habteab
a53792df31
Merge pull request #10421 from Icinga/doc-08-advanced-topics-checkresult-state-ref
doc/08-advanced-topics.md: Reference CheckResult state
2025-05-12 10:36:44 +02:00
Julian Brost
33824c2acc
Merge pull request #10418 from Icinga/jschmidt/doc-impr-unity-builds-core-dumps
Improvements to core dumps section in developer documentation (and some smaller stuff)
2025-05-05 17:29:15 +02:00
Julian Brost
e34f45cbef
Merge pull request #10430 from Icinga/gha-fix-amazonlinux2023-mariadb-package
GHA: Fix amazonlinux:2023 MariaDB package
2025-05-05 17:27:10 +02:00
Alvar Penning
6f5725576c
GHA: Fix amazonlinux:2023 MariaDB package
Since recently, the amazonlinux:2023 job in the Linux action fails due
to conflichting 'mariadb1*-devel' packages.

> package mariadb1011-devel-3:10.11.11-1.amzn2023.0.1.x86_64 from amazonlinux conflicts with mariadb105-devel provided by mariadb105-devel-3:10.5.16-1.amzn2023.0.7.x86_64 from amazonlinux

It seems like Amazon Linux added mariadb1011 packages next to mariadb105
packages, resulting in a conflict due to the wildcard. On prior runs,
the mariadb105 packages was installed.

This change installs mariadb-connector-c-devel instead of a specific
mariadb1*-devel package, as suggested by the package description.
2025-05-05 14:32:16 +02:00
Alexander Aleksandrovič Klimov
28091a6343
Merge pull request #10384 from Icinga/Al2Klimov-patch-7
GHA: AUTHORS: ignore dependabot[bot]
2025-05-05 11:56:02 +02:00
Alvar
26709e7a65
Merge pull request #10426 from Tqnsls/patch-1
Include "procs-to-show"to ITL check_load command
2025-05-05 08:45:49 +00:00
Johannes Schmidt
88b2831bfa Improve the documentation for generating core dumps 2025-05-05 10:23:22 +02:00
Julian Brost
b2b47981a5
Merge pull request #10422 from Icinga/mktime-dst-consistency
Ensure consistent mktime() DST behavior across different implementations
2025-04-30 16:51:05 +02:00
Silas
41c0148e72
Include "procs-to-show" to ITL check_load command 2025-04-30 15:28:07 +02:00
Julian Brost
3d70720f1b
Merge pull request #10427 from Icinga/notification-load-after
Load Notification objects after User and UserGroup
2025-04-29 17:12:09 +02:00
Julian Brost
cc48c924ae Load Notification objects after User and UserGroup
Notification objects can refer User and Group objects similar to how they can
refer Host and Service objects, so that dependency feels quite natural. Note
that for evaluating most configuration, this order doesn't really matter, the
configuration will successfully evaluate in either case, the difference can be
noticed mainly in more advanced configurations, for example when dynamically
assigning user based on their groups. When accessing user objects from the
Notification object definition (like in the following example), without this
change, only groups configured directly in groups attribute of User objects are
visible and those added via assign clauses in UserGroup objects are missing.
With this commit, these are also visible.

    apply Notification "n" to Host {
        for (var u in get_objects(User)) {
            log(u.name + " -> " + Json.encode(u.groups))
        }

        # [...]
    }
2025-04-29 12:14:46 +02:00
Alexander A. Klimov
98d097517b Introduce Endpoint#messages_received_per_type 2025-04-29 11:42:14 +02:00
Alexander A. Klimov
3dd7b15808 Count incoming messages per type and endpoint 2025-04-29 11:42:14 +02:00
Alexander A. Klimov
c566f6dc31 ApiFunction: store own name 2025-04-29 11:42:14 +02:00
Alexander A. Klimov
331ba1f661 Rename AsioConditionVariable to AsioEvent
The current implementation is rather similar to Python's threading.Event, than to a CV.
2025-04-29 11:39:42 +02:00
Julian Brost
3c9e06972d Don't disable icinga_legacytimeperiod/dst test on Alpine
The test was disabled due to a difference in behavior of mktime() between glibc
and musl. This inconsistency was fixed with the introduction of
Utility::NormalizeTm() and Alpine no longer needs this special case.
2025-04-28 13:48:00 +02:00
Julian Brost
379d7638ed tests: Remove special cases for Windows in icinga_legacytimeperiod/dst
Ideally, Icinga 2 should behave consistenly across platforms. These special
cases only existed because mktime() on Windows behaved differently than the
implementation in glibc. With the introduction of Utility::NormalizeTm(),
there's now consistent behavior and the other expected results for windows are
no longer necessary (ideally, they shouldn't have existed in the first place).
2025-04-28 13:48:00 +02:00
Julian Brost
5404143dee Ensure consistent mktime() DST behavior across different implementations
There are inputs to mktime() where the behavior is not specified and there's
also no single obviously correct behavior. In particular, this affects how
auto-detection of whether DST is in effect is done when tm_isdst = -1 is set
and the time specified does not exist at all or exists twice on that day.

If different implementations are used within an Icinga 2 cluster, that can lead
to inconsistent behavior because different nodes may interpret the same
TimePeriod differently.

This commit introduces a wrapper to mktime(), namely Utility::NormalizeTm()
that implements the behavior provided by glibc. The choice for glibc's behavior
is pretty arbitrary, it was simply picked because most systems that are
officially/fully supported use it (with the only exception being Windows), so
this should give the least possible amount of user-visible changes.

As part of this commit, the closely related helper function mktime_const() is
also moved to Utility::TmToTimestamp() and made a wrapper around the newly
introduced NormalizeTm().
2025-04-28 13:38:55 +02:00
Julian Brost
17c96783cf tests: Move GlobalTimezoneFixture to utils file
Prepare for adding test cases for DST changes in other files as well.
2025-04-28 13:38:38 +02:00
Julian Brost
2458f686db tests: Remove GCC compatibility from make_tm
We're using C++17, GCC only started implementing that in version 5, so there's
no need for compatibility code for older versions any more.
2025-04-28 13:38:36 +02:00
Julian Brost
de4b58a04f tests: Move make_tm helper function to utils file
Preparation to be able to use the function from different test files later on.
2025-04-28 13:38:32 +02:00
Julian Brost
a65f2d6b41
Merge pull request #10417 from Icinga/inverted-hacluster-check
Fix inverted `IsHACluster` check
2025-04-25 11:01:52 +02:00
Johannes Schmidt
064399e6f1 Rephrase some sentences about unity builds in dev docs
We didn't really 'invent' unity builds, more like adopted them, since
this is a common practice.

Also added a reference to the actual CMake variable in question instead
of just alluding to it
2025-04-25 10:40:54 +02:00
Johannes Schmidt
8ac7153120 Rephrasing a sentence about recognizing .ti files
You can only 'recognize' something you already know and 'another thing',
while not necessarily wrong does not seem right here when there isn't a
'first thing' to notice.
2025-04-25 10:40:54 +02:00
Johannes Schmidt
28863a0e41 Remove Atom and add Emacs as a "preferred editor"
Atom is already dead.

But Emacs will outlast human civilization.
2025-04-25 10:40:54 +02:00
Johannes Schmidt
595d11de82 Fix some minor typos and capitalization errors in documentation
Corrected one instance where `CMake` was spelled as `cmake` despite the rest
of the docs using the first spelling.
2025-04-25 10:40:50 +02:00
Alvar Penning
efc5de3b00
doc/08-advanced-topics.md: Reference CheckResult state
Reference the Check Result State Mapping table for the CheckResult state
field. This table covers both Service and Host states while the prior
documentation string only covered Services.

This change is useful since there are different kinds of states for
Hosts when using the Icinga 2 API. For one, there is a "normalized"
version of 0 for UP and 1 for DOWN. Then there is the exit code version
for 0/1 for UP and 2/3 for DOWN. Unfortunately, often this depends on
the context and sometimes even intermingles.

To make it obvious which kind of state one can expect for a CheckResult
object, I have linked to the already existing documentation section.
2025-04-25 09:57:46 +02:00
Johannes Schmidt
353386f404 Abort verified JSON-RPC connections with no valid endpoint 2025-04-23 16:55:16 +02:00
Johannes Schmidt
235a3e1aa5
Merge pull request #10416 from Icinga/jschmidt/sigabrt-handler-fix
Fix SIGABRT not causing a core dump
2025-04-23 16:08:13 +02:00
Yonas Habteab
1da497be89 Fix inverted IsHACluster check 2025-04-23 15:18:06 +02:00
Johannes Schmidt
f4923370ad Update AUTHORS 2025-04-23 10:33:20 +02:00
Johannes Schmidt
43f78a4b86 Fix SIGABRT not causing a core dump
A second abort() is needed at the end of `SigAbrtHandler()` to trigger the SIG_DFL action (in this case the core dump).

Also since `AttachDebugger()` disables the ability to dump core, so
it gets reenabled after returning from it.
2025-04-23 09:13:04 +02:00
Alexander A. Klimov
c2ddd20ef3 Fix compiler warnings by (copy-)constructing loop variables explicitly
for (const T& needle : haystack) creates the illusion that haystack is a
container of T and we're just borrowing needle. In these cases that's not true.
2025-04-22 13:55:49 +02:00
Julian Brost
520aed6049
Merge pull request #10278 from Icinga/boost187
Bump Boost shipped for Windows to v1.87
2025-04-15 18:22:31 +02:00
Julian Brost
d3fae440d4
SpawnCoroutine: move callback into wrapper lambda
f isn't used otherwise in the function, so if possible, it can just be moved into the lambda, avoiding a copy.

Co-authored-by: Alexander Aleksandrovič Klimov <alexander.klimov@icinga.com>
2025-04-15 15:10:12 +02:00
Julian Brost
d1d399f8b3 Avoid multiple #if in a single function call expression
Simply giving two entire call expressions for either Boost version greatly
improves readability in my opinion.
2025-04-14 17:30:19 +02:00
Julian Brost
ccfc72267f Prefer icinga::String::GetData() over icinga::String::CStr()
Creating the string_view from the std::string (as returned by GetData()) uses
the stored length instead of having to detect it by finding '\0'.
2025-04-14 17:30:19 +02:00
Alexander A. Klimov
fb2b2e2d5b Don't use removed boost::asio::spawn() overload if Boost >= v1.87 2025-04-14 17:30:19 +02:00
Alexander A. Klimov
0662f2b719 In a coroutine, re-throw everything ex. std::exception (and inheritors)
not just boost::coroutines::detail::forced_unwind.

This is needed because as of Boost 1.87, boost::asio::spawn() uses Fiber, not Coroutine v1.
https://github.com/boostorg/asio/commit/df973a85ed69f021

This is safe because every actual exception shall inherit from std::exception. Except forced_unwind and its Fiber equivalent, so that `catch(const std::exception&)` doesn't catch them and only them.
2025-04-14 17:30:19 +02:00
Alexander Aleksandrovič Klimov
011c67964e Don't use boost::asio::io_context::strand method removed in Boost 1.87 2025-04-14 17:30:19 +02:00
Alexander Aleksandrovič Klimov
7bd35d8c6b Don't use boost::asio::ip::tcp::resolver::query
It was removed in Boost 1.87.
2025-04-14 17:30:19 +02:00
Alexander Aleksandrovič Klimov
11ab869016 Bump Boost shipped for Windows to v1.87 2025-04-14 17:30:19 +02:00
Yonas Habteab
9cc3971288
Merge pull request #10352 from Icinga/checkable-checkercomponent-fixed-timestamp-debug-logs
Fixed double output for timestamps in debug log
2025-04-14 12:16:51 +02:00
Alvar Penning
2ce34e8134
Fixed double output for timestamps in debug log
The timestamps used both in the CheckerComponent and Checkable debug
logs were printed in the scientific notation, making them effectively
useless.

> debug/CheckerComponent: Scheduling info for checkable 'host!service' (2025-02-26 14:53:16 +0100): Object 'host!service', Next Check: 2025-02-26 14:53:16 +0100(1.74058e+09).
> debug/Checkable: Update checkable 'host!service' with check interval '300' from last check time at 2025-02-26 14:48:47 +0100 (1.74058e+09) to next check time at 2025-02-26 14:58:12 +0100 (1.74058e+09).

Switching to std::fixed actually shows the complete Unix timestamp.

> debug/CheckerComponent: Scheduling info for checkable 'host!service' (2025-02-26 15:36:44 +0000): Object 'host!service', Next Check: 2025-02-26 15:36:44 +0000 (1740584204).
> debug/Checkable: Update checkable 'host!service' with check interval '60' from last check time at 2025-02-26 15:37:11 +0000 (1740584232) to next check time at 2025-02-26 15:38:09 +0000 (1740584290).
2025-04-14 10:09:42 +02:00