From 8c1bf676378983a6f22c42d3a7a6653dec9db7c4 Mon Sep 17 00:00:00 2001 From: Tobias Helms Date: Tue, 14 Nov 2023 12:18:20 +0100 Subject: [PATCH] added janitor event deletion --- l10n/monitoring-endpoint.csv | 5 ++++ manifest.master.yml | 8 ++++++ src/server/extension/monitoring-endpoint.js | 30 ++++++++++++++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/l10n/monitoring-endpoint.csv b/l10n/monitoring-endpoint.csv index fa9b301..685a04f 100755 --- a/l10n/monitoring-endpoint.csv +++ b/l10n/monitoring-endpoint.csv @@ -38,3 +38,8 @@ server.config.parameter.system.monitoring_endpoint.status__disabled_plugins.labe server.config.option.system.monitoring_endpoint.status__disabled_plugins.nothing,Nichts,Nothing server.config.option.system.monitoring_endpoint.status__disabled_plugins.warning,Warnung,Warning server.config.option.system.monitoring_endpoint.status__disabled_plugins.error,Fehler,Error + +server.config.parameter.system.monitoring_endpoint.status__janitor_event_deletion.label,Was tun: Janitor löscht Events nicht,What do to: Janitor does not delete events +server.config.option.system.monitoring_endpoint.status__janitor_event_deletion.nothing,Nichts,Nothing +server.config.option.system.monitoring_endpoint.status__janitor_event_deletion.warning,Warnung,Warning +server.config.option.system.monitoring_endpoint.status__janitor_event_deletion.error,Fehler,Error diff --git a/manifest.master.yml b/manifest.master.yml index a26c234..d59342a 100755 --- a/manifest.master.yml +++ b/manifest.master.yml @@ -73,6 +73,14 @@ base_config: - error default: "warning" position: 8 + status__janitor_event_deletion: + type: select + options: + - nothing + - warning + - error + default: "warning" + position: 8 extensions: monitoring: diff --git a/src/server/extension/monitoring-endpoint.js b/src/server/extension/monitoring-endpoint.js index 52f0701..dfb75e1 100755 --- a/src/server/extension/monitoring-endpoint.js +++ b/src/server/extension/monitoring-endpoint.js @@ -83,13 +83,30 @@ process.stdin.on('end', () => { ////////////////////////////////////////////////////////////// // Janitor-Status + let janitor = {}; let janitorActive = false; + let janitorEscalate = false; + let eventDeletionEnabled = true; if (info.config && info.config.system && info.config.system.config && info.config.system.config.janitor && info.config.system.config.janitor.active) { + // janitor enabled? if (info.config.system.config.janitor.active = true) { janitorActive = true; + } else { + janitorEscalate = true; + } + // check if all events have a small deletion daylimit + for (const eventType in info.config.system.config.janitor.events) { + eventConfigVal = info.config.system.config.janitor.events[eventType]; + if (eventConfigVal == null || eventConfigVal > 10 || eventConfigVal < 1) { + janitorEscalate = true; + eventDeletionEnabled = false; + } } } - result.janitorActive = janitorActive; + janitor.janitorActive = janitorActive; + janitor.eventDeletionEnabled = eventDeletionEnabled; + janitor.escalate = janitorEscalate; + result.janitor = janitor; ////////////////////////////////////////////////////////////// // Loglevel @@ -453,6 +470,7 @@ process.stdin.on('end', () => { statusEscalationLevels.purge = pluginBaseConfig.status__purge; statusEscalationLevels.loglevel = pluginBaseConfig.status__loglevel; statusEscalationLevels.pluginsallenabled = pluginBaseConfig.status__disabled_plugins; + statusEscalationLevels.janitoreventdeletionenabled = pluginBaseConfig.status__janitor_event_deletion; //result.statusEscalationLevels = statusEscalationLevels; @@ -463,9 +481,19 @@ process.stdin.on('end', () => { statusResults.validation = 'nothing'; statusResults.purge = 'nothing'; statusResults.loglevel = 'nothing'; + statusResults.janitor = 'nothing'; let statusMessages = []; + // check janitor for status-influence + if (statusEscalationLevels.janitoreventdeletionenabled !== 'nothing') { + if (result.janitor.escalate !== false) { + statusResults.janitor = statusEscalationLevels.janitoreventdeletionenabled; + statusMessages.push('Janitor'); + increaseStatus(statusEscalationLevels.janitoreventdeletionenabled); + } + } + // check email for status-influence if (statusEscalationLevels.email !== 'nothing') { if (result.email.notifications !== true || result.email.email_server == '' || result.email.adminEmails.length == 0) {