Skip to content

Commit

Permalink
added janitor event deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Helms committed Nov 14, 2023
1 parent 786538c commit 8c1bf67
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
5 changes: 5 additions & 0 deletions l10n/monitoring-endpoint.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions manifest.master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 29 additions & 1 deletion src/server/extension/monitoring-endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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) {
Expand Down

0 comments on commit 8c1bf67

Please sign in to comment.