14392 Commits

Author SHA1 Message Date
Yonas Habteab
5f3b7d2337 test: add basic checker scheduling test cases 2025-09-25 17:48:06 +02:00
Yonas Habteab
39c1d10583 checker: make result timer interval configurable for testing 2025-09-25 17:48:06 +02:00
Yonas Habteab
62a43a6d4a tests: raise Concurrency config in global app fixture 2025-09-25 17:48:05 +02:00
Yonas Habteab
5af6b3b2f5 tests: fix min severity doesn't get updated
If the logger is started with `Activate()` before `SetActive()`, it won't
log anything, as the logger updates the "min severity" value of loggers
only when starting them, and if they're not active at that point, they
will just be ignored, so the min severity remains at info.
2025-09-25 17:48:05 +02:00
Yonas Habteab
9a5fd4bf96 ClusterEvents: add special special handling for SetNextCheck events 2025-09-24 16:00:09 +02:00
Yonas Habteab
a58a69f715 Drop the now superfluous OnNextCheckUpdated signal 2025-09-24 16:00:09 +02:00
Yonas Habteab
b1e3a8a436 Let Icinga DB & IDO subscribe to OnNextCheckChanged signal
It also removes the extra `SendNextUpdate()` call from the
`NewCheckResultHandler` handler in Icinga DB, since it's subscribed to
the `NextCheckChanged` event anyway and that event is always emitted
before the `NewCheckResult` event gets triggered. This call became
redundant.
2025-09-24 16:00:09 +02:00
Yonas Habteab
fc8de9e087 Introduce OnRescheduleCheck signal & make use of it where appropriate
This commit introduces a new kinda special `OnRescheduleCheck` signal
that is emitted whenever we want to inform the checker to reschedule the
checkable at a specific timestamp without actually changing the next
check time. Previously, we called `SetNextCheck` with some random
timestamp just to enforce the checker to either pick it up immediately
or at a specific time. Then at some point in time, subscribing to the
`OnNextCheckChanged` signal became effectively unusable for any other
purpose than to inform the checker about a new next check time. Thus,
it resulted in introducing a new signal that is solely responsible for
informing the Icigna DB and IDO about a new next check time in places
where calling `SetNextCheck` did make sense. This commit does quite the
opposite: it replaces all calls to `SetNextCheck` that were only used to
inform the checker about a new next check time wit `OnRescheduleCheck`
calls. Only places where we actually wanted to change the next check time
still call `SetNextCheck` and thus inform the checker and all other listeners
about the new next check time. And as a bonus point, we now got rid of the
two object locks for child and parent at the same time.
2025-09-24 16:00:09 +02:00
Yonas Habteab
f049f5258a Checkable: update next_check ts in ExecuteCheck only if it's needed
Since the scheduler accounts for already running checks, we only need to
update the `next_check` timestamp in `Checkable::ExecuteCheck()` only
where it actually makes sense to do so, and as for local checks this
doesn't make sense at all. There only two cases where we need to update
the next check beforehand:

1) The execute command event is sent to a connected remote endpoint, so
   we need to set the next check to a time in the future until we actually
   receive the check result back from the remote endpoint. However, it must
   not be too far in the future to avoid that the check is not re-run for
   too long in case the remote endpoint never responds.
2) The check is a remote check, but either the endpoint is currently syncing
   replay logs or not connected at all, and we are within the magical 5min
   cold startup window. In these cases, the check is effectively skipped, and
   there will be no check result for it coming in, we manually update the next
   check normally as if the check was executed.

