Commit Graph

13841 Commits

Author SHA1 Message Date
Yonas Habteab 4f690a6fde
Merge pull request #10169 from Icinga/Type-GetLoadDependencies-ConfigObject
Type#GetLoadDependencies(): VERIFY() that only config object types are returned
2024-09-20 16:11:17 +02:00
Alexander A. Klimov b6517c6973 Type#GetLoadDependencies(): VERIFY() that only config object types are returned 2024-09-20 14:35:19 +02:00
Alexander A. Klimov 4b20121dcf Type#GetLoadDependencies(): group operations by type 2024-09-20 14:35:19 +02:00
Yonas Habteab dac747f9d4
Merge pull request #10155 from Icinga/Type-GetLoadDependencies-nullptr
Type#GetLoadDependencies(): VERIFY() that no nullptr is returned
2024-09-20 12:29:48 +02:00
Alexander A. Klimov c24713ac10 Type#GetLoadDependencies(): VERIFY() that no nullptr is returned 2024-09-19 16:43:00 +02:00
Alexander A. Klimov 36742c27b9 Don't override Type#GetLoadDependencies() if latter is sufficient
If a specific type shall return no deps, the base method already does that.
2024-09-19 15:47:25 +02:00
Yonas Habteab e678f0977d
Merge pull request #10151 from Icinga/bugfix/do-not-sync-partially-initialised-objects
IcingaDB: Don't sync partially initialised objects
2024-09-18 15:48:42 +02:00
Yonas Habteab 3ffec77ae5
Merge pull request #10135 from Icinga/centos
doc/: don't mention CentOS
2024-09-18 10:22:09 +02:00
Yonas Habteab 7b12a8feeb
Merge pull request #10156 from Icinga/Al2Klimov-patch-7
Linux Dev Environment: fix /usr/local/icinga2/etc ownership
2024-09-16 17:51:34 +02:00
Alexander A. Klimov 6da948c830 doc/: don't mention CentOS
It's EOL.
2024-09-16 17:08:42 +02:00
Alexander Aleksandrovič Klimov f3ed85171e
Linux Dev Environment: fix /usr/local/icinga2/etc ownership
We instruct the users to build as root and chown just /usr/local/icinga2/var, but at least `icinga2 api setup` also needs to modify /usr/local/icinga2/etc.
2024-09-16 16:13:02 +02:00
Yonas Habteab 0b8f70bbba
Merge pull request #10152 from Josef-Friedrich/remove-trailing-whitespaces
Remove trailing whitespaces in the markdown files of the documentation
2024-09-13 10:06:45 +02:00
Julian Brost b62326d30c
Merge pull request #10153 from Josef-Friedrich/typo-api-docs
Fix typo in the api documentation
2024-09-12 10:37:06 +02:00
Josef Friedrich 1cd515ef8a
Fix typo in the api documentation 2024-09-12 08:46:27 +02:00
Josef Friedrich 1f31f725f8 Remove trailing whitespaces in the markdown files of the documentation 2024-09-12 08:39:15 +02:00
Yonas Habteab 26f43b0b48 IcingaDB: Don't sync partially initialised objects 2024-09-11 14:08:27 +02:00
Yonas Habteab 8beb0b74ab
Merge pull request #10149 from Icinga/fix-format-datetime-tests-on-darwin
tests: Fix test `FormatDateTime` with invalid formats on macOS/*BSD
2024-09-10 18:48:26 +02:00
Yonas Habteab b8932e67fc tests: Fix test `FormatDateTime` with invalid formats on macOS/*BSD 2024-09-10 17:11:20 +02:00
Yonas Habteab c0b047b1aa
Merge pull request #10035 from Icinga/check_systemd_name_fix
check_systemd: Fix executable name and include latest arguments
2024-09-06 11:57:33 +02:00
Alvar Penning e7670e9ba9
check_systemd: harmonize ITL w/ upstream
Harmonize the arguments with the upstream CheckCommand[0], including a
patch to use the ITL variables[1].

[0]: https://github.com/Josef-Friedrich/check_systemd/blob/main/contrib/icinga2/command.conf
[1]: https://github.com/Josef-Friedrich/check_systemd/pull/38

Co-Authored-By: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com>
2024-09-06 10:21:30 +02:00
Yonas Habteab 5cc034b38f
Merge pull request #10147 from Icinga/Al2Klimov-patch-7
Utility::ReleaseHelper(): remove detection of EOL distros
2024-09-05 09:27:51 +02:00
Alexander Aleksandrovič Klimov 79e3cb2a95 Utility::ReleaseHelper(): remove detection of EOL distros
We only support /etc/os-release owners.
2024-09-04 10:26:50 +02:00
Alexander Aleksandrovič Klimov 0951230ce1
Merge pull request #9991 from Icinga/JsonRpcConnection-9985
JsonRpcConnection#Send*(): discard messages ASAP once shutting down
2024-09-03 15:13:30 +02:00
Julian Brost 4c6b93d617
Merge pull request #10011 from Icinga/next-check-cluster-sync-issue
Checkable: Don't recalculate `next_check` for remotely generated `cr`
2024-08-30 13:37:41 +02:00
Lorenz Kästle ba200f74e1
Add check_curl to ITL (#9205)
* Add check_curl to ITL

* small fixes and boolean defaults

* Add documentation for check_curl

* Replace dash with underscore in variables

* Add link to documentation

* Change order of argument attributes to adhere to style guide

* Shorten description of  tls option in itl

* Just remove information for check_curl options

* itl - check_curl: document -4 and -6

* itl - check_curl: Add haproxy option for check_curl

* itl - check_curl: add cookie-jar option

* itl - check_curl: add continue_after_certificate option

* itl - check_curl: replace dashes with underscores in macros

* Update itl/command-plugins.conf

Co-authored-by: alvar <8402811+oxzi@users.noreply.github.com>

* Update itl/command-plugins.conf

Co-authored-by: alvar <8402811+oxzi@users.noreply.github.com>

* itl - check_curl: add missing option documentation and reorder options

* itl - check_curl: Split certificate lifetime in two parameters

* itl - check_curl: replace remaining instances of single parameter for remaining valid time

* check_curl: allow assignements for host without address set

* check_curl: fix typo expext -> expect

* itl - check_curl: add state-regex option and documentation

* Add Tls options with version and without

* itl - check_curl: fix indentation

* itl - check_curl: Set v4/v6 variables

* itl - check_curl: Edit description for --sni

* doc - check_curl: fix singular-plural typo for curl_max_redir(s)

* doc/check_curl: sni description

* itl - check_curl: remove superfluous brace

* itl - check_curl: add extra-opts parameter

---------

Co-authored-by: alvar <8402811+oxzi@users.noreply.github.com>
2024-08-30 10:25:27 +00:00
Julian Brost 73d3e5b1c7
Merge pull request #10136 from Icinga/icinga-archive-keyring
.deb: let user install icinga-archive-keyring package
2024-08-29 17:36:20 +02:00
Yonas Habteab 9f84c1516e ApiListener: Reorder logging in `ApiTimerHandler()` 2024-08-28 16:53:53 +02:00
Yonas Habteab e062ceb901 ApiListener: Catch & supress clients runtime errors 2024-08-28 16:53:53 +02:00
Yonas Habteab 894d6aa290
Merge pull request #9974 from tbauriedel/fix/itl-http-definition
Fix ITL for http CheckCommand definition
2024-08-27 15:45:00 +02:00
Julian Brost 88e79ea41a
Merge pull request #10111 from Icinga/unregister-invalid-objects-properly
Unregister invalid config objects properly
2024-08-27 14:30:38 +02:00
Yonas Habteab 932a53449d JsonRpcConnection: Raise an exception when trying to send to disconnected clients 2024-08-27 14:23:41 +02:00
Julian Brost 9222a63ff7 Make sure log file is reopened when `ApiListener::ReplayLog()` returns 2024-08-27 14:23:41 +02:00
Yonas Habteab a5a83e311a Defer: Allow empty initialization & add `SetFunc()` method 2024-08-27 14:23:41 +02:00
Yonas Habteab 73db30c08b Use `Defer` class for cleanup in `ApiListener::ReplayLog()` 2024-08-27 14:23:41 +02:00
Alexander A. Klimov f074e24d2a ApiListener#ReplayLog(): stop reading files ASAP on send error 2024-08-27 14:23:41 +02:00
Alexander A. Klimov b538ad2528 JsonRpcConnection#Send*(): discard messages ASAP once shutting down
Especially ApiListener#ReplayLog() enqueued lots of messages into
JsonRpcConnection#{m_IoStrand,m_OutgoingMessagesQueue} (RAM) even if
the connection was shut(ting) down. Now #Disconnect() takes effect ASAP.
2024-08-27 14:23:41 +02:00
Alexander A. Klimov 33f8ea6dcc JsonRpcConnection#Disconnect(): spawn coroutine only if necessary
by checking the now atomic #m_ShuttingDown outside of it.
2024-08-27 14:23:41 +02:00
Tobias Bauriedel 600281bfa0
Fix ITL for http CheckCommand definition
There were some missing arguments.

ref/NC/806131
2024-08-27 14:07:43 +02:00
Yonas Habteab a51910a19b
Merge pull request #9975 from nicolasberens/bugfix/update-check_snmp-9907
add multiplier option to check_snmp which is available since monitori…
2024-08-26 17:12:09 +02:00
Nicolas Berens c76cade9ae add new variables to documentation 2024-08-26 15:36:21 +02:00
Nicolas Berens 91b1638a01 add multiplier option to check_snmp which is available since monitoring-plugins v2.3.3, refs #9907 2024-08-26 15:36:21 +02:00
Julian Brost 145bb6109b
Merge pull request #10112 from Icinga/formatdatetime
Overhaul Utility::FormatDateTime()
2024-08-26 14:31:00 +02:00
Julian Brost 585b357c3f
Merge pull request #10090 from Icinga/rpi-os
Clarify that our Debian installation docs also apply to the Raspberry Pi OS
2024-08-26 13:54:30 +02:00
Julian Brost 39ae2e8ca4 Utility::FormatDateTime(): provide an overload for tm*
This allows the function to be used both with a double timestamp or a pointer
to a tm struct. With this, a similar implementation inside the tests can simply
use our regular function.
2024-08-23 12:48:50 +02:00
Julian Brost d5b3ffaa6d Utility::FormatDateTime(): handle invalid format strings on Windows
On Windows, the strftime() function family invokes an invalid parameter handler
when the format string is invalid (see the "Remarks" section in their
documentation). std::put_time() shows the same behavior as it uses
_wcsftime_l() internally. The default invalid parameter handler may terminate
the process, which can be a problem given that the format string can be
specified by the user from the Icinga DSL.

Thus, temporarily set a thread-local no-op handler to disable the default one
allowing the program to continue. This then simply results in the function
returning an error which then results in an exception as we ask the stream to
throw one.

See also:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=msvc-170
https://learn.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation?view=msvc-170
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler?view=msvc-170
2024-08-23 12:48:50 +02:00
Julian Brost 0285028689 Utility::FormatDateTime(): handle errors from strftime()
So far, the return value of strftime() was simply ignored and the output buffer
passed to the icinga::String constructor. However, there are error conditions
where strftime() returns 0 to signal an error, like if the buffer was too small
for the output. In that case, there's no guarantee on the buffer contents and
reading it can result in undefined behavior. Unfortunately, returning 0 can
also indicate success and strftime() doesn't set errno, so there's no reliable
way to distinguish both situations. Thus, the implementation now returns the
empty string in both cases.

I attempted to use std::put_time() at first as that allows for better error
handling, however, there were problems with the implementation on Windows (see
inline comment), so I put that plan on hold at left strftime() there for the
time being.
2024-08-23 12:42:54 +02:00
Julian Brost c2c66908f6 Utility::FormatDateTime(): use localtime_s() on Windows
localtime() is not thread-safe as it returns a pointer to a shared tm struct.
Everywhere except on Windows, localtime_r() is used already which avoids the
problem by using a struct allocated by the caller for the output.

Windows actually has a similar function called localtime_s() which has the same
properties, just with a different name and order of arguments.
2024-08-23 12:42:32 +02:00
Julian Brost 704acdc698 Utility::FormatDateTime(): use boost::numeric_cast<>()
The previous implementation actually had undefined behavior when called with a
double that can't be represented as time_t. With boost::numeric_cast, there's a
convenient cast available that avoids this and throws an exceptions on
overflow.

It's undefined behavior ([0], where the implicit conversion rule comes into
play because the C-style cast uses static_cast [1] which in turn uses the
imlicit conversion as per rule 5 of [2]):

> A prvalue of floating-point type can be converted to a prvalue of any integer
> type. The fractional part is truncated, that is, the fractional part is
> discarded.
>
> * If the truncated value cannot fit into the destination type, the behavior
>   is undefined (even when the destination type is unsigned, modulo arithmetic
>   does not apply).

Note that on Linux amd64, the undefined behavior typically manifests itself in
the result being the minimal value of time_t which then results in localtime_r
failing with EOVERFLOW.

[0]: https://en.cppreference.com/w/cpp/language/implicit_conversion#Floating.E2.80.93integral_conversions
[1]: https://en.cppreference.com/w/cpp/language/explicit_cast
[2]: https://en.cppreference.com/w/cpp/language/static_cast
2024-08-23 12:42:30 +02:00
Julian Brost 090dcfd70f Add tests for Utility::FormatDateTime() 2024-08-22 12:23:22 +02:00
Alexander Aleksandrovič Klimov a8adfeda60
Merge pull request #10120 from Icinga/Al2Klimov-patch-7
doc/02-installation.md: remove outdated info
2024-08-21 14:40:24 +02:00