14110 Commits

Author SHA1 Message Date
Julian Brost
2b43354080
Merge pull request #8744 from Icinga/bugfix/unnecessary-chown-8743
NodeUtility::WriteNodeConfigObjects(): avoid unneccessary Utility::SetFileOwnership()
2023-02-01 14:27:46 +01:00
Alexander Aleksandrovič Klimov
4c2afb9279
Docs: Windows Dev Environment: TL;DR: disable unity build
This enables the individual C++ files, not just unity ones, in VS project tree.
2023-02-01 13:02:45 +01:00
Julian Brost
fd1aa73d25 Fix config sync after freezing namespaces
This was accidentally broken by #9627 because during config sync, a config
validation happens that uses `--define System.ZonesStageVarDir=...` which fails
on the now frozen namespace.

This commit changes this to use `Internal.ZonesStageVarDir` instead. After all,
this is used for internal functionality, users should not directly interact
with this flag.

Additionally, it no longer freezes the `Internal` namespace which actually
allows using `Internal.ZonesStageVarDir` in the first place. This also fixes
`--define Internal.Debug*` which was also broken by said PR. Freezing of the
`Internal` namespace is not necessary for performance reasons as it's not
searched implicitly (for example when accessing `globals.x`) and should users
actually interact with it, they should know by that name that they are on their
own.
2023-02-01 12:29:47 +01:00
Julian Brost
d2fb8a9181 Handle errors when evaluating --define
This can be observed when running something like `icinga2 daemon -C -DTypes.Host=42`.

Without this commit:

    [2023-02-01 09:29:00 +0100] critical/Application: Error: Namespace is read-only and must not be modified.

    Additional information is available in '/var/log/icinga2/crash/report.1675240140.425155'

With this commit:

    [2023-02-01 09:30:37 +0100] critical/icinga-app: cannot set 'Types.Host': Namespace is read-only and must not be modified.
