From 3a56b0425cf751680c30b46351322afc7e2aacb4 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 22 Nov 2020 11:44:09 +0100 Subject: [PATCH] bundles/icinga2: add default for vars.notification.mail, enable mail for check_sipgate_account_balance --- bundles/icinga2/files/icinga2/services_template.conf | 3 ++- bundles/icinga2/metadata.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/icinga2/files/icinga2/services_template.conf b/bundles/icinga2/files/icinga2/services_template.conf index 1450bfe..76a8ff0 100644 --- a/bundles/icinga2/files/icinga2/services_template.conf +++ b/bundles/icinga2/files/icinga2/services_template.conf @@ -4,7 +4,7 @@ object Service "${service}" { import "generic-service" host_name = "${node_data.name}" % for k, v in sorted(config.items()): -% if k != 'import' and k != 'command_on_monitored_host': +% if k not in {'import', 'command_on_monitored_host'} and not k.startswith('vars.notification'): % if isinstance(v, bool) or isinstance(v, int) or k in ["check_interval", "retry_interval"]: ${k} = ${str(v).lower()} % elif isinstance(v, list): @@ -16,6 +16,7 @@ object Service "${service}" { % endfor vars.bundle = "${bundle_name}" vars.notification.sms = ${str(config.get('vars.notification.sms', False)).lower()} + vars.notification.mail = ${str(config.get('vars.notification.mail', False)).lower()} } % endfor % endfor diff --git a/bundles/icinga2/metadata.py b/bundles/icinga2/metadata.py index 91ce91d..25571ed 100644 --- a/bundles/icinga2/metadata.py +++ b/bundles/icinga2/metadata.py @@ -36,6 +36,7 @@ defaults = { 'SIPGATE ACCOUNT BALANCE': { 'check_command': 'check_sipgate_account_balance', 'check_interval': '30m', + 'vars.notification.mail': True, }, }, },