Commit Graph

12962 Commits

Author SHA1 Message Date
Alexander Aleksandrovič Klimov f8f544832f
GHA: drop SUSE 15.2 and add 15.3 2022-01-04 13:44:14 +01:00
Alexander Aleksandrovič Klimov 80663cf5e6
Merge pull request #9048 from Icinga/bugfix/timeperiod-dst-2.0
LegacyTimePeriod::ScriptFunc: fix DST edge-cases
2022-01-03 18:11:32 +01:00
Alexander Aleksandrovič Klimov eb0d1fc823
Merge pull request #9131 from Icinga/bugfix/dont-trigger-fixed-downtime-as-flexible
Don't trigger a fixed downtime like a flexible one
2022-01-03 18:10:50 +01:00
Lars Vogdt 416a1458c9
Additional GRANT options for MySQL
We are using a central DB-Cluster, therefor Icinga2 got a database on this remote cluster.
We used the icinga DB user, created during the step before, to import the DB schema. 

For this, the additional GRANT options `ALTER` and `CREATE` where needed to install the schema successfully via:
```bash
mysql -u icinga -p icinga < /usr/share/icinga2-ido-mysql/schema/mysql.sql
```

Someone may find this a security problem. But I see two benefits:
* these GRANT options are only set for the icinga.* database
* this setup allows to execute also all later UPGRADE commands as the database user `icinga` - and not as the DB Administrator.

Two additional notes:
* I also included a small warning about the used default DB password
* sadly, I have no way to change this also in the provided mariadb-centos7.png image, so this is left unchanged at the moment
2022-01-03 15:22:48 +01:00
Alexander A. Klimov a8c9d19dae Icinga DB: ensure icinga:*command:argument#order is an int
The config parser requires *Command#arguments#order to be a Number, i.e. 42,
4.2 or even "4.2". That's int-casted where needed, now also for Icinga DB.

Before:

```
object CheckCommand "9117" {
	command = [ "true" ]
	arguments = {
		"4.2" = { order = "4.2" }
	}
}
```

2022-01-03T13:25:07.166+0100	FATAL	icingadb	json: cannot unmarshal string into Go value of type int64
2022-01-03 13:28:19 +01:00
Julian Brost 33781496da InfluxdbCommonWriter: use atomic_size_t to data buffer size from stats function
m_DataBuffer may be modified concurrently while StatsFunc() is called, thus
it's unsafe to call size() on it. As write access to m_DataBuffer is already
synchronized by only modifying it from the single work queue thread, instead of
adding a mutex, this commit adds a new std::atomic_size_t which is additionally
updated when modifying m_DataBuffer and can safely be accessed in StatsFunc().
2022-01-03 12:24:26 +01:00
Julian Brost e6300aacf9 InfluxdbCommonWriter: only flush from work queue
There is no explicit synchronization of access to m_DataBuffer which is fine if
it is only accessed from the single-threaded work queue. However, Stop() also
called Flush() in another thread, leading to concurrent write access to
m_DataBuffer which can result in a crash due to use after free/double free.

Changes in this commit:
* Flush() is renamed to FlushWQ() to show that it should only be called from
  the work queue. Additionally, it now asserts that it is running on the work
  queue.
* Visibility of some data members is changed from protected to private. No
  other classes have to access these at the moment. By this change, accidental
  concurrent access from derived classes in the future is prevented.
* Stop() now flushes by posting FlushWQ() to the work queue and joining it.
2022-01-03 12:24:26 +01:00
Julian Brost 23693248d4 Make MySQL schema version in full schema file and upgrade files consistent
In the 2.12.6 release, the full schema file sets the version to 1.14.3, whereas
the latest available upgrade file 2.11.0.sql sets it to 1.15.0. Therefore, ship
a new upgrade file 2.12.7.sql for all users who imported their schema with
version 2.11.0 or later and never performed an upgrade since then. Their
databases incorrectly state schema version 1.14.3 and is bumped to the correct
version 1.15.0 by the upgrade.

