Commit graph

6817 commits

Author SHA1 Message Date
Yonas Habteab
99328ec417 Log pending items stats regularly & include them as perfdata in IcingaDB check 2026-04-15 17:33:43 +02:00
Julian Brost
267675e80b RedisConnection: simplify GetOldestPendingQueryTs function 2026-04-02 16:37:57 +02:00
Yonas Habteab
7d7159c033 Reduce min queue item age from 1000ms to 300ms 2026-04-02 16:37:57 +02:00
Yonas Habteab
390ee8c02f Inline DequeueAndProcessOne & don't process items out of order
Now, the individual `ProcessQueueItem` functions decide whether to
acquire an `olock` or not instead of probing this from within the
worker loop. This is way easier than having to deal with the potential
out of order processing of items in the queue in both ways, i.e., we
don't want to send delete events for objects while their created events
haven't been processed yet and vice versa.
2026-04-02 16:37:57 +02:00
Julian Brost
855f6c7c0c IcingaDB: use key extractor for worker queue
This commit restructures the queue items so that each one now has a method
`GetQueueLookupKey()` that is used to derive which elements of the queue are
considered to be equal. For this, there is a key extractor for the
`multi_index_container` that takes the `variant` from the queue item, calls
that method on it, and puts the result in a second variant type. The types in
that variant type are automatically deduced from the return types of the
individual methods.
2026-04-02 16:37:57 +02:00
Yonas Habteab
2048450159 IcingaDB: put all queue related stuff into icingadb:task_queue namespace 2026-04-02 16:37:57 +02:00
Julian Brost
8375934d19 Simplify IcingaDB::PendingItemsThreadProc() event loop 2026-04-02 16:37:57 +02:00
Yonas Habteab
b633d6b0d0 IcingaDB: remove unused UpdateObjectAttrs method 2026-04-02 16:37:57 +02:00
Yonas Habteab
89d8c326e6 Fix missing olock for dependency child registration
Previously, the checkable was locked while processing all the dependency
registration stuff, so the worker thread should also do the same to
avoid any potential race conditions.
2026-04-02 16:37:57 +02:00
Julian Brost
9d5883df78 IcingaDB: use polymorphism for queue entries 2026-04-02 16:37:57 +02:00
Yonas Habteab
e88366ddae IcingaDB: subscribe to OnNextCheckChanged signal
We can't drop the `OnNextCheckUpdated` signal entirely yet, as IDO still
relies on it.
2026-04-02 16:37:57 +02:00
Yonas Habteab
485227390f Revert "CheckerComponent#CheckThreadProc(): also propagate next check update to Icinga DB"
This reverts commit e9b8c67975.
2026-04-02 16:37:57 +02:00
Yonas Habteab
bbb7d0249e RedisConnection: enhance WriteQueueItem & related usages 2026-04-02 16:37:57 +02:00
Yonas Habteab
cbb4147055 RedisConnection: simplify query prioritization logic
As opposed to the previous version which used a complex data structure
to correctly manage the query priorities, this version uses two separate
queues for the high and normal priority writes. All high priority writes
are processed in FIFO order but over take all queries from the normal
priority queue. The later queue only be processed when the high priority
queue is empty.
2026-04-02 16:37:57 +02:00
Yonas Habteab
adbefa5540 Revert "IcingaDB: suppress state sync until config sync finished"
This reverts commit f6f7d9b635 and all
other its new users.
2026-04-02 14:06:28 +02:00
Yonas Habteab
d364ad981e IcingaDB: enqueue config runtime updates to the worker queue 2026-04-02 14:06:28 +02:00
Yonas Habteab
26d23bd569 IcingaDB: enqueue all dependency related updates to the worker queue 2026-03-23 11:26:48 +01:00
Yonas Habteab
e6dc594313 IcingaDB: don't send nextupdate:{host,service} as part of the initial sync
Don't send nextupdate as part of the intial sync. Instead, enque them to
the background worker to be sent after the initial dump is done.
2026-03-23 11:26:48 +01:00
Yonas Habteab
eab507f892 IcingaDB: track object changesets efficiently 2026-03-23 11:26:48 +01:00
Yonas Habteab
105c066649 IcingaDB: use a separate Redis conn for history & heartbeat streams 2026-03-23 11:26:47 +01:00
Julian Brost
6592eae21d
Merge pull request #10668 from Icinga/perfdata-writers-connection-handling
Add PerfdatawriterConnection to handle network requests for Perfdata Writers
2026-03-17 15:10:57 +01:00
Johannes Schmidt
da2fc9df01 Use PerfdataWriterConnection in perfdata writers 2026-03-17 12:11:26 +01:00
Yonas Habteab
fa514e6336 IcingaDB: use a statically initialized list of syncable types for Redis keys 2026-03-16 08:39:12 +01:00
Yonas Habteab
cb872ee5c8 IcingaDB: consistently use const char* literals everywhere
Co-Authored-By: Julian Brost <julian.brost@icinga.com>
2026-03-13 16:14:12 +01:00
Yonas Habteab
f593330735 IcingaDB: change const T to const T& to avoid stupid String copying 2026-03-13 16:14:12 +01:00
Johannes Schmidt
8f85e8b72a
Merge pull request #10756 from Icinga/improve-parallel-for
Some checks failed
Container Image / Container Image (push) Has been cancelled
Linux / alpine:bash (push) Has been cancelled
Linux / amazonlinux:2 (push) Has been cancelled
Linux / amazonlinux:2023 (push) Has been cancelled
Linux / debian:11 (linux/386) (push) Has been cancelled
Linux / debian:11 (push) Has been cancelled
Linux / debian:12 (linux/386) (push) Has been cancelled
Linux / debian:12 (push) Has been cancelled
Linux / debian:13 (push) Has been cancelled
Linux / fedora:41 (push) Has been cancelled
Linux / fedora:42 (push) Has been cancelled
Linux / fedora:43 (push) Has been cancelled
Linux / opensuse/leap:15.6 (push) Has been cancelled
Linux / opensuse/leap:16.0 (push) Has been cancelled
Linux / registry.suse.com/bci/bci-base:16.0 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.6 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.7 (push) Has been cancelled
Linux / rockylinux/rockylinux:10 (push) Has been cancelled
Linux / rockylinux:8 (push) Has been cancelled
Linux / rockylinux:9 (push) Has been cancelled
Linux / ubuntu:22.04 (push) Has been cancelled
Linux / ubuntu:24.04 (push) Has been cancelled
Linux / ubuntu:25.04 (push) Has been cancelled
Linux / ubuntu:25.10 (push) Has been cancelled
Windows / Windows (push) Has been cancelled
Improve `WorkQueue::ParallelFor()`
2026-03-13 16:12:32 +01:00
Johannes Schmidt
907f41bae4 Use perfect-forwarding references to prevent passing temporaries
Without this change, it is easy to pass a temporary, for example a vector
returned by a function to ParallelFor(). With this commit a type-constraint
is added to disable the use of this function for rvalue sequences.

