6558 Commits

Author SHA1 Message Date
Alexander A. Klimov
cfc55322fb Change RedisConnection::Query::value_type from String to std::variant<const char*,String>
Especially our history messages contain lots of hardcoded C string literals "like this one". At runtime, they get translated to pointers to constant global memory, const char*. String malloc(3)s and copies these data every time. In contrast, std::variant<const char*,String> just stores the address if any. (Actually, const char* is wrapped by std::string_view to not compute its length every time.)
2025-04-07 14:59:28 +02:00
Alexander A. Klimov
384a9444fc Introduce String#String(const std::string_view&) 2025-04-07 14:59:28 +02:00
Alexander A. Klimov
b668b4de90 Introduce String#operator std::string_view() 2025-04-07 14:59:28 +02:00
Alexander A. Klimov
7958048a72 Use RedisConnection::Quer* type aliases instead of (the equivalent std::vector)
This expresses what kind of vector it is and allows to easily change those types in the future.
2025-04-07 14:59:25 +02:00
Julian Brost
5a6b2044b1
Merge pull request #10290 from Icinga/icingadb-dependencies-sync
Sync dependencies to Redis
2025-04-04 15:13:05 +02:00
Julian Brost
31a224c509 Checkable::GetSeverity(): always take reachability into account
So far, Service::GetSeverity() only considered the state of its own host, i.e.
the implicit service to its own host dependency, and treated it similar to
acknowledgements and downtimes. In contrast, Host::GetSeverity() considered
reachability and treated it like a state, i.e. for the severity calculation,
the host was either up, down, or unreachable.

This commit changes the following things:
1. Make the service severity also consider explicitly configured dependencies
   by using IsReachable().
2. Prefer acknowledgements and downtimes over unreachability in the severity
   calculation so that if an already acknowledged or in-downtime services (i.e.
   already handled service) becomes unreachable, it shouln't become more
   severe.
3. To unify host and service severities a bit, hosts now use the same logic
   that treats reachability more like acknowledgements/downtimes instead of
   like a state (changing the other way around would the state from the check
   plugin would not affect the severity for unrachable services anymore).
2025-03-31 15:23:51 +02:00
Julian Brost
1e05a166f1 Host::GetSeverity(): remove empty line at end of method 2025-03-31 15:23:51 +02:00
Julian Brost
d8271c6568 Host::GetSeverity(): remove explicit unlocking
No change in functionality. The ObjectLock destructor will implicitly release
the locks when returning from the function.
2025-03-31 15:23:51 +02:00
Julian Brost
2ebee010f0 Host::GetHost(): return early to remove a nesting level
No change in functionality. The first two branches actually set the final
return value for the method, so they can just return directly, removing the
need to have the rest of the function inside an else block.
2025-03-31 15:23:51 +02:00
Julian Brost
6443f8997f Host::GetSeverity(): add braces to if statements
No change in functionality, just makes the code a bit nicer.
2025-03-31 15:23:51 +02:00
Julian Brost
c899d52e2f Service::GetSeverity(): remove explicit unlocking
No change in functionality. The ObjectLock destructor will implicitly release
the locks when returning from the function.
2025-03-31 15:23:50 +02:00
Julian Brost
01acfb47a9 Service::GetHost(): return early to remove a nesting level
No change in functionality. The first two branches actually set the final
return value for the method, so they can just return directly, removing the
need to have the rest of the function inside an else block.
2025-03-31 15:23:50 +02:00
Julian Brost
5ca6047b35 Service::GetSeverity(): replace switch with if
No change in functionality, just making the code a bit more compact.
2025-03-31 15:23:50 +02:00
Julian Brost
a1865e1b43 Service::GetSeverity(): simplify nested if, add braces
No change in functionality, just making the code a bit nicer and more compact.
2025-03-31 15:23:50 +02:00
Yonas Habteab
bc2c750551 IcingaDB: Don't stream runtime state updates to Redis 2025-03-26 10:48:37 +01:00
Julian Brost
061338156c
Merge pull request #10345 from Icinga/remove-child-downtimes
ApiActions: Remove child downtimes recursively
2025-03-21 16:37:43 +01:00
Alexander Aleksandrovič Klimov
adde9cc53b
Merge pull request #10222 from Icinga/Registry-cleanup
Clean up Registry class
2025-03-21 11:00:49 +01:00
Julian Brost
065118bc22 Make DependencyGroup::State an enum
The previous struct used two bools to represent three useful states. Make this
more explicit by having these three states as an enum.
2025-03-19 16:28:00 +01:00
Yonas Habteab
864e2aaae0 Drop superfluous mutex lock & don't manually unpack std::tuple 2025-03-19 16:28:00 +01:00
Julian Brost
693d094ebc DependencyGroup: don't change the keys of m_Members after construction
This prevents the use of DependencyGroup for storing the dependencies during
the early registration (m_DependencyGroupsPushedToRegistry = false),
m_PendingDependencies is introduced as a replacement to store the dependencies
at that time.
2025-03-19 16:28:00 +01:00
Yonas Habteab
945a79e37f IcingaDB: Don't send useless dependencies state updates 2025-03-19 16:28:00 +01:00
Yonas Habteab
da637c3741 IcingaDB: Always send dependencies state HSET updates to Redis 2025-03-19 16:28:00 +01:00
Yonas Habteab
21cd5e00fa Dependency: Don't allow to update {period,states,ignore_soft_states} at runtime 2025-03-19 16:28:00 +01:00
Yonas Habteab
a9bb11b16d (Un)register dependencies from parent prior to child Checkable 2025-03-19 16:28:00 +01:00
Yonas Habteab
7fbb8f7452 Evaluate dependency group state only for a specific child
Previously the dependency state was evaluated by picking the first
dependency object from the batched members. However, since the
dependency `disable_{checks,notifications` attributes aren't taken into
account when batching the members, the evaluated state may yield a wrong
result for some Checkables due to some random dependency from other
Checkable of that group that has the `disable_{checks,notifications`
attrs set. This commit forces the callers to always provide the child
Checkable the state is evaluated for and picks only the dependency
objects of that child Checkable.
2025-03-19 16:28:00 +01:00
Julian Brost
ce1ed8556c Simplify DependencyGroup::GetState() implementation
The new implementation just counts reachable and available parents and
determines the overall result by comparing numbers, see inline comments for
more information.

