Commit Graph

448 Commits

Author SHA1 Message Date
Yonas Habteab 1019398d55 Update object#config_hash after all relations queries 2024-05-22 13:39:30 +02:00
Alexander A. Klimov 9376a311ea Fix file endings
git ls-files -z \
	|grep -zEe '^lib/' \
	|grep -zEe '\.[ch]pp$' \
	|xargs -0 perl -p0i -e 's/\n*(?!(?:.|\n))/\n/'
2023-05-17 18:05:13 +02:00
Alexander A. Klimov ba7102cae3 Explicitly stop started timers and wait for them
before permitting their parent objects' destruction.
For the cases where the handlers have raw pointers to these objects.
2023-04-14 14:52:04 +02:00
Alexander A. Klimov 21b68455ce Use Timer::Create() instead of new Timer()
git ls-files -z |xargs -0 perl -pi -e 's/\bnew Timer\b/Timer::Create/g'

ex. in Timer::Create() itself.
2023-04-04 10:35:20 +02:00
Alexander A. Klimov f2974c07cf Centralise default icinga.* and env.* macros 2023-02-17 15:33:36 +01:00
Alexander A. Klimov b2b49caf61 Macros: support $env.ENV_VAR_NAME$
refs #6259
2023-02-10 17:21:29 +01:00
Julian Brost 0503ca1379 Initialize namespaces without using `overrideFrozen`
This commit adds a new initialization priority `FreezeNamespaces` that is run
last and moves all calls to `Namespace::Freeze()` there. This allows all other
initialization functions to still update namespaces without the use of the
`overrideFrozen` flag.

It also moves the initialization of `System.Platform*` and `System.Build*` to
an initialize function so that these can also be set without setting
`overrideFrozen`.

This is preparation for a following commit that will make the frozen flag in
namespaces finial, no longer allowing it to be overriden (freezing the
namespace will disable locking, so performing further updates would be unsafe).
2023-01-19 09:53:36 +01:00
Julian Brost 7c9d0fff01 IDO: use per-instance notification_id in history
When there are multiple active IDO instances on the same node, before this
commit, all of them would share a single DbValue object for the notification_id
column of the icinga_contactnotifications table. This resulted in the issue
that one database references the notification_id in another database.

This commit fixes this by using a separate DbValue value for each IDO instance.
This needs a new signal as the existing OnQuery and OnMultipleQueries signals
perform the same queries on all IDO instances, but different queries are needed
here per instance (they only differ in the referenced DbValue). Therefore, a
new signal OnMakeQueries is added that takes a std::function which is called
once per IDO instance and can access callbacks to perform one or multiple
queries only on this specific IDO instance.
2022-02-10 16:36:35 +01:00
Alexander Aleksandrovič Klimov b63eb2aa3d
Merge pull request #8855 from Icinga/bugfix/inconsistent-ido-schema-versions-8852
Fix IDO MySQL schema version (as in v2.11 upgrade)
2021-07-14 18:09:27 +02:00
Alexander Aleksandrovič Klimov bee83ead8b
Merge pull request #8730 from Icinga/bugfix/ido-stop-progstat-8727
IDO: update program status on stop
2021-07-06 18:07:38 +02:00
Alexander A. Klimov 4373acf8ed Ido*sqlConnection::Reconnect(): de-couple MySQL and Postgres schema versions 2021-07-05 19:17:51 +02:00
Alexander A. Klimov 9e2f58ea9f IdoCheckTask: de-couple MySQL and Postgres schema versions 2021-07-05 19:14:07 +02:00
Noah Hilverling 15786baf3d IDO: Use own transaction for programstatus 2021-05-19 17:26:32 +02:00
Alexander A. Klimov 8918b38dea DbConnection#Pause(): also update is_currently_running and process_id
refs #8727
2021-04-20 19:07:20 +02:00
Alexander A. Klimov 92df2ce2ca Deduplicate DbConnection#Disconnect() in #Pause()
refs #8727
2021-04-20 18:42:37 +02:00
Alexander A. Klimov 0d34d8951a Abstract Ido*Connection#Disconnect()
refs #8727
2021-04-20 18:40:49 +02:00
Alexander A. Klimov fd9bdb798d Deduplicate DbConnection#m_QueryQueue.Join() in #Pause()
refs #8727
2021-04-20 18:40:35 +02:00
Alexander A. Klimov 40c0bfad23 DbConnection#Pause(): call overridden method as last step
Otherwise it marks the object as paused and the other steps become no-ops.

refs #8727
2021-04-20 18:11:52 +02:00
Alexander Aleksandrovič Klimov ef8619f76b
Merge pull request #8601 from Icinga/feature/replace-std-boost-bind-with-lambdas-7006
Feature: Replace std/boost::bind() with lambdas
2021-03-18 17:56:13 +01:00
Yonas Habteab 43ba2da39c Replace std/boost::bind() function with lambda expression 2021-03-10 16:29:40 +01:00
Alexander Aleksandrovič Klimov aa0baf6f69
Merge pull request #8099 from Icinga/feature/std-mutex
Use std::mutex, not boost::mutex
2021-02-04 10:19:04 +01:00
Alexander A. Klimov c3388e9af6 Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
Yonas Habteab 3e5dfa9607 IdoCheckTask: Don't override checkable critical with warn state 2021-01-27 13:27:14 +01:00
Alexander A. Klimov fa61711c21 Introduce ReportIdoCheck()
... for code deduplication