An alternative would have been to capture rvalue-references in the function,
but that would have made the function unnecessarily complex, involving tuple-capture
and `shared_ptr`s, while it is usually easy to control lifetime at the call-site.
2026-03-13 13:14:52 +01:00
Johannes Schmidt
eb97638743 Make retrieval of the vector size more generic
This also enables the use of the function with "containers" that
don't have a size function but implement an overload for `std::size()`,
like c-arrays with fixed sizes.
2026-03-12 15:37:24 +01:00
Johannes Schmidt
32ca211ce5
Merge pull request #10681 from Icinga/api-console-missing-lock
/v1/console: prevent concurrent use of the same session by multiple requests
2026-03-12 12:22:17 +01:00
Johannes Schmidt
2e2576c7c5 Add PerfdataWriterConnection class 2026-03-06 10:55:05 +01:00
Alexander Aleksandrovič Klimov
55d35b19dd
Merge pull request #10391 from Icinga/redis-query-variant
Some checks failed
Container Image / Container Image (push) Has been cancelled
Linux / alpine:bash (push) Has been cancelled
Linux / amazonlinux:2 (push) Has been cancelled
Linux / amazonlinux:2023 (push) Has been cancelled
Linux / debian:11 (linux/386) (push) Has been cancelled
Linux / debian:11 (push) Has been cancelled
Linux / debian:12 (linux/386) (push) Has been cancelled
Linux / debian:12 (push) Has been cancelled
Linux / debian:13 (push) Has been cancelled
Linux / fedora:41 (push) Has been cancelled
Linux / fedora:42 (push) Has been cancelled
Linux / fedora:43 (push) Has been cancelled
Linux / opensuse/leap:15.6 (push) Has been cancelled
Linux / opensuse/leap:16.0 (push) Has been cancelled
Linux / registry.suse.com/bci/bci-base:16.0 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.6 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.7 (push) Has been cancelled
Linux / rockylinux/rockylinux:10 (push) Has been cancelled
Linux / rockylinux:8 (push) Has been cancelled
Linux / rockylinux:9 (push) Has been cancelled
Linux / ubuntu:22.04 (push) Has been cancelled
Linux / ubuntu:24.04 (push) Has been cancelled
Linux / ubuntu:25.04 (push) Has been cancelled
Linux / ubuntu:25.10 (push) Has been cancelled
Windows / Windows (push) Has been cancelled
Change Redis query type from `String` to an optional `std::string_view`
2026-03-04 10:38:12 +01:00
Johannes Schmidt
e58947dc45
Merge pull request #10737 from Icinga/better-debug-message-non-existing-host-service-dep
Improve debug message when dependency child/parent don't exist
2026-03-04 10:36:12 +01:00
Johannes Schmidt
56c878d815 Improve debug message when dependency child/parent don't exist
Previously this didn't print which of host/service is referenced
and what the referenced non-existing checkable's name should have
been.