In the other cases, either the check is executed locally, which means the
`m_RunningCheck` flag already prevents the scheduler from re-running the check,
or this is a remote check and the endpoint is not connected, but we are outside
the cold startup window, in which case we also don't do anything as we've already
called `Checkable::ProcessCheckResult()` with an appropriate error state, which
in turn will call `Checkable::UpdateNextCheck()`.
2025-09-24 10:15:41 +02:00
Yonas Habteab
5fe6b68b89 Checker: never reschedule checkables with already running checks
This commit changes the ordering of CheckableScheduleInfo in the
multi-index container to ensure that checkables with running checks are
pushed to the end of the ordering. This prevents them from being
prioritized for scheduling ahead of others, which could lead to
unnecessary CPU load due to repeated scheduling attempts. By using a
very large value for the index of checkables with running checks, they
are effectively deprioritized until their current check is completed and
they can be reinserted with their actual next check time.
2025-09-24 10:15:41 +02:00
Yonas Habteab
c2c9b6b159
Merge pull request #10561 from Icinga/cert-fixture-no-symlinks
Rename/Move certificates in unit test fixture instead of symlinking
2025-09-19 12:21:16 +02:00
Johannes Schmidt
9469478d7c Rename/Move existing certs/ca instead of symlinking 2025-09-16 13:35:18 +02:00
Julian Brost
2063d2bdbc
Merge pull request #10505 from Icinga/docker-v2
Rework docker images build
2025-09-15 12:52:29 +02:00
Julian Brost
9f980bde70
Merge pull request #10556 from Icinga/ubuntu-24.10-eol
GitHub Actions: remove Ubuntu 24.10 (end of life)
2025-09-15 11:44:52 +02:00
Julian Brost
4897ea908a
Merge pull request #10550 from Icinga/fix-long-running-tests
Fix annoying long-running tests
2025-09-15 11:43:44 +02:00
Julian Brost
9e5882ea04 GitHub Actions: remove Ubuntu 24.10 (end of life)
That version went out of support in July 2025 [1] and by now the repos got
archived and causes pipelines to fail [2]:

   Err:5 http://security.ubuntu.com/ubuntu oracular-security Release
     404  Not Found [IP: 185.125.190.83 80]
   Err:6 http://archive.ubuntu.com/ubuntu oracular Release
     404  Not Found [IP: 185.125.190.36 80]
   Err:7 http://archive.ubuntu.com/ubuntu oracular-updates Release
     404  Not Found [IP: 185.125.190.36 80]
   Err:8 http://archive.ubuntu.com/ubuntu oracular-backports Release
     404  Not Found [IP: 185.125.190.36 80]

[1]: https://ubuntu.com/about/release-cycle
[2]: https://github.com/Icinga/icinga2/actions/runs/17671678861/job/50224642536#step:5:25
2025-09-15 09:03:42 +02:00
Yonas Habteab
5f862ce3bb HttpServerConnection: use std::chrono for m_Seen 2025-09-12 13:40:36 +02:00
Yonas Habteab
a2b44c0fbb tests: speed up timer tests using smaller sleep times 2025-09-12 12:54:18 +02:00
Yonas Habteab
97ad0fc552 Make HTTP livness timout configurable for unittests
It's annoying to have to wait 10 seconds for the `liveness_disconnect`
test to complete, so make the timeout configurable and set it to a way
lower value to test the functionality.
2025-09-12 12:54:18 +02:00
Julian Brost
cfbad92d9b
Merge pull request #10528 from Icinga/cmake-discover-boost-tests
Automatically discover unit-tests and test fixture dependencies
2025-09-12 12:20:58 +02:00
Yonas Habteab
8ea11128a4 don't install boost dev in the final image 2025-09-10 15:15:00 +02:00
Johannes Schmidt
2461c2364f Drop ICINGA2_WITH_TESTS option in favor of CTest's BUILD_TESTING
There is no need to use our own option for this when an official
one exists. Even worse, on the current master, if we set ours to
on and the official one to OFF, the tests directory is included,
but the add_boost_test() command skips building/adding them, which
forces us to wrap additional calls to set_tests_properties() in
a check on the official option.
2025-09-10 13:48:28 +02:00
Johannes Schmidt
b4681b10ec Discover Boost test cases automatically after build
This adds a global fixture that can parse an additional argument to
the test executables (`--generate_ctest_config`). When run by
CMake during build, this generates a CTest script containing all
the tests and their properties.

An additional decorator, that defines CTest properties for a test case
or suite that will be added to the tests during config generation.

This version needs no hacks, no huge CMake scripts, just a bit of
additional C++ code that iterates over all test-cases and collects
the information CTest needs.