In the 2.13.2 release, the full schema file sets the version to 1.15.0, whereas
the latest available upgrade file 2.13.0.sql sets it to 1.15.1. Therefore,
rename the incorrectly named upgrade file 2.13.1.sql (it was not shipped in
this or any other release so far) to 2.13.3.sql for users who imported their
schema with version 2.13.0 or later and never performed an upgrade since then.
Their databases incorrectly state schema version 1.15.0 and are bumped to the
correct version 1.15.1 by the upgrade.

The full schema is not touched by this commit as for the current branch, this
was already fixed by 815533b334.
2021-12-16 15:48:12 +01:00
Julian Brost 13ea635188 Don't trigger a fixed downtime like a flexible one
When creating a fixed downtime that starts immediately while the checkable is
in a non-OK state, previously the code path for flexible downtimes was used to
trigger this downtime. This is fixed by this commit which resolves two issued:

1. Missing downtime start notification: notifications work differently for
   fixed and flexible downtimes. This resulted in missing downtime start
   notifications under the conditions described above.
2. Incorrect downtime trigger time: this code path would incorrectly assume the
   timestamp of the last checkable as the trigger time which is incorrect for
   fixed downtimes.
2021-12-14 11:02:40 +01:00
Alexander A. Klimov eb71fb7529 Avoid "type" key in dicts being part of object state attrs
not to confuse the state file deserializator with e.g. `"type":32` on startup.
That would unexpectedly restore null (not `{"type":32}`) as there's no type "32".

refs #8186
2021-12-13 17:56:12 +01:00
Julian Brost cbbaf4eac8
Merge pull request #9122 from Icinga/bugfix/downtime-trigger-time
Set downtime trigger time deterministically
2021-12-13 14:08:23 +01:00
Julian Brost c71029f2e8 Set downtime trigger time deterministically
When triggering a downtime, the time of the causing event is now passed on as
the trigger time. That time is:

* For fixed downtimes: the later one of start and entry time.
* If a check result triggers the downtime: The execution end of the check
  result.
* If another downtime triggers the downtime: The trigger time of the first
  downtime.

This is done so two nodes in a HA setup can write consistent Icinga DB downtime
history streams.