This commit adds that information.
2026-03-03 11:59:44 +01:00
Julian Brost
0d376b5d5a /v1/console: prevent concurrent use of the same session by multiple requests
If there are such requests, without this change, they would all be allowed and
processed, resulting in unsafe concurrent (write) access to these data
structures, which can ultimately crash the daemon or lead to other unintended
behavior.
2026-03-03 11:32:39 +01:00
Julian Brost
0f44133786
Merge pull request #10732 from Icinga/icingadb-efficient-queue-helpers
Some checks are pending
Container Image / Container Image (push) Waiting to run
Linux / alpine:bash (push) Waiting to run
Linux / amazonlinux:2 (push) Waiting to run
Linux / amazonlinux:2023 (push) Waiting to run
Linux / debian:11 (linux/386) (push) Waiting to run
Linux / debian:11 (push) Waiting to run
Linux / debian:12 (linux/386) (push) Waiting to run
Linux / debian:12 (push) Waiting to run
Linux / debian:13 (push) Waiting to run
Linux / fedora:41 (push) Waiting to run
Linux / fedora:42 (push) Waiting to run
Linux / fedora:43 (push) Waiting to run
Linux / opensuse/leap:15.6 (push) Waiting to run
Linux / opensuse/leap:16.0 (push) Waiting to run
Linux / registry.suse.com/bci/bci-base:16.0 (push) Waiting to run
Linux / registry.suse.com/suse/sle15:15.6 (push) Waiting to run
Linux / registry.suse.com/suse/sle15:15.7 (push) Waiting to run
Linux / rockylinux/rockylinux:10 (push) Waiting to run
Linux / rockylinux:8 (push) Waiting to run
Linux / rockylinux:9 (push) Waiting to run
Linux / ubuntu:22.04 (push) Waiting to run
Linux / ubuntu:24.04 (push) Waiting to run
Linux / ubuntu:25.04 (push) Waiting to run
Linux / ubuntu:25.10 (push) Waiting to run
Windows / Windows (push) Waiting to run
RedisConnection class enhancements & refactoring
2026-03-03 11:30:40 +01:00
Alexander A. Klimov
1702eebd41 Change RedisConnection::Query::value_type to a string/view variant
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, the new type just stores the address if any. (Actually,
`const char*` is wrapped by `std::string_view` to not compute its length every
time.)
2026-03-03 11:29:07 +01:00
Julian Brost
851440a583
Merge pull request #10560 from Icinga/influxdb-mist
Don't expect `Contet-Type` header to exactly match `application/json`
2026-03-03 11:28:45 +01:00
Yonas Habteab
c1763e4753 ObjectLock: allow to TryLock the mutex 2026-03-02 15:36:59 +01:00
Yonas Habteab
dd5289bf4e RedisConnection: drop superfluous GetConnected method 2026-03-02 15:36:59 +01:00
Yonas Habteab
e0c239161b Allow to track query stats in child Redis connections
So that when we want the query stats of this specific connection we can
easily get them, since the session leader contains the aggregated stats
of all its children.
2026-03-02 15:36:58 +01:00
Yonas Habteab
4d4650b86a RedisConnection: introduce & use RedisConnInfo helper struct 2026-03-02 15:34:04 +01:00
Alexander A. Klimov
c351f6a88c Use RedisConnection::Quer* type aliases
This expresses what kind of vector it is
and allows to easily change those types in the future.
2026-03-02 12:45:09 +01:00
Alexander A. Klimov
ba1bb0e758 Introduce RedisConnection::QueryArg, an alias of String
to ease changing that type in the future.
2026-03-02 12:45:09 +01:00
Alexander A. Klimov
808a6c77e8 IcingaDB#AddObjectDataToRuntimeUpdates(): take String by value
It was copied anyway.
2026-03-02 12:45:09 +01:00
Johannes Schmidt
240142bcbd Refactor OpenTsdbWriter to use a WorkQueue 2026-02-26 13:31:10 +01:00
Johannes Schmidt
7955d04ae3 Import std::chrono_literals into icinga namespace 2026-02-26 13:31:10 +01:00
Yonas Habteab
f934aa557b Don't expect Contet-Type header to exactly match application/json
InfluxDB seems to always include some other metadata in the `Content-Type`
header separated by semicolons like `application/json; charset=utf-8`,
and comparing the whole string with `application/json` will always fail,
resulting in almost always useless warnings without any helpful information
for the user what actually went wrong.
2026-02-25 15:55:55 +01:00
William Calliari
11726b741c Take a mutex before accessing the l_ApiScriptFrames
Take a mutex to avoid race conditions in the map that lead to
segmentation faults. Move the ApiScriptFrame object back behind a
shared pointer to avoid holding the mutex for too long.

