Alexander A. Klimov
363c1b2986
cluster-zone: consider own zone connected if there's only one endpoint
...
... because in this case only the checking node can be (not) connected to itself.
refs #8570
2023-07-04 11:12:29 +02:00
Yonas Habteab
ff0b45eca0
PluginUtility: Fix PerfData don't get parsed correctly
...
The problem was that some PerfData labels contained several whitespace characters,
not just one, and therefore it was parsed incorrectly in `SplitPerfdata()`. I.e. the condition
in line 144 checks whether the first and last character is a normal quote, but since the
label can contain spaces at the beginning and at the end respectively, this caused the problems.
This PR fixes the problem by removing all occurring whitespace from the beginning and end,
before starting to parse the actual label.
2023-07-04 11:10:38 +02:00
Alexander A. Klimov
6dffc57a37
Checkable#ProcessCheckResult(): only clean up ack comments older than check result
...
Normally if for some reason an ack comment still exists on a checkable not
acked anymore, still clean it up. But while replaying log config objects
incl. ack comments come before check results and acks. I.e. 1) ack comment,
2) DOWN check result and 3) ack. Not 1) DOWN check result, 2) ack and 3) ack
comment. So the checkable is temporarily not acked, but already has the ack
comment. In this case the DOWN check result which is older than the ack
comment shall not clean up the latter.
2023-07-04 10:56:30 +02:00
Alexander A. Klimov
c160c4b62e
Checkable#RemoveAckComments(): add optional comment entry time filter
2023-07-04 10:56:30 +02:00
Alexander A. Klimov
0470fe12a7
Checkable#RemoveCommentsByType(): remove redundant parameter
2023-07-04 10:56:30 +02:00
Alexander Aleksandrovič Klimov
8dca4d7121
ElasticsearchWriter#Pause(): lock m_DataBufferMutex during Flush()
...
just to be sure regarding race conditions.
2023-07-04 10:50:03 +02:00
Alexander Aleksandrovič Klimov
73f8c4473e
ElasticsearchWriter#Pause(): call Flush() only once
...
The first Flush() is redundant and may access m_DataBuffer at the same time as some Flush() in m_WorkQueue (race condition) which isn't joined, yet.
2023-07-04 10:49:53 +02:00
Alexander A. Klimov
43c4feb645
Downtime#Start(): trigger flexible downtimes not earlier than fixed ones
...
the last state change could be a long time ago. If it's longer than
the new downtime's duration, the downtime expires immediately.
trigger time + duration < now
2023-07-04 10:39:14 +02:00
Alexander A. Klimov
b3d90f5418
Update third-party/nlohmann_json to v3.9.1
...
the latest version w/o Apache 2.0 licensed code which conflicts with GPL 2.
2023-07-03 17:40:53 +02:00
Alexander A. Klimov
e0e10a7efa
ApiListener#NewClientHandlerInternal(): on basic_socket#cancel() (due to timeout) don't ssl::stream#async_shutdown()
...
If a connection hangs for too long in ApiListener#NewClientHandler(),
ApiListener#AddConnection()'s Timeout calls boost::asio::basic_socket#cancel()
on that connection to trigger an exception which unwinds
ApiListener#NewClientHandler(). Previously that unwind could trigger a Defer
which called boost::asio::ssl::stream#async_shutdown() which extended the hang.
2023-07-03 17:16:26 +02:00
Alexander A. Klimov
243b8aa7a8
Connect(): don't try next DNS record if operation is canceled
...
Instead return immediately to meet the caller's expectations.
2023-07-03 17:16:26 +02:00
Alexander A. Klimov
0735966e23
IcingaDB::PrepareObject(): cut off (null) negative Notification#times.{begin,end} not to crash Go daemon
...
At least our PostgreSQL schema enforces positive values.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
04457f5f16
IcingaDB::PrepareObject(): round Notification#times.{begin,end} not to crash Go daemon
...
The latter expects ints, not floats - not to mention strings.
Luckily Icinga already enforces numeric strings so that we can cast it to number.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
b7ecefb3c0
IcingaDB::PrepareObject(): round Notification#interval and limit it to >=0
...
otherwise, e.g. with -42.5, the Go daemon crashes. It expects uints there.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
2f1732e7e6
IcingaDB::PrepareObject(): cut off (0) negative Command#timeout for Redis
...
not to crash the Go daemon which expects positive values there.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
766e28e1aa
IcingaDB::PrepareObject(): convert non-null Checkable#check_timeout to number
...
and, in case of null, fall back to Checkable#check_command.timeout, just like
IcingaDB#SerializeState(). Otherwise the Go daemon crashes. It expects a number.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
f0176001fe
Icinga DB: don't write negative Downtime durations into Redis
...
via `std::max(0, x)` not to crash the Go daemon which can't handle such.
2023-07-03 17:08:40 +02:00
Alexander A. Klimov
99350e6b27
Icinga DB feature: normalize *Command.arguments[*].{required,skip_key,repeat_key} to boolean
...
At the moment, the Icinga DB feature will use that value as-is and
serialize it to JSON, resulting in a crash in Icinga DB down the road
because it expects a boolean.
2023-07-03 17:08:40 +02:00
Alexander Aleksandrovič Klimov
c0bd0936f9
Merge pull request #9682 from Icinga/9631-213
...
Setup all signal handlers with SA_RESTART flag
2023-02-16 16:24:26 +01:00
Alexander Aleksandrovič Klimov
fe2fed4817
Merge pull request #9680 from Icinga/9488-213
...
Fix compile error on Solaris 11.4
2023-02-16 16:24:05 +01:00
Alexander Aleksandrovič Klimov
6dfc21f9bd
Merge pull request #9678 from Icinga/181b213
...
Bump Boost to v1.81
2023-02-16 16:23:50 +01:00
Alexander Aleksandrovič Klimov
ee0af27a82
Merge pull request #9681 from Icinga/flush-temp-files-213
...
Deduplicate and stabilize fragile filesystem transactions
2023-02-15 20:51:41 +01:00
Alexander A. Klimov
9ea9b10014
Include Utility::SetFileOwnership() inside FS transactions
...
to make them even more atomic.
2023-02-15 17:20:37 +01:00
Alexander A. Klimov
d2e3a094c1
Introduce AtomicFile#GetTempFilename()
2023-02-15 17:20:35 +01:00
Alexander A. Klimov
69b3c81ea1
Remove unused Utility::CreateTempFile()
2023-02-15 17:20:02 +01:00
Alexander A. Klimov
34844c146d
Deduplicate and stabilize fragile filesystem transactions
...
by using AtomicFile so they ensure all or nothing of a file gets replaced.
2023-02-15 17:19:57 +01:00
Alexander A. Klimov
f0c1764adc
Introduce AtomicFile::Write()
2023-02-15 16:25:39 +01:00
Alexander A. Klimov
a497645127
Setup all signal handlers with SA_RESTART flag
...
so interrupted syscalls get auto-restarted and callers
don't get or have to handle the EINTR error.
2023-02-15 11:08:29 +01:00
Alexander A. Klimov
a1bda3300e
Fix compile error on Solaris 11.4
...
by not using LOG_FTP which is not defined there.
2023-02-15 10:48:05 +01:00
Alexander A. Klimov
41c97d65b7
CheckerComponent#CheckThreadProc(): also propagate next check update to Icinga DB
...
if caused by dependency or check period.
Now as long as any of the above causes check skips
next check and next update will be up-to-date in Icinga DB,
so the checkable won't slide into false positive overdue.
2023-02-15 10:46:08 +01:00
Alexander A. Klimov
f84ffdad68
Handle boost::beast::http::basic_fields#operator[]() signature change (v1.81)
...
Use always working std::string(x), not broken x.to_string().
(x is a return value.)
2023-02-15 10:41:31 +01:00
Alexander A. Klimov
68198f2ef9
Handle boost::beast::http::basic_fields#set() signature change (v1.81)
...
Make String convertible to boost::beast::string_view (always working),
not boost::string_view (broken).
2023-02-15 10:41:31 +01:00
Yonas Habteab
a15bbfe913
Use service short name for evaluating targeted service rules
2022-11-04 12:47:41 +01:00
Yonas Habteab
e29de04687
Avoid evaluating the same filter twice for the same target
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
cc67510063
ApplyRule::RuleMap: reduce complexity, save unnecessary lookups
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
0bf093af14
Targeted apply rules: don't unnecessarily eval filter
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
09d810dbd9
VariableExpression#GetVariable(): return by const ref not to unnecessarily malloc()
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
840bfb6be1
Unify storages of regular/targeted apply rules: std::vector<ApplyRule::Ptr>
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
1935137a8d
Separately handle apply rules targetting only specific parent objects
...
not to unnecessarily run e.g. the filter assign where host.name=="example.com"
for all hosts being not example.com.
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
3d2a6bbfb1
Allow hashmaps of String
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
80ee597b72
Allow intrusive pointers to ApplyRule
2022-11-04 12:47:41 +01:00
Alexander A. Klimov
cf3e02243e
Remove unused ApplyRule#m_TargetType
2022-11-02 11:06:12 +01:00
Alexander A. Klimov
fcedb01d0d
Lookup apply rules faster by Type*, not String and by map instead of ==/!=
...
1. The lookup of apply rules per source type now implies
no String(const char*) (no malloc()) and just pointer (uint64) comparisions
2. Apply rules are now also grouped by target type via a nested map, that obsoletes
checking the target type while iterating over all rules per source type
2022-11-02 11:06:12 +01:00
Alexander A. Klimov
7f50955674
ApplyRule::GetTargetTypes(): return by const ref not to malloc()
2022-11-02 11:00:47 +01:00
Julian Brost
cdd531445a
Merge pull request #9558 from Icinga/context-evaluating-apply-rules-for-host-213
...
Construct string once, not unnecessarily N times
2022-11-02 10:48:57 +01:00
Julian Brost
2e02bb52f8
Merge pull request #9561 from Icinga/match-api-permissions-against-join-relations
...
Match api permissions against joined relations
2022-11-02 10:46:54 +01:00
Julian Brost
2f22be398b
Merge pull request #9560 from Icinga/handle-on-error-213
...
ConfigItem: Fix infinite recursion caused by `ignore_on_error`
2022-11-02 10:37:56 +01:00
Yonas Habteab
adc42e101d
Evaluate permission filters also on all joined relations
2022-10-31 13:01:12 +01:00
Yonas Habteab
02524f5993
ObjectQueryHandler: Check user permissions on joined relations
2022-10-31 13:01:12 +01:00
Yonas Habteab
21b55cb1ac
FilterUtility: Outsource permission matching from CheckPermission() to a separate method
2022-10-31 13:01:12 +01:00