Commit Graph

12985 Commits

Author SHA1 Message Date
Alexander Aleksandrovič Klimov 711646a821
Merge pull request #9180 from Icinga/probot/update-authors/master/639091126244de83c8e8391bfd97523b96fd1015
Update AUTHORS
2022-01-19 15:25:46 +01:00
icinga-probot[bot] 8e13d37fbd
Update AUTHORS 2022-01-19 10:49:15 +00:00
Julian Brost 6390911262
Merge pull request #9123 from Icinga/bugfix/icinga2-crashes-when-sending-notifications-8186
Avoid "type" key in dicts being part of object state attrs
2022-01-19 11:48:40 +01:00
Alexander Aleksandrovič Klimov 30e1e8d3f4
Merge pull request #9152 from lrupp/patch-2
Additional GRANT options for MySQL
2022-01-19 10:39:16 +01:00
Julian Brost 463b159414
Merge pull request #9171 from Icinga/bugfix/icinga-db-notification-history-might-use-incorrect-previous_hard_state-9132
IcingaDB#SendSentNotification(): make stream deterministic via CheckResult#previous_hard_state
2022-01-18 16:54:16 +01:00
Julian Brost 31da6a56e6 Icinga DB: remove obsolete StateChangeHandler overload
This version of StateChangeHandler is no longer called anywhere as it was the
wrong function for all previous callers anyways.
2022-01-18 12:26:43 +01:00
Julian Brost cf73c6136b Icinga DB: make host problem change events update the state tables but not write state history
StateChangeHandler() is the function used when the actual hard/soft state
changes and thus also writes state history. This is not desired in this case,
instead, a runtime update should be generated, therefore call UpdateState()
instead.

refs #9063
2022-01-18 12:26:43 +01:00
Julian Brost 855e342b63 Icinga DB: make acknowledgement events update the state tables but not write state history
StateChangeHandler() is the function used when the actual hard/soft state
changes and thus also writes state history. This is not desired in this case,
instead, a runtime update should be generated, therefore call UpdateState()
instead.

refs #9063
2022-01-18 12:26:43 +01:00
Julian Brost f63268b0dd Icinga DB: make downtime events update the state tables but not write state history
StateChangeHandler() is the function used when the actual hard/soft state
changes and thus also writes state history. This is not desired in this case,
instead, a runtime update should be generated, therefore call UpdateState()
instead.

refs #9063
2022-01-18 12:26:43 +01:00
Julian Brost 447884be72 Icinga DB: don't reimplement volatile state update in SendConfigUpdate
Sending a volatile state update is already implemented in UpdateState, so just
use that function instead of generating the update queries.
2022-01-18 12:26:43 +01:00
Julian Brost a6d6cb788e Icinga DB: Merge SendStatusUpdate into UpdateState
Previously, both funktions did related operations but had unclear and confusing
naming:
- UpdateState updated the icinga:{host,service}:state Redis keys.
- SendStatusUpdate sent a runtime update for the icinga:{host,service}:state.

This commit merges both functions into one with a new mode parameter. The
following modes are now supported:
- Volatile: Update the icinga:{host,service}:state Redis key.
- Full: Perform the volatile state update and in addition send a corresponding
  runtime update so that this state update gets written through to the
  persistent database by a running icingadb process.
- RuntimeOnly: Special mode for callers that can ensure that a volatile update
  for the current state was already performed but has to be upgraded to a full
  update.

refs #9063
2022-01-18 12:26:43 +01:00
Alexander Aleksandrovič Klimov 506b7d9a35
Merge pull request #9172 from Icinga/feature/github-actions-windows-preinstalled-deps
GitHub Actions: Use preinstalled dependencies on Windows
2022-01-11 16:32:54 +01:00
Julian Brost 8e766a6a47 GitHub Actions: Use preinstalled dependencies on Windows
The Windows image provided by GitHub already includes most of our dependencies,
so the installation of all Chocolatey packages except winflexbison3 was
redundant. Visual Studio is provided in the Enterprise version instead of
Community, so that has to be added to the search path as well.
2022-01-11 13:20:07 +01:00
Alexander A. Klimov 1fee3f1b12 IcingaDB#SendSentNotification(): make stream deterministic via CheckResult#previous_hard_state
Now it gets everything from one source, the CheckResult.

refs #9132
2022-01-10 19:18:11 +01:00
Julian Brost 3d04b04172
Merge pull request #9138 from Icinga/bugfix/mysql-schema-versions
Make MySQL schema version in full schema file and upgrade files consistent
2022-01-10 09:54:38 +01:00
Julian Brost e518dc2436
Merge pull request #9112 from Icinga/bugfix/sync-missing-history-information
Icinga DB: ensure consistent history streams in HA setup
2022-01-07 15:14:06 +01:00
Julian Brost a99c04030c
Merge pull request #9150 from Icinga/bugfix/icingadb-cmd-arg-order-int
Icinga DB: ensure icinga:*command:argument#order is an int
2022-01-05 16:07:30 +01:00
Julian Brost 3e73a262cc Sync comment and downtime removal info for Icinga DB history
When a comment or downtime is removed manually, the name of the requestor and
timestamp have to be synced to other nodes in the cluster to allow all of them
to generate a consistent Icinga DB history stream.

refs #9101
2022-01-05 10:27:13 +01:00
Julian Brost 5017f5fa43
Merge pull request #9163 from Icinga/Al2Klimov-patch-3
Typos
2022-01-05 09:43:19 +01:00
Alexander Aleksandrovič Klimov fb60e20ec8
Typos 2022-01-04 18:17:54 +01:00
Alexander Aleksandrovič Klimov db9825cbaf
Merge pull request #9161 from Icinga/Al2Klimov-patch-3
GHA: drop SUSE 15.2 and add 15.3
2022-01-04 17:54:47 +01:00
Alexander Aleksandrovič Klimov 1b50d912a0
Merge pull request #9137 from Icinga/bugfix/influxdb-writer-synchronization
Fix unsafe concurrent access to m_DataBuffer in InfluxdbCommonWriter
2022-01-04 17:37:28 +01:00
Alexander A. Klimov e9e555468d Handle "type" key in dicts being part of object state attrs
i.e. the confusion of the state file deserializator with e.g. `"type":32` on startup.
That would unexpectedly restore (the now ignored) null (not `{"type":32}`) as there's no type "32".

refs #8186
2022-01-04 17:17:20 +01:00
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