Commit graph

6798 commits

Author SHA1 Message Date
Alexander A. Klimov
88fccc548d Utility::GetPlatform*(): on Windows query the registry for version info
not to have to adjust the code (see removed lines) for every new version.
2026-03-19 12:45:12 +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
Johannes Schmidt
e976450bbb Fix undefined behavior introduced by initializing last states with 99 2026-02-12 16:00:36 +01:00
Julian Brost
f5d5357fe2
Merge pull request #10028 from RincewindsHat/node_setup_no_globals
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
Add cli option to disable the default global zones
2026-02-12 14:44:50 +01:00
Lorenz Kästle
32f5beaad3 Update lib/cli/nodesetupcommand.cpp
Co-authored-by: Alexander Aleksandrovič Klimov <al2klimov@gmail.com>
2026-02-12 11:48:58 +01:00
Yonas Habteab
3b80153848 Remove AuthenticatedApiUser thread-local variable & pass it as param instead 2026-02-11 11:39:57 +01:00
Yonas Habteab
d4d46a9780 HTTP: stream responses where appropriate 2026-02-11 09:47:39 +01:00
Yonas Habteab
32887884e5 Make ValueGenerator more flexible & easy to use
This commit refactors the ValueGenerator class to be a template that can
work with any container type. Previously, one has to manually take care
of the used container by lazily iterating over it within a lambda. Now,
the `ValueGenerator` class itself takes care of all the iteration,
making it easier to use and less error-prone. The new base `Generator`
class is required to allow the `JsonEncoder` to handle generators in a
type-erased manner.
2026-02-10 16:57:56 +01:00
Johannes Schmidt
216e2d9861 Fix uninitialized member in ScriptError 2026-02-06 12:10:20 +01:00
Yonas Habteab
91c7e60df8 Replace all existing copyright headers with SPDX headers
I've used the following command to replace the original copyright header
lines in a C-style comment block:

```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{/\*[^*]*\(\s*c\s*\)\s*(\d{4})\s*Icinga\s+GmbH[^*]*\*/}{// SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n// SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```

For files that use shell-style comments (#) like CMakeLists.txt, I've
used this command:

```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f -exec perl -pi -e 's{#.*\(\s*c\s*\)\s(\d{4})\sIcinga\s+GmbH.*}{# SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n# SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```

And for SQL files:

```
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{--.*\(c\)\s(\d{4})\sIcinga\sGmbH.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
$ find . \( -type d \( -name '\..*' -o -name third-party -o -name scripts -o -name prefix -o -name malloc -o -name server -o -name docker -o -name build -o -name doc \) -prune \) -o -type f \( -name '*.sql' \) -exec perl -pi -e 's{-- Copyright \(c\)\s(\d{4})\sIcinga\s+Development\sTeam.*}{-- SPDX-FileCopyrightText: \1 Icinga GmbH <https://icinga.com>\n-- SPDX-License-Identifier: GPL-2.0-or-later}gi' {} +
```
2026-02-04 14:00:05 +01:00
Yonas Habteab
36b41dbe11
Merge pull request #10698 from ymartin-ovh/pr-10687
Fix nullptr dereference on `{child_,parent_}service` navigation
2026-01-30 16:49:19 +01:00
Alexander Aleksandrovič Klimov
9bffe06169
Merge pull request #10388 from Icinga/Registry-Freeze
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
Freeze registries at startup, when everything has been registered
2026-01-26 17:28:43 +01:00
Alexander A. Klimov
6223bd5f31 Remove unused DbTypeRegistry 2026-01-26 14:37:59 +01:00
Alexander A. Klimov
b4192bd80a Replace class B : public A { }; with using B = A; (refactor only) 2026-01-26 14:34:29 +01:00
Alexander A. Klimov
74ac0183ca Registry<U,T>: remove unused template typename U 2026-01-26 10:24:22 +01:00
Alexander Aleksandrovič Klimov
363a051e18
Merge pull request #9728 from Icinga/silence-compiler-warnings-about-unused-parameters
Silence compiler warnings about unused parameters
2026-01-23 16:40:54 +01:00
Alexander A. Klimov
4ba46f9eb2 Silence compiler warnings about unused parameters
Every of these parameters exists for a reason.
The best we can do is to convince the compiler.
2026-01-23 13:31:01 +01:00
Alexander Aleksandrovič Klimov
92d9f64eb0
Merge pull request #10693 from Icinga/AddDowntime-origin
`Downtime::AddDowntime()`: remove unused parameter `const MessageOrigin::Ptr& origin`
2026-01-23 13:22:55 +01:00
Alexander A. Klimov
92b6034504 Downtime::AddDowntime(): remove unused parameter const MessageOrigin::Ptr& origin 2026-01-23 10:41:18 +01:00
Johannes Schmidt
1505f09ed6 Refactor HttpMessage into generalized templated types
This adds generalized IncomingHttpMessage and OutgoingHttpMessage templates
that support different types of streams (via a std::variant) and can both
be used for either requests or responses.

The tacked on metadata from the old HttpRequest and server connection from
the old HttpServerConnection have been moved to HttpApi(Request|Response)
classes that derive from the above generalized message types.
2026-01-22 17:20:32 +01:00
Johannes Schmidt
a0f603f608 Update names of HttpRequest and HttpResponse 2026-01-22 12:41:21 +01:00