2023-02-01 09:30:49 +01:00
Julian Brost
a24375bc91
Merge pull request #9264 from Icinga/Al2Klimov-patch-7
Doc: SUSE: install monitoring-plugins-all
2023-01-31 17:44:44 +01:00
Julian Brost
2a4c9166c9
Merge pull request #9640 from Icinga/gha-repair
GHA: build Icinga 2 from source
2023-01-31 16:42:58 +01:00
Alexander A. Klimov
e43e657603 GHA: build Icinga 2 from source
as the package build images aren't public anymore.
2023-01-31 10:21:22 +01:00
Julian Brost
2ea866248b
Merge pull request #9642 from Icinga/9486a
ITL: let check_disk choose sane default units by itself
2023-01-27 22:22:24 +01:00
Julian Brost
03c7003cf0
Merge pull request #9644 from Icinga/probot/update-authors/master/0bdcd08e0240e009e6de635854dae625449260a5
Update AUTHORS
2023-01-27 21:09:17 +01:00
icinga-probot[bot]
3a848c600b
Update AUTHORS 2023-01-27 16:00:14 +00:00
Markus Weber
0bdcd08e02
Add the Option to disable RetryWrites to CheckCommand of mongodb (#9539)
* Add the Option to disable RetryWrites to CheckCommand for newer check_mongodb.py

* Add documentation foor the Option to disable RetryWrites in the MongoDB-Check
2023-01-27 15:59:40 +00:00
Alexander A. Klimov
c953ba1206 Remove redundant ThreadPool#m_Threads 2023-01-27 16:34:11 +01:00
Alexander A. Klimov
288ad68649 ThreadPool#ThreadPool(): remove unused parameter 2023-01-27 16:32:29 +01:00
Alexander A. Klimov
3a1b080338 ITL: let check_disk choose sane default units by itself
so it is responsible for output readability, prefdata precision
and SI vs. IEC on its own.
2023-01-27 16:21:40 +01:00
Alexander A. Klimov
fd93feaec7 Include Utility::SetFileOwnership() inside FS transactions
to make them even more atomic.
2023-01-27 12:03:59 +01:00
Alexander A. Klimov
d22fdf2a7a Introduce AtomicFile#GetTempFilename() 2023-01-27 12:03:59 +01:00
Alexander A. Klimov
0367c9e099 Remove unused Utility::CreateTempFile() 2023-01-27 12:03:59 +01:00
Alexander A. Klimov
b92fe23469 Deduplicate and stabilize fragile filesystem transactions
by using AtomicFile so they ensure all or nothing of a file gets replaced.
2023-01-27 12:03:56 +01:00
Alexander A. Klimov
a3e205b990 Introduce AtomicFile::Write() 2023-01-27 11:36:09 +01:00
Alexander Aleksandrovič Klimov
0ebec699ee
Doc: SUSE: install monitoring-plugins-all w/ --recommends
so it does something useful.
2023-01-27 11:25:18 +01:00
Julian Brost
2d860a0f5e
Merge pull request #8118 from Icinga/feature/speed-object-registry-8112
Speed up config object lookup
2023-01-26 19:03:40 +01:00
Alexander Aleksandrovič Klimov
421ac1735c
Merge pull request #9608 from Icinga/move-types-namespace
Move Types namespace into type.cpp and simplify Type::GetByName()
2023-01-26 18:32:41 +01:00
Julian Brost
ad8868cab7
Merge pull request #9599 from Icinga/influx-ns
Influx DB: don't unneccessarily truncate timestamps to whole seconds
2023-01-26 17:44:50 +01:00
Alexander A. Klimov
b2fc49569c Make ConfigType#m_Mutex a std::shared_timed_mutex
refs #8112
2023-01-26 15:04:02 +01:00
Alexander A. Klimov
21759f015d ConfigType: store config objects in a hash map
refs #8112
2023-01-26 15:03:54 +01:00
Julian Brost
27af8829f2
Merge pull request #9641 from Icinga/code-optimization-1
Some trivial code optimisations
2023-01-26 14:43:31 +01:00
Julian Brost
3dab46623b Move Types namespace into type.cpp and simplify Type::GetByName()
This commit moves the initialization of the globals.Types namespace to type.cpp
in order to keep a pointer to the Namespace object in Type::m_Namespace and
simplify Type::GetByName() using it.

The dynamic type check is moved into an assertion after freezing the namespace.
2023-01-26 14:26:41 +01:00
Yonas Habteab
5a67ddea76 Don't post-increment stl iterators 2023-01-26 09:10:49 +01:00
Yonas Habteab
8bb0b857d8 ApiListener: Fix memory leak & group a || b && c correctly 2023-01-26 09:10:49 +01:00
Yonas Habteab
95cec9cba2 Don't mark a method as virtual in a final class 2023-01-26 09:10:38 +01:00
Yonas Habteab
7b91b200f5 Use simplified if conditions where applicable 2023-01-26 09:06:20 +01:00
Yonas Habteab
38313434d2 Avoid calling GetDeferredInitializers() repeatedly 2023-01-26 09:05:19 +01:00
Alexander Aleksandrovič Klimov
bb99106926
Merge pull request #7863 from Icinga/bugfix/disallow-receiving-ticket-salt-via-api
Disallow fetching the ticket salt via REST API
2023-01-25 16:39:30 +01:00
Julian Brost
5fea15e090
Merge pull request #7958 from Icinga/bugfix/api-500-404-7956
/v1/actions/*: return 404 if no objects found
2023-01-24 15:08:17 +01:00
Julian Brost
1a158c400f
Merge pull request #9056 from Icinga/Al2Klimov-patch-5
check_logfiles: --winwarncrit is a flag, not a param
2023-01-24 14:01:55 +01:00
Julian Brost
b10c288146
Merge pull request #8005 from Icinga/feature/http-verify-host-7969
check_http: support --verify-host
2023-01-24 13:02:08 +01:00
Alexander Aleksandrovič Klimov
11e37a0bd1
Merge pull request #9424 from Icinga/run-only-a-single-job-per-workflow-at-a-time
Run only a single job per workflow at a time
2023-01-20 20:35:51 +01:00
Johannes Meyer
9f757dd551 Run only a single job per workflow matrix at a time
This limits each run of these workflows to a single
active matrix job. This means, for each PR, merge or
release only five jobs run concurrently.
2023-01-20 15:44:40 +01:00
Julian Brost
d29ff62017
Merge pull request #9636 from Icinga/gha-cancel
GHA: let GitHub cancel redundant jobs
2023-01-20 15:33:24 +01:00
Julian Brost
c3e4098b41
Merge pull request #9635 from Icinga/eol
GHA: drop EOL OSes
2023-01-20 14:19:43 +01:00
Michael Friedrich
4d57de2a1a Hide TicketSalt in /v1/variables 2023-01-20 12:38:18 +01:00
Alexander Aleksandrovič Klimov
e38a907a7e
Merge pull request #9627 from Icinga/namespace-shared-mutex
Namespace: use rwlock and disable read locking after freeze
2023-01-19 22:44:30 +01:00
Julian Brost
24b57f0d3a Namespace: don't acquire shared locks on frozen namespaces
This makes freezing a namespace an irrevocable operation but in return allows
omitting further lock operations. This results in a performance improvement as
reading an atomic bool is faster than acquiring and releasing a shared lock.

ObjectLocks on namespaces remain untouched as these mostly affect write
operations which there should be none of after freezing (if there are some,
they will throw exceptions anyways).
2023-01-19 17:56:44 +01:00
Julian Brost
cc0e2ec181 Use a shared_mutex for read Namespace operations
This allows multiple parallel read operations resulting in a overall speedup on
systems with many cores.
2023-01-19 17:55:29 +01:00
Julian Brost
1c066fc02e Simplify NamespaceValue class hierarchy to one struct without member functions
This commit removes EmbeddedNamespaceValue and ConstEmbeddedNamespaceValue and
reduces NamespaceValue down to a simple struct without inheritance or member
functions. The code from these clases is inlined into the Namespace class. The
class hierarchy determining whether a value is const is moved to an attribute
of NamespaceValue.

This is done in preparation for changes to the locking in the Namespace class.
Currently, it relies on a recursive mutex. In the future, a shared mutex
(read/write lock) should be used instead, which cannot allow recursive locking
(without failing or risk deadlocking on lock upgrades). With this change, all
operations requiring a lock for one operation are within one function, no
recursive locking is not needed any more.
2023-01-19 17:55:11 +01:00
Julian Brost
0f7cfa372a
Merge pull request #9637 from Icinga/Al2Klimov-patch-6
GHA: revert back to ubuntu-latest
2023-01-19 17:38:10 +01:00
Alexander Aleksandrovič Klimov
90f2522d15
GHA: revert back to ubuntu-latest
as that is 22.04 or later.
2023-01-19 11:04:25 +01:00
Alexander A. Klimov
1d8cffe9b9 GHA: let GitHub cancel redundant jobs
This will also cancel not yet finished master builds, but that's not too bad.
2023-01-19 10:47:14 +01:00
Alexander A. Klimov
aa0a25caa7 GHA: drop EOL OSes 2023-01-19 10:30:26 +01:00
Julian Brost
0503ca1379 Initialize namespaces without using overrideFrozen
This commit adds a new initialization priority `FreezeNamespaces` that is run
last and moves all calls to `Namespace::Freeze()` there. This allows all other
initialization functions to still update namespaces without the use of the
`overrideFrozen` flag.

It also moves the initialization of `System.Platform*` and `System.Build*` to
an initialize function so that these can also be set without setting
`overrideFrozen`.

This is preparation for a following commit that will make the frozen flag in
namespaces finial, no longer allowing it to be overriden (freezing the
namespace will disable locking, so performing further updates would be unsafe).
2023-01-19 09:53:36 +01:00