One caveat is still that this does not work with cross-compilation,
which probably isn't an issue to begin with, but there are also ways
to fix that if necessary.
2025-09-10 13:48:24 +02:00
Johannes Schmidt
38ea1bb39c Fix rediscovered test-cases in icinga-checkresult
Co-authored-by: Yonas Habteab <yonas.habteab@icinga.com>
2025-09-09 16:09:00 +02:00
Julian Brost
87df80d322
Merge pull request #10516 from Icinga/http-handlers-stream-refactor
Refactor HTTP connection handling and some handlers to stream responses
2025-08-29 11:33:34 +02:00
Yonas Habteab
3bf1e6e88a Bump base image version to Debian 13 (trixie)
It's going to be released tomorrow, so let's use the latest Debian release
as the base image while we are at it. Also run always `apt upgrade` to upgrade
any outdated packages (if any).
2025-08-28 16:09:47 +02:00
Yonas Habteab
28aec98aa1 workflows: drop docker.yml 2025-08-28 16:09:47 +02:00
Yonas Habteab
5ffdb7d746 workflows: build and publish container images 2025-08-28 16:09:47 +02:00
Yonas Habteab
bdfdc7e7dc docs: Add For-Container.md 2025-08-28 16:09:47 +02:00
Yonas Habteab
5e074e3de8 Add Containerfile
Previously, the https://github.com/Icinga/docker-icinga2 repository was
used to build the Docker images for Icinga 2. However, due to its
various design flaws, the resulted images had limited usability and
required a lot of manual tweaking to make something useful out of them.
This commit now follows our new principles of building Docker images
from the Icinga DB repository, and replaces the old separate repository
with this one. It makes use of the newest Docker BuildKit features to
build the images in a more efficient way, while also granting users full
flexibility to easily extend or modify the images as they see fit
without any issues.
2025-08-28 16:09:46 +02:00
Johannes Schmidt
7373f36cc5 Add unit-tests for HttpServerConnection and HTTP message classes 2025-08-28 13:22:18 +02:00
Johannes Schmidt
4782ea8a75 Make inherited protected functions of ApiListener public
This is needed so it's possible to manually add an ApiListener object
for the purpose of unit-testing.
2025-08-28 13:22:18 +02:00
Johannes Schmidt
bb75d73012 Refactor ObjectQueryHandler to use new JSON stream encoder 2025-08-28 13:22:18 +02:00
Johannes Schmidt
62b2dadbac Remove extra parameters from HTTP handler signature
These parameters are no longer needed since they were only used
by EventsHandler which was refactored in an earlier commit.
2025-08-28 13:22:18 +02:00
Johannes Schmidt
d32f04a863 Refactor EventsHandler to stream responses via chunked encoding 2025-08-28 13:22:18 +02:00
Johannes Schmidt
3832bb4296 Use new HTTP message classes in HttpServerConnection and Handlers 2025-08-28 13:22:18 +02:00
Johannes Schmidt
37df843700 Add HttpRequest and HttpResponse classes 2025-08-28 13:22:15 +02:00
Julian Brost
0c2fd00383
Merge pull request #10538 from Icinga/allow-uid-gid-icinga-user-and-group
Allow UID/GID in ICINGA2_(USER|GROUP) environment variables
2025-08-27 11:00:50 +02:00
Johannes Schmidt
3ebe95ba8c Allow UID/GID in ICINGA2_(USER|GROUP) environment variables 2025-08-25 14:31:19 +02:00
Alexander Aleksandrovič Klimov
9905e9af32
Merge pull request #10389 from Icinga/zone-endpoint-order
Zone#GetEndpoints(): return endpoints in the specified order, not randomly🎲
2025-08-22 10:11:51 +02:00
Alexander Aleksandrovič Klimov
5f2ee6e119
Merge pull request #10393 from Icinga/zone-endpoint-log
ApiListener#RelayMessageOne(): log🪵 to which Endpoint messages are relayed
2025-08-22 10:11:25 +02:00
Lorenz Kästle
a218ba8d92
Remove clear variable from disk CheckCommand
This commit removes the -C parameter from the disk CheckCommand
since there is no possible way to use it in any functional capacity.

-C (or --clear) would reset the thresholds given previously
to allow for setting different thresholds for following filesystmes.
As an example:

check_disk -w 50% -c 5% -p / -C -w 1%  -p /home

would only set the warning threshold for /home.

Since there is no way to use it reasonably with the Icinga 2
implementation of check_disk (since thresholds can only be
given once and the order is undefined), the clear flag
has no worth here.

My suggestion is to remove it avoid suggesting that it might
be used, but I left it as a comment in the ITL to prevent
the next person from "adding a missing parameter".
2025-08-19 10:58:48 +00:00
Alvar
d1582766ec
Merge pull request #10526 from Tqnsls/patch-1
add "--long-output" to ssl_cert command
2025-08-18 12:47:18 +00:00
Silas
124d191afa
add "--long-output" to ssl_cert command
Co-Authored-By: Julian Brost <julian.brost@icinga.com>
2025-08-18 12:06:40 +02:00
Alexander A. Klimov
17b49bd5b6 ApiListener#RelayMessageOne(): log to which Endpoint messages are relayed
if they're for our parent Zone.
2025-08-15 11:03:55 +02:00
Alexander Aleksandrovič Klimov
20d9af0d32
Merge pull request #10536 from Icinga/Al2Klimov-patch-3
GHA: add Debian 13
2025-08-15 10:39:33 +02:00
Alexander Aleksandrovič Klimov
0ecbfa93dd
Merge pull request #10537 from Icinga/Boost1.89
Bump Boost shipped for Windows to v1.89
2025-08-15 10:06:00 +02:00
Alexander A. Klimov
5a83f153b7 Bump Boost shipped for Windows to v1.89 2025-08-14 11:06:37 +02:00
Alexander A. Klimov
76fa0d9e80 Boost: don't require "system" component
It's vanished in v1.89.
2025-08-14 11:06:37 +02:00
Alexander Aleksandrovič Klimov
00295cb64b
GHA: add Debian 13 2025-08-13 12:19:16 +02:00