refs #9101
2021-12-08 14:15:50 +01:00
Alexander Aleksandrovič Klimov fd864d1d0c
Merge pull request #9121 from Icinga/probot/update-authors/master/2727aee4b9bb9754279531b65ad75cf620717fd2
Update AUTHORS
2021-12-07 23:41:48 +01:00
Alexander Aleksandrovič Klimov 1417a2f9ac
Merge pull request #9118 from Icinga/probot/sync-changelog/31c564182a598e05bd59e3524ac4c89b65b8a092
CHANGELOG.md: add v2.13.2
2021-12-07 17:15:56 +01:00
icinga-probot[bot] b19f2ffeae
Update AUTHORS 2021-12-07 15:41:48 +00:00
Alexander Aleksandrovič Klimov 2727aee4b9
Merge pull request #9115 from Icinga/Al2Klimov-patch-4
Update .mailmap
2021-12-07 16:41:24 +01:00
Alexander Aleksandrovič Klimov 577cf94b59
Merge pull request #8956 from Icinga/Al2Klimov-patch-3
Fix IDO MySQL schema version
2021-12-07 15:31:00 +01:00
Rostislav Opocensky e05128fa3c
pass nwc_health check SNMPv3 args only if needed (#9095)
* pass nwc_health check SNMPv3 args only if needed

check_nwc_health fails if any of the SNMPv3 arguments were passed but
the SNMP version 3 protocol was not requested.

For instance the following works:

	check_nwc_health --hostname 192.0.2.3 --mode cpu-load \
		--protocol 1 --community public

While the following plugin invocation results in an error:

	check_nwc_health --hostname 192.0.2.3 --mode cpu-load \
		--protocol 1 --community public \
		--username joe --authpassword xxx

The superfluous SNMPv3 arguments may easily get inherited e.g. from host
templates.

* string()ify the result of macro() calls

Always convert results of macro("$nwc_health_protocol$") to strings
so both numbers and strings are correctly recognized.

* Revert "string()ify the result of macro() calls"

This reverts commit 3636b5b4ba.

Wrong method applied to the result of macro().

* string()ify the result of macro() calls

Always convert results of macro("$nwc_health_protocol$") in the
set_if clauses of the nwc_health command arguments to strings.
Both numbers and strings are then correctly recognized as the
nwc_health_protocol argument.

* string()ify the result of macro() calls

Always convert results of macro("$nwc_health_protocol$") in the
set_if clauses of the nwc_health command arguments to strings.
Both numbers and strings are then correctly recognized as the
nwc_health_protocol argument.
2021-12-07 15:29:34 +01:00
Noah Hilverling 129eccd24c CHANGELOG.md: add v2.13.2 2021-12-07 11:48:15 +00:00
Alexander Aleksandrovič Klimov 31c564182a
Merge pull request #8990 from Icinga/bugfix/downtime-all-services-on-child-hosts
Fix scheduling of downtimes for all services on child hosts
2021-12-07 12:48:01 +01:00
Alexander Aleksandrovič Klimov 7cf55b74e1
Update .mailmap 2021-12-03 11:39:54 +01:00
Noah Hilverling 77eb7f4e1e
Merge pull request #9111 from Icinga/Al2Klimov-patch-8
GHA: Add Ubuntu impish
2021-12-03 11:23:52 +01:00
Alexander Aleksandrovič Klimov 90831dcbc1
GHA: Add Ubuntu impish 2021-12-02 16:48:58 +01:00
Alexander Aleksandrovič Klimov 978a72afa2
Merge pull request #9106 from Icinga/feature/avoid-copy-in-downtimes-timer
Downtime::DowntimesExpireTimerHandler: don't copy vector
2021-12-02 15:32:00 +01:00
Alexander Aleksandrovič Klimov 4919c8b189
Merge pull request #9104 from Icinga/Al2Klimov-patch-6
GHA: add Raspbian bullseye
2021-12-01 17:25:27 +01:00
Julian Brost 596fcdc123 Downtime::DowntimesExpireTimerHandler: don't copy vector
`ConfigType::GetObjectsByType<Downtime>()` already returns a
`std::vector<Downtime::Ptr>` so there is no point in copying it into another
vector of the same type just to then iterate the copied vector instead of the
original one.
2021-12-01 13:05:23 +01:00
Alexander A. Klimov 2a9f5f2e0f GHA: Raspbian: install more recent QEMU
to workaround "semop(1): encountered an error: Function not implemented".
2021-12-01 11:40:50 +01:00
Julian Brost d6a1757cb8
Merge pull request #9093 from Icinga/Al2Klimov-patch-7
GHA: add Fedora 35
2021-11-30 14:58:49 +01:00
Alexander Aleksandrovič Klimov 63a5938164
GHA: add Raspbian bullseye 2021-11-29 15:59:20 +01:00
Julian Brost 9e39866986
Merge pull request #9100 from Icinga/Al2Klimov-patch-4
Put `-latomic` to the other `-l`s
2021-11-25 11:38:46 +01:00
Alexander Aleksandrovič Klimov 7270caf226
Put `-latomic` to the other `-l`s
to make it compiling on Raspberry Pi OS bullseye.
2021-11-23 16:19:05 +01:00
Alexander Aleksandrovič Klimov c4c51a2b56
Merge pull request #8963 from Icinga/bugfix/git-describe-escapes-to-parent-dirs
third-party: update GetGitRevisionDescription CMake module
2021-11-23 12:22:47 +01:00
Yonas Habteab 361807f7a9
Adjust incosistent pki log messages (#8965) 2021-11-22 16:06:55 +01:00
Yonas Habteab a64089ffc1
`ClassCompiler`: Don't allow to define an int as a group name in `groups` attr (#9057) 2021-11-22 14:02:50 +01:00
Julian Brost d09925189a
Merge pull request #9037 from Icinga/Al2Klimov-patch-4
InfluxdbCommonWriter#Flush(): fix log message
2021-11-19 17:09:05 +01:00
Julian Brost da08d970cc Document which other downtimes are deleted by /v1/actions/remove-downtime 2021-11-19 14:47:07 +01:00
Julian Brost 8cde21ddfd
Merge pull request #9092 from Icinga/bugfix/non-unity-build
Add missing include to fix non-unity builds
2021-11-19 13:47:48 +01:00
Julian Brost 16d1ddb87f
Merge pull request #9052 from Icinga/bugfix/github-actions-windows-builds-don-t-abort-if-installing-dependencies-fails-8935
doc/win-dev.ps1: actually utilize ThrowOnNativeFailure
2021-11-19 13:47:29 +01:00
Alexander Aleksandrovič Klimov 2aa0078663
GHA: add Fedora 35 2021-11-18 12:35:52 +01:00
Henrik Triem 6e40f3f11e
Merge pull request #9091 from Icinga/Al2Klimov-patch-6
GHA: drop Fedora 33
2021-11-17 18:00:04 +01:00
Julian Brost 2ad0a4b8c3 Add missing include to fix non-unity builds
This commit fixes the following build error:

    [ 55%] Building CXX object lib/icinga/CMakeFiles/icinga.dir/usergroup.cpp.o
    lib/icinga/usergroup.cpp:79:24: error: incomplete type ‘icinga::Notification’ used in nested name specifier
       79 | std::set<Notification::Ptr> UserGroup::GetNotifications() const
          |                        ^~~
2021-11-17 16:11:15 +01:00
Julian Brost 7b2667400b Add tests for LegacyTimePeriod::ScriptFunc when used by TimePeriod::IsInside 2021-11-17 13:09:10 +01:00
Julian Brost a740b1d66c LegacyTimePeriod::ScriptFunc: fix DST edge-cases
This change fixes two problems:
* The internal functions used by ScriptFunc more or less expect to operate on
  full days, but ScriptFunc may have called them with some random timestamp
  during the day. This is fixed by always using midnight of the day as
  reference time.
* Previously, the code advanced a timestamp to the next day by adding 24 hours.
  On days with DST changes, this could either still be on the same day (a day
  may have 25 hours) or skip an entire day (a day may have 23 hours). This is
  fixed by using a struct tm to advance the time to the next day.
2021-11-17 13:09:10 +01:00
Alexander Aleksandrovič Klimov f0b6ef14e9
GHA: drop Fedora 33
It's EOL.
2021-11-16 10:48:31 +01:00
Feu Mourek e1c6c9eb19
Add documentation about Icinga 2 use cases (#9065)
Added examples about different kind of use cases that will help users get a better picture of Icinga.
2021-11-15 17:51:37 +01:00
Noah Hilverling 4d3b1709fd
Merge pull request #9009 from Icinga/bugfix/icingadb-runtime-updates-delete-relationships
Icinga DB: Make sure object relationships are handled correctly during runtime updates
2021-11-12 17:52:59 +01:00
Noah Hilverling e681914d83
Merge pull request #9086 from Icinga/bugfix/icingadb-log-queries-debug-level
Icinga DB: only log queries at debug level
2021-11-12 17:16:54 +01:00
Julian Brost b9e6273ba0 Icinga DB: only log queries at debug level 2021-11-12 15:41:17 +01:00
Noah Hilverling 7a0796061a IcingaDB::AddObjectDataToRuntimeUpdates(): Copy data before modifying 2021-11-12 13:34:57 +01:00
Noah Hilverling 10bde2075a Dictionary: Make sure underlaying map is ordered 2021-11-12 13:34:57 +01:00