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
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
Johannes Schmidt
11e83b6274
Fix -Wunused-lambda-capture warning
2025-11-19 12:00:58 +01:00
Johannes Schmidt
93e69ed0e8
Fix -Wsign-compare warnings
2025-11-19 12:00:58 +01:00
Johannes Schmidt
f42510f981
Merge pull request #9411 from Icinga/compiler-warnings
...
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 / opensuse/leap:15.6 (push) Has been cancelled
Linux / opensuse/leap: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
Windows / Windows (push) Has been cancelled
Fix compiler warnings
2025-10-21 15:23:31 +02:00
Alexander A. Klimov
d877e818db
Fix compiler warnings
2025-10-17 17:08:31 +02:00
Alexander A. Klimov
3d69a31043
Fix compiler warnings by removing unused variables
2025-10-17 09:56:46 +02:00
Julian Brost
b27310fb6c
Merge pull request #10467 from Icinga/icingadb-calceventid-no-double-timestamptomilliseconds
...
IcingaDB::CalcEventID: No milliseconds as eventTime
2025-06-10 17:09:16 +02:00
Alvar Penning
9cdbbf4ede
IcingaDB::CalcEventID: No milliseconds as eventTime
...
CalcEventID's internal logic uses the TimestampToMilliseconds function
to convert the given eventTime to milliseconds. Within this function,
the timestamp is capped to prevent an overflow.
On three occasions, the input timestamp given to CalcEventID had already
been converted using TimestampToMilliseconds. The second
TimestampToMilliseconds function then checked the value and always
returned the capped maximum value. Consequently, CalcEventID returned
the same hash value for different timestamps.
This affected SendFlappingChange, SendAcknowledgementSet, and
SendAcknowledgementCleared. For example, when two acknowledgments were
created for the same service, the calculated event_id representing the
history table row would be identical.
Fixes #10465
2025-06-06 16:50:01 +02:00
Yonas Habteab
fd1927115a
IcingaDB: Make is_acknowledged a bool & add is_sticky_acknowledgement field
2025-06-06 13:31:44 +02:00
Yonas Habteab
76d5915b3f
IcingaDB: Set notification_histor#type to its string representation
...
So that Icinga DB (Go) daemon doesn't have to make the mappings again.
2025-06-06 13:31:44 +02:00
Yonas Habteab
7037b18b34
IcingaDB: Send the int representation of states & types filter
2025-06-06 13:31:44 +02:00
Yonas Habteab
ef1c0eb9b3
IcingaDB: Set state_type to hard or soft and not int
2025-06-06 13:31:44 +02:00
Yonas Habteab
5d11df1abf
IcingaDB: Send the string representation of comment#entry_type to Redis
2025-06-06 13:31:44 +02:00
Johannes Schmidt
f8d3bacc29
Fix warnings related to enum integer conversion
2025-05-19 12:31:22 +02:00
Yonas Habteab
7acec6fc36
IcingaDB: Set downtime cancel_time conditionally
...
If the downtime ended automatically `cancel_time` should just be `NULL`
instead of a `0` timestamp.
2025-05-16 09:49:58 +02:00
Yonas Habteab
5ea666a7ad
IcingaDB: Don't set cancel_time for downtime start event
...
It's a downtime start event there's now way the downtime could be
cancelled before it even started.
2025-05-16 09:49:16 +02:00
Yonas Habteab
bc2c750551
IcingaDB: Don't stream runtime state updates to Redis
2025-03-26 10:48:37 +01:00
Yonas Habteab
945a79e37f
IcingaDB: Don't send useless dependencies state updates
2025-03-19 16:28:00 +01:00
Yonas Habteab
da637c3741
IcingaDB: Always send dependencies state HSET updates to Redis
2025-03-19 16:28:00 +01:00
Yonas Habteab
7fbb8f7452
Evaluate dependency group state only for a specific child
...
Previously the dependency state was evaluated by picking the first
dependency object from the batched members. However, since the
dependency `disable_{checks,notifications` attributes aren't taken into
account when batching the members, the evaluated state may yield a wrong
result for some Checkables due to some random dependency from other
Checkable of that group that has the `disable_{checks,notifications`
attrs set. This commit forces the callers to always provide the child
Checkable the state is evaluated for and picks only the dependency
objects of that child Checkable.
2025-03-19 16:28:00 +01:00
Yonas Habteab
0ab50fd82d
IcingaDB: Process dependencies runtime updates
2025-03-19 16:28:00 +01:00
Yonas Habteab
aed1bb6294
IcingaDB: Introduce ExecuteRedisTransaction() helper method
2025-03-19 16:28:00 +01:00
Yonas Habteab
db3f8dec27
IcingaDB: Sync dependencies initial states on config dump
2025-03-19 16:28:00 +01:00
Yonas Habteab
f502993eb4
IcingaDB: Sync dependencies states to Redis
2025-03-19 16:28:00 +01:00
Yonas Habteab
c6466ee0ea
IcingaDB: Dump checkables dependencies config to redis correctly
2025-03-19 15:28:31 +01:00
Yonas Habteab
4bfaefadfa
IcingaDB: Bump expected redis version to 6
2025-03-12 16:32:01 +01:00
Yonas Habteab
c02b9d74a9
IcingaDB: Send reachablity state updates for all children
2025-03-12 16:19:22 +01:00
Yonas Habteab
6321606671
IcingaDB: Sync affects_children as part of runtime state updates
2025-03-12 16:19:22 +01:00
Yonas Habteab
297b62d841
IcingaDB: Add affected_children to Host/Service Redis updates
2025-03-12 16:19:22 +01:00
Alvar Penning
ef93f945a2
IcingaDB: Start keeping track of Host/Service to Dependency relationship
...
This does not work in this state!
Trying to refresh Dependency if a Host or Service being member
of this Dependency has a state change.
2025-03-12 16:19:22 +01:00
Yonas Habteab
26f43b0b48
IcingaDB: Don't sync partially initialised objects
2024-09-11 14:08:27 +02:00
Alexander A. Klimov
f9adf18111
IcingaDB#SerializeState(): limit execution_time and latency to 2^32-1
...
not to write higher values into Redis than the Icinga DB schema can hold.
This fixes yet another potential Go daemon crash.
2024-05-15 12:55:41 +02:00
Alexander Aleksandrovič Klimov
6c03598678
Merge pull request #9896 from Icinga/provide-cancel_time-where-has_been_cancelled-may-be-1
...
Disallow triggering a cancelled downtime, but provide cancel_time in Icinga DB downtime history where has_been_cancelled may be 1
2023-12-20 10:03:09 +01:00
Alexander A. Klimov
7174dc864d
IcingaDB#SendConfigDelete(): fix missing nullptr check before deref
2023-11-10 17:43:33 +01:00
Alexander A. Klimov
9aaa9901bd
Icinga DB downtime history: provide cancel_time where has_been_cancelled may be 1
...
The table sla_history_downtime requires a downtime_end.
The Go daemon takes the cancel_time if has_been_cancelled is 1.
So we must supply a cancel_time whereever has_been_cancelled is 1.
Otherwise the Go daemon can't process some entries.
2023-11-08 15:22:39 +01:00
Julian Brost
a2926b8604
Merge pull request #9794 from Icinga/round-notification-times-begin-end-not-to-crash-go-daemon
...
IcingaDB::PrepareObject(): round Notification#times.{begin,end} not to crash Go daemon
2023-06-27 17:08:41 +02:00
Alexander A. Klimov
dccb678882
IcingaDB::PrepareObject(): cut off (null) negative Notification#times.{begin,end} not to crash Go daemon
...
At least our PostgreSQL schema enforces positive values.
2023-06-27 12:58:08 +02:00
Alexander A. Klimov
415b810abf
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-06-27 12:53:08 +02:00
Julian Brost
9cf519316e
Merge pull request #9805 from Icinga/checkcommand-timeout-0-crashes-icinga-db-daemon-9804
...
IcingaDB::PrepareObject(): cut off (0) negative Command#timeout for Redis
2023-06-27 10:45:02 +02:00
Julian Brost
c08d3beeb1
Merge pull request #9785 from Icinga/Al2Klimov-patch-8
...
Icinga DB: also write ConfigObject#original_attributes into Redis
2023-06-27 10:24:41 +02:00
Julian Brost
bd11bc2eb4
Merge pull request #9793 from Icinga/unmarshal-number-42-5-into-go-struct-field-notification-notification_interval
...
IcingaDB::PrepareObject(): round Notification#interval and limit it to >=0
2023-06-27 10:12:13 +02:00
Alexander A. Klimov
d641a3c799
IcingaDB::PrepareObject(): cut off (0) negative Command#timeout for Redis
...
not to crash the Go daemon which expects positive values there.
2023-06-26 15:36:47 +02:00
Alexander A. Klimov
273aa6f997
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-06-19 12:46:40 +02:00
Alexander A. Klimov
9f08bad395
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-06-15 12:29:42 +02:00
Alexander A. Klimov
385fe2fd76
Icinga DB: also write ConfigObject#original_attributes into Redis
...
for the case the Go daemon decides to sync them into DB.
2023-06-12 12:53:25 +02:00
Julian Brost
8a42c3bf18
Merge pull request #9775 from Icinga/icingadb-service-crashes-on-negative-downtime-duration-or-end-before-start-9774
...
Icinga DB: don't write negative Downtime durations into Redis
2023-05-31 11:37:42 +02:00
Alexander A. Klimov
75eaa81c06
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-05-30 17:56:03 +02:00
Alexander A. Klimov
ad618e9716
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-05-24 16:04:14 +02:00
Alexander A. Klimov
5e9f95c007
Icinga DB: on every check result update state only 1x, not 3x in a row
...
Before (time: vertical, stack: horizontal):
* Checkable::ExecuteCheck
* Checkable::UpdateNextCheck
* IcingaDB::NextCheckChangedHandler
* HSET icinga:host:state
* HSET icinga:checksum:host:state
* ZADD icinga:nextupdate:host
* RandomCheckTask::ScriptFunc
* Checkable::ProcessCheckResult
* Checkable::UpdateNextCheck
* IcingaDB::NextCheckChangedHandler
* HSET icinga:host:state
* HSET icinga:checksum:host:state
* ZADD icinga:nextupdate:host
* IcingaDB::NewCheckResultHandler
* HSET icinga:host:state
* HSET icinga:checksum:host:state
* ZADD icinga:nextupdate:host
* IcingaDB::StateChangeHandler
* XADD icinga:runtime:state
* IcingaDB::ForwardHistoryEntries
* XADD icinga:history:stream:state
After:
* Checkable::ExecuteCheck
* Checkable::UpdateNextCheck
* RandomCheckTask::ScriptFunc
* Checkable::ProcessCheckResult
* Checkable::UpdateNextCheck
* IcingaDB::NewCheckResultHandler
* HSET icinga:host:state
* HSET icinga:checksum:host:state
* ZADD icinga:nextupdate:host
* IcingaDB::StateChangeHandler
* XADD icinga:runtime:state
* IcingaDB::ForwardHistoryEntries
* XADD icinga:history:stream:state
The first state + nextupdate (for overdue) update comes from next_check being
set to now + interval immediately before doing the actual check (not to trigger
it twice). This update is not only not important for the end user, but even
inappropriate. The end user SHALL see next_check being e.g. in -4s, not 5m, as
the check is running at the moment.
The second one is just redundant as IcingaDB::NewCheckResultHandler (the third
one) is called anyway and will update state + nextupdate as well.
2022-09-06 10:10:14 +02:00