refs #8034
2020-11-23 16:40:32 +01:00
Alexander A. Klimov 0ad1ab20aa Fix code style
refs #8034
2020-11-23 16:39:24 +01:00
Alexander A. Klimov bb851b0558 Merge branch 'master' into feature/v1-actions-execute-command-8034 2020-10-28 18:37:08 +01:00
Noah Hilverling 03af068302 IDO: Make sure to insert program status during reconnect() 2020-10-16 12:30:57 +02:00
Noah Hilverling 8db82ff87d IDO: Do not log stats, if paused 2020-10-15 10:48:41 +02:00
Alexander Aleksandrovič Klimov 79210a5542
Merge pull request #8367 from Icinga/bugfix/ido-hash-groups
*DbObject#CalculateConfigHash(): sort groups to be hashed
2020-10-14 16:23:24 +02:00
Alexander Aleksandrovič Klimov 28f1f70321
Merge pull request #8326 from Icinga/bugfix/do-not-update-customvar-status-on-heavy-config-update
Do not upsert customvar status on heavy config update
2020-10-14 11:00:29 +02:00
Alexander A. Klimov cb00a7fd6a *DbObject#CalculateConfigHash(): sort groups to be hashed
... to ensure consistent hashes across config reloads.

This will likely cause a heavy update once for all objects in >1 group,
but it will ensure that this happens the last time.
2020-10-13 13:47:49 +02:00
Noah Hilverling 04fc0014ce IDO-Logging: Increase logging threshold for nearly empty queue 2020-10-13 09:15:20 +02:00
Noah Hilverling d377996176 IDO-Logging: Don't log when not connected 2020-10-13 09:15:14 +02:00
Noah Hilverling 82c4d58d14 IDO-Logging: Remove useless ETA 2020-10-13 09:15:09 +02:00
Noah Hilverling be3eb0821a IDO-Logging: Add log timeout to log every 5 minutes 2020-10-13 09:15:03 +02:00
Noah Hilverling 22c14fd964 IDO: Always insert customvar status on heavy config update 2020-10-13 08:54:58 +02:00
Henrik Triem 7a759a6427 IDO: Implement more accurate logging for query stats 2020-09-22 13:44:02 +02:00
Mattia Codato 80dc908fca Use ExecuteCommand::ExecuteOverride also for ido check 2020-08-13 09:26:19 +02:00
Michael Friedrich d242b41704 Revert "Make NotificationResult available for events: Cluster and Features"
This reverts commit 566e59bbfa.
2020-01-07 14:20:59 +01:00
Alexander A. Klimov 829d07aefe Introduce Checkable#acknowledgement_last_change
refs #7689
2019-12-10 10:44:23 +01:00
Michael Friedrich 8098f4d54d Improve type logging for notifications 2019-07-16 13:46:16 +02:00
Michael Friedrich e659f8d2e1 DB IDO: Fix possible crash with program status updates before IcingaApplication is loaded 2019-07-11 16:06:27 +02:00
Michael Friedrich 5553438249 DB IDO: Use cached reachable state
fixes #6844
2019-05-07 13:47:09 +02:00
Michael Friedrich 78e24c53f1 DB IDO: Do not deactivate objects during application reload/restart
This follows the same principle as with the shutdown handler,
and was introduced with the changed reload handling with 2.9.
Previously IsShuttingDown() was sufficient which got set at one
location.

SigUsr2 as handler introduced a new location where m_ShuttingDown
is not necessarily set yet. Since this handler gets called when
l_Restarting is enabled, we'll use this flag to avoid config update
events resulting in object deactivation (object->IsActive() always
returns false).

refs #5996
refs #6691
refs #6970

fixes #7125
2019-05-03 15:40:48 +02:00
Michael Friedrich a630d0185f
Merge pull request #6722 from Icinga/feature/notification-result
Add notification result store/sync
2019-04-25 15:56:14 +02:00
Michael Friedrich 2913291a17 ido Check: Add last failover timestamp to output when HA enabled IDO is running 2019-04-01 09:31:03 +02:00
Michael Friedrich 149f640fd8 Improve DB IDO HA failover behaviour
- Decrease Object Authority updates to 10s (was 30s)
- Decrease failover timeout to 30s (was 60s)
- Decrease cold startup (after (re)start) with no OA updates to 30s (was 60s)
- Immediately connect on Resume()
- Fix query priority which got broken with #6970
- Add more logging when a failover is in progress

```
[2019-03-29 16:13:53 +0100] information/IdoMysqlConnection: Last update by endpoint 'master1' was 8.33246s ago (< failover timeout of 30s). Retrying.

[2019-03-29 16:14:23 +0100] information/IdoMysqlConnection: Last update by endpoint 'master1' was 38.3288s ago. Taking over 'ido-mysql' in HA zone 'master'.
```

- Add more logging for reconnect and disconnect handling
- Add 'last_failover' attribute to IDO*Connection objects

refs #6970
2019-04-01 08:50:00 +02:00
Michael Friedrich 566e59bbfa Make NotificationResult available for events: Cluster and Features 2019-03-28 11:42:28 +01:00
Michael Friedrich e2df11520e
Merge pull request #6970 from Icinga/bugfix/perfdata-gaps
Improve reload handling for features (metric & queue flush, activation priority)
2019-02-26 15:38:15 +01:00
Michael Friedrich 458f997a18 Replace Copyright header with a short version, part II 2019-02-25 15:09:36 +01:00