This also fixes an issue in the previous implementation: if it didn't return
early from the loop, it would just return the state of the last parent
considered which may not actually represent the group state accurately.
2025-03-19 16:28:00 +01:00
Yonas Habteab
0ab50fd82d IcingaDB: Process dependencies runtime updates 2025-03-19 16:28:00 +01:00
Yonas Habteab
915ea6427e Use GetParents() in FireSppressedNotifications()
It's way efficient than accessing them through the dependency objects,
plus we won't have any duplicates.
2025-03-19 16:28:00 +01:00
Yonas Habteab
8640a3f84e Checkable: Extract parents directly from dependency groups 2025-03-19 16:28:00 +01:00
Yonas Habteab
806fff950c Checkable: Emit boost signals when changing dependency groups at runtime 2025-03-19 16:28:00 +01:00
Yonas Habteab
67a4889945 Checkable: Delay dependency group global registration on startup 2025-03-19 16:28:00 +01:00
Julian Brost
26f46fe021 Simplify dependency group registration
Co-Authored-By: Yonas Habteab <yonas.habteab@icinga.com>
2025-03-19 16:28:00 +01:00
Yonas Habteab
aed1bb6294 IcingaDB: Introduce ExecuteRedisTransaction() helper method 2025-03-19 16:28:00 +01:00
Yonas Habteab
db3f8dec27 IcingaDB: Sync dependencies initial states on config dump 2025-03-19 16:28:00 +01:00
Yonas Habteab
f502993eb4 IcingaDB: Sync dependencies states to Redis 2025-03-19 16:28:00 +01:00
Yonas Habteab
c6466ee0ea IcingaDB: Dump checkables dependencies config to redis correctly 2025-03-19 15:28:31 +01:00
Richard Mortimer
63926c6e0d
Process: Clean up process table entry even when kill(2) fails with ESRCH (#10375)
* Icinga daemon leaves zombie processes on very busy system

On a very heavily loaded system the process group kill can
be delayed until after the regular TERM signal has caused
the process to exit. In this situation the waitpid call
is valid and reaps the zombie process that would otherwise
be left behind.

* Update AUTHORS file
2025-03-18 11:29:00 +01:00
Alexander A. Klimov
a9e9e14fce Remove unused Registry#Clear() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
4d7361527c Remove unused Registry#RegisterIfNew() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
07b274ec45 Remove unused Registry#Unregister() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
402a6bbf40 Remove unused EventQueue::Unregister() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
d19c0637ee Remove unused EventQueue::UnregisterIfUnused() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
41f61ccba4 Remove unused ApiFunction::Unregister() 2025-03-18 11:22:56 +01:00
Alexander A. Klimov
cce03c5903 Remove unused ApiAction::Unregister() 2025-03-18 11:22:56 +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
66cc6a4d8a ClusterEvents: Sync & process notification notified_problem_users 2025-03-14 14:13:55 +01:00
Yonas Habteab
3d761c0296 ApiActions: Remove child downtimes recursively
Services downtimes scheduled via the `all_services` flag get already
removed automatically when removing their parent downtimes (introduced
with #8913). Now, this commit makes it possible to perform the same actions
for all child downtimes, i.e. not only for those of service objects, but
for all child objects represented in the dependency tree.
2025-03-13 12:13:45 +01:00
Yonas Habteab
fa63fda75b ApiListener: Simplify deferred SSL shutdown in NewClientHandlerInternal() 2025-03-13 12:12:28 +01:00
Yonas Habteab
4bfaefadfa IcingaDB: Bump expected redis version to 6 2025-03-12 16:32:01 +01:00
Yonas Habteab
d094581b4b Checkable: Use redundancy groups state in IsReachable 2025-03-12 16:32:01 +01:00