14033 Commits

Author SHA1 Message Date
Alexander A. Klimov
a943c4588b Zone#GetEndpoints(): return endpoints in the specified order, not randomly
ApiListener#RelayMessageOne() relays every given message to the first connected endpoint Zone#GetEndpoints() returns. Randomness in combination with bad luck can direct more traffic (from a particular network segment) to one master than the admin wants.

This change lets the Zone#endpoints order prefer one endpoint over the other.
2025-03-25 13:04:41 +01:00
Yonas Habteab
5e902fe4a7
Merge pull request #10380 from Icinga/sync-notified-problem-users-correctly
ClusterEvents: Sync & process notification `notified_problem_users`
2025-03-18 10:27:28 +01:00
Yonas Habteab
3083a32bc6
Merge pull request #10301 from Icinga/ssl-shutdown-new-client-handler
ApiListener: Simplify deferred SSL shutdown in `NewClientHandlerInter…
2025-03-17 13:12:03 +01:00
Yonas Habteab
a904f4bf4b
Merge pull request #10381 from Icinga/enable-dependabot
Enable dependabot for GitHub Actions
2025-03-17 12:16:30 +01:00
Yonas Habteab
55885e0cd9 Enable dependabot for GitHub Actions 2025-03-17 10:09:37 +01:00
Yonas Habteab
66cc6a4d8a ClusterEvents: Sync & process notification notified_problem_users 2025-03-14 14:13:55 +01:00
Yonas Habteab
fa63fda75b ApiListener: Simplify deferred SSL shutdown in NewClientHandlerInternal() 2025-03-13 12:12:28 +01:00
Yonas Habteab
8714f72d65
Merge pull request #10368 from Icinga/GHAdeb32
GitHub actions: also test the still packaged 32-bit Debian
2025-03-12 16:03:39 +01:00
Julian Brost
e6ad2199fc
Merge pull request #10360 from Icinga/dependency-cycle-detection
Rework dependency cycle detection
2025-03-12 15:58:44 +01:00
Yonas Habteab
84f719ee4f
Merge pull request #10373 from Icinga/Al2Klimov-patch-8
GitHub actions: run ninja with -v
2025-03-12 11:57:40 +01:00
Julian Brost
8e7e687b96 Unify depependency cycle check code.
This commit removes a distinction in how dependency objects are checked for
cycles in the resulting graph depending on whether they are part of the
initially loaded configuration during process startup or as part of a runtime
update.

The DependencyCycleChecker helper class is extended with a mechanism that
allows additional dependencies to be considered during the cycle search. This
allows using it to check for cycles before actually registering the
dependencies with the checkables.

The aforementioned case-distinction for initial/runtime-update config is
removed by making use of the newly added BeforeOnAllConfigLoaded signal to
perform the cycle check at once for each batch of dependencies inside
ConfigItem::CommitNewItems() for both cases now. During the initial config
loading, there can be multiple batches of dependencies as objects from apply
rules are created separately, so parts of the dependency graph might be visited
multiple times now, however that is limited to a minimum as only parts of the
graph that are reachable from the newly added dependencies are searched.
2025-03-12 11:53:30 +01:00
Julian Brost
c1b270f39f Rework dependency cycle check
This commit groups a bunch of structs and static functions inside
dependency.cpp into a new DependencyCycleChecker helper class. In the process,
the implementation was changed a bit, the behavior should be unchanged except
for a more user-friendly error message in the exception.
2025-03-12 11:53:30 +01:00
Julian Brost
500ad70b8c Implement std::hash<boost::intrusive_ptr<T>> for old Boost versions
Boost only implements it iself starting from version 1.74, but a specialization
of std::hash<> can be added trivially to allow the use of
std::unordered_set<boost::intrusive_ptr<T>> and
std::unordered_map<boost::intrusive_ptr<K>, V>.

Being unable to use such types already came up a few types in the past, often
resulting in the use of raw pointer instead which always involves an additional
"is this safe?"/"could the object go out of scope?" discussion. This commit
simply solves this for the future by simply allowing the use of intrusive_ptr
in unordered containers.
2025-03-12 11:53:30 +01:00
Julian Brost
4b18f62a11 Add ConfigType::BeforeOnAllConfigLoaded signal
Allows to hook into the config loading process just before OnAllConfigLoaded()
is called on a bunch of individual config objects. Allows doing some operations
more efficiently at once for all objects.

Intended use: when adding a number of dependencies, it has to be checked
whether this uses any cycles. This can be done more efficiently if all
dependencies are checked at once. So far, this is with a case-distinction for
initially loaded files in DaemonUtility::LoadConfigFiles() and for dependencies
created by runtime updates in Dependency::OnAllConfigLoaded(). The mechanism
added by this commit allows to unify the handling of both cases (done in a
following commit).
2025-03-12 11:53:30 +01:00
Alexander Aleksandrovič Klimov
cc5f01d47f
GitHub actions: run ninja with -v
to show all compiler flags.
2025-03-12 09:57:16 +01:00
Alexander A. Klimov
7962121faa GitHub actions: also test the still packaged 32-bit Debian 2025-03-11 16:11:05 +01:00
Julian Brost
cefe1bc27a
Merge pull request #10365 from Icinga/string-vector-move-test
Avoid undefined behavior in string/vector_move test
2025-03-10 14:51:20 +01:00
Julian Brost
784867b3f7 Avoid undefined behavior in string/vector_move test
vec[1] is equivalent to vec[vec.size()] at that point and thus not a valid
element of the vector, making the use of operator[] undefined behavior here.
With some compiler flags (like those used in package builds on RHEL and
similar), the compiler (rightfully) aborts the program on this out of bounds
access:

     68/178 Test  #68: base-base_string/vector_move ............................................***Failed    0.01 sec
    /usr/include/c++/14/bits/stl_vector.h:1130: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = icinga::String; _Alloc = std::allocator<icinga::String>; reference = icinga::String&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
    Running 1 test case...
    unknown location(0): fatal error: in "base_string/vector_move": signal: SIGABRT (application abort requested)
    /builds/packages/icinga2/packaging/fedora/41/BUILD/icinga2-2.14.5+467.g206d7cda1-build/icinga2-2.14.5+467.g206d7cda1/test/base-string.cpp(120): last checkpoint
    *** 1 failure is detected in the test module "icinga2"

This commit fixes this by taking the indirection through .data() and using
plain pointer arithmetic instead.
2025-03-10 09:28:33 +01:00
Yonas Habteab
206d7cda1b
Merge pull request #10359 from Icinga/do-not-publish-useless-stats
IcingaDB: Don't publish useless data to Redis
2025-03-07 12:51:10 +01:00
Yonas Habteab
35520b59f0
Merge pull request #10353 from Icinga/fix-string-move-constructor-and-assignment-operator
Fix string move constructor and assignment operator
2025-03-07 12:50:47 +01:00
Yonas Habteab
3e9292a349 Value: Add a specialized rvalue reference of Get()
The move `String(Value&&)` constructor tries to partially move `String`
values from a `Value` type. However, since there was no an appropriate
`Value::Get<T>()` implementation that binds to the requested move
operation, the compiler will actually not move the value but copy it
instead as the only available implementation of `Value::Get<T>()`
returns a const reference `const T&`. This commit adds a new overload
that returns a non-const reference and allows to optionally move the string
value of a Value type.
2025-03-07 10:16:31 +01:00
Julian Brost
e308552ecc Add test that std::vector<icinga::String> uses move overloads 2025-03-06 13:02:40 +01:00
Yonas Habteab
6a888e1494 String: Mark move constructor & assignment op as noexcept
The Icinga DB code performs intensive operations on certain STL containers,
primarily on `std::vector<String>`. Specifically, it inserts 2-3 new elements
at the beginning of a vector containing thousands of elements. Without this commit,
all the existing elements would be unnecessarily copied just to accommodate the new
elements at the front. By making this change, the compiler is able to optimize STL
operations like `push_back`, `emplace_back`, and `insert`, enabling it to prefer the
move constructor over copy operations, provided it is guaranteed that no exceptions
will be thrown.
2025-03-06 13:02:40 +01:00
Yonas Habteab
6ca0611f3d IcingaDB: Don't publish useless data to Redis
The Icinga DB daemon processes the data from the `IcingaApplication`
type only and Icinga DB Web also uses only those stats. However, before
this commit, Icinga DB published all kinds of useless stats to Redis
each second, like the number of (un)reachable hosts, services, and so
on, which is waste of CPU and some other resources. This commit reduces
the published data drastically to only those simple stats coming from
the `IcingaApplication` type.
2025-03-04 17:34:38 +01:00
Alexander Aleksandrovič Klimov
5c651e45a3
Merge pull request #10356 from Icinga/fix-mixed-compiler-args
Don't mix C and C++ compiler flags
2025-03-03 18:56:04 +01:00
Yonas Habteab
3fcc909cdc Don't mix C and C++ compiler flags 2025-03-03 16:52:58 +01:00
Julian Brost
f308bb154a
Merge pull request #8010 from netphantm/feature/itl-enable-extra-opts-7630
ITL: add --extra-opts to plugins supporting it
2025-02-10 10:03:04 +01:00
Julian Brost
1df7f3f7c7 ITL docs: add missing nscp_extra_opts 2025-02-06 17:09:18 +01:00
Julian Brost
988ba18be0 ITL docs: list curl_extra_opts as last variable
Other plugins list --extra-opts last as it's often some kind of feature of last
resort as it provides an option that can't be set in another way. For
consistency, this also moves it to the end for the curl check command.
2025-02-06 16:49:42 +01:00
Julian Brost
b4baf1cbdd
Merge pull request #10342 from Icinga/test-formatdatetime-32bit
tests: fix FormatDateTime with 32-bit time_t
2025-02-05 13:41:29 +01:00
Julian Brost
f1f10fdd9e tests: fix FormatDateTime with 32-bit time_t
With a 32-bit time_t, two checks in the FormatDateTime test case didn't work
properly so far:

1. Every time_t value can be represented by struct tm, hence the test makes no
   sense on such platforms and is now disabled there similar to how it's
   already done with other checks in the same function.
2. std::nextafter(2147483647, +double_limit::infinity())) results in something
   like 2147483647.000000238 which simply results in the limit when cast back
   to an integer type, so it didn't actually test the overflow. This is fixed
   by an additional std::ceil()/std::floor().
2025-02-05 11:21:15 +01:00
Julian Brost
21c9ad5323
Merge pull request #10332 from Icinga/do-not-close-connection-in-request-cert-handler
Don't abruptly close anonymous connections
2025-02-04 10:58:17 +01:00
Alexander Aleksandrovič Klimov
25d9fb51a2
Merge pull request #10225 from Icinga/Wsuggest-override
Always compile with -Wsuggest-override not to forget `override`
2025-02-04 10:35:02 +01:00
Alexander Aleksandrovič Klimov
065dfe4c40
Merge pull request #9928 from Icinga/no-data-received-on-new-api-connection
API: also log error behind "No data received on new API connection"
2025-02-03 15:39:26 +01:00
Angel Roman
dda0da6bf8
Merge pull request #10317 from legna-namor/patch-1
Remove RHEL 7 from installation instructions
2025-01-31 10:50:41 +00:00
Yonas Habteab
25bbac1677 Don't abruptly close anonymous connections
This was mistakenly introduced with PR #7686 due to too many open
connections (#7680). This was wrong in the sense that closing the
connection is simply out of place here and should have been handled
differently. After we revised the RPC connection disconnect procedure
with `v2.14.4`, it becomes clear why it is wrong, because the connection
is closed abruptly before the corresponding response (`result`) has
even been written. Now if you remove the disconnect here, shouldn't the
issue #7680 occur again, you ask? The answer is no, because we now also
have a maximum timeout of `10s` for anonymous connections, after which
they are automatically closed. Thanks to the introduction of this
timeout by @julianbrost in #8479, this `Disconnect()` call has become
superfluous.
2025-01-30 17:45:27 +01:00
Julian Brost
51c6a58657
Merge pull request #9943 from Icinga/renegotiation-openbsd
Disable TLS renegotiation and fix compile error on OpenBSD
2025-01-30 15:50:07 +01:00
Alexander A. Klimov
e1a4390b9c Fix compile error on OpenBSD which has no SSL_OP_NO_RENEGOTIATION 2025-01-29 17:42:10 +01:00
Julian Brost
fe85bf1295
Merge pull request #10318 from Icinga/update-migration-docs
Include Nagios in the migration docs
2025-01-24 13:55:06 +01:00
Yonas Habteab
8f12831a61
Merge pull request #10322 from Icinga/missing-x-for-mail-notification
docs: Document `mail-{host,service}-notification` `-X` option
2025-01-24 13:36:16 +01:00
Yonas Habteab
275753e49b docs: Document mail-{host,service}-notification -X option 2025-01-24 11:33:10 +01:00
Alexander A. Klimov
411c57aac5 API: also log error behind "No data received on new API connection" 2025-01-24 11:28:16 +01:00
Julian Brost
78883669d3
Merge pull request #8169 from Icinga/bugfix/object-query-all-attrs-8167
GET /v1/objects/*: handle "attrs":[] as expected
2025-01-24 09:14:17 +01:00
Blerim Sheqa
2639579374 Include Nagios in the migration docs 2025-01-23 09:27:17 +01:00
Alexander Aleksandrovič Klimov
d55c3644a2
Merge pull request #10312 from Icinga/win-configure-cmake-opts
tools/win32/configure*.ps1: allow custom $CMAKE_ARGS (JSON array)
2025-01-22 10:09:55 +01:00
Alexander A. Klimov
4175a47314 tools/win32/configure*.ps1: allow custom $CMAKE_ARGS (JSON array) 2025-01-21 18:17:05 +01:00
Alexander A. Klimov
e18c923abb GET /v1/objects/*: handle "attrs":[] as expected
... i.e. yield no attrs and not all.

refs #8167
2025-01-21 11:36:55 +01:00
Bruno Lingner
daf36ae362 add _extra_opts argument to plugins that support it 2025-01-20 14:13:28 +01:00
Alexander Aleksandrovič Klimov
866db3ba3c
Merge pull request #10137 from Icinga/win-progfiles-icinga2-var
On Windows, don't create C:\Program Files\Icinga2\var during MSI build
2025-01-16 12:02:33 +01:00
Julian Brost
4ffe88e263
Merge pull request #9732 from Icinga/silence-compiler-warnings-in-code-we-don-t-maintain
Silence compiler warnings in code we don't maintain
2025-01-15 16:33:24 +01:00