Fixes #10674
2026-02-25 08:37:03 +01:00
Johannes Schmidt
27c954dde8
Merge pull request #10715 from Icinga/fix-ubsan-errors
Some checks failed
Container Image / Container Image (push) Has been cancelled
Linux / alpine:bash (push) Has been cancelled
Linux / amazonlinux:2 (push) Has been cancelled
Linux / amazonlinux:2023 (push) Has been cancelled
Linux / debian:11 (linux/386) (push) Has been cancelled
Linux / debian:11 (push) Has been cancelled
Linux / debian:12 (linux/386) (push) Has been cancelled
Linux / debian:12 (push) Has been cancelled
Linux / debian:13 (push) Has been cancelled
Linux / fedora:41 (push) Has been cancelled
Linux / fedora:42 (push) Has been cancelled
Linux / fedora:43 (push) Has been cancelled
Linux / opensuse/leap:15.6 (push) Has been cancelled
Linux / opensuse/leap:16.0 (push) Has been cancelled
Linux / registry.suse.com/bci/bci-base:16.0 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.6 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.7 (push) Has been cancelled
Linux / rockylinux/rockylinux:10 (push) Has been cancelled
Linux / rockylinux:8 (push) Has been cancelled
Linux / rockylinux:9 (push) Has been cancelled
Linux / ubuntu:22.04 (push) Has been cancelled
Linux / ubuntu:24.04 (push) Has been cancelled
Linux / ubuntu:25.04 (push) Has been cancelled
Linux / ubuntu:25.10 (push) Has been cancelled
Windows / Windows (push) Has been cancelled
Fix undefined behavior discovered with `-fsanitize=undefined`
2026-02-19 08:38:40 +01:00
Julian Brost
d02cdda5e9
Merge pull request #10716 from Icinga/drop-thread-local-variable-apiuser
Some checks failed
Container Image / Container Image (push) Has been cancelled
Linux / alpine:bash (push) Has been cancelled
Linux / amazonlinux:2 (push) Has been cancelled
Linux / amazonlinux:2023 (push) Has been cancelled
Linux / debian:11 (linux/386) (push) Has been cancelled
Linux / debian:11 (push) Has been cancelled
Linux / debian:12 (linux/386) (push) Has been cancelled
Linux / debian:12 (push) Has been cancelled
Linux / debian:13 (push) Has been cancelled
Linux / fedora:41 (push) Has been cancelled
Linux / fedora:42 (push) Has been cancelled
Linux / fedora:43 (push) Has been cancelled
Linux / opensuse/leap:15.6 (push) Has been cancelled
Linux / opensuse/leap:16.0 (push) Has been cancelled
Linux / registry.suse.com/bci/bci-base:16.0 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.6 (push) Has been cancelled
Linux / registry.suse.com/suse/sle15:15.7 (push) Has been cancelled
Linux / rockylinux/rockylinux:10 (push) Has been cancelled
Linux / rockylinux:8 (push) Has been cancelled
Linux / rockylinux:9 (push) Has been cancelled
Linux / ubuntu:22.04 (push) Has been cancelled
Linux / ubuntu:24.04 (push) Has been cancelled
Linux / ubuntu:25.04 (push) Has been cancelled
Linux / ubuntu:25.10 (push) Has been cancelled
Windows / Windows (push) Has been cancelled
Remove `AuthenticatedApiUser` thread-local variable & pass it as arg instead
2026-02-13 14:43:36 +01:00