From d44c87e8a78bda1bffadda104f81099f67885a74 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 28 Nov 2021 07:26:41 +0100 Subject: [PATCH] move SPAM BLOCKLIST check to icinga2 itself somehow, we tend to get false positives if we run that check on the node itself. --- bundles/{postfix => icinga2}/files/check_spam_blocklist | 0 bundles/icinga2/files/icinga2/check_commands.conf | 7 +++++++ bundles/icinga2/items.py | 3 +++ bundles/postfix/items.py | 3 --- bundles/postfix/metadata.py | 4 ++-- 5 files changed, 12 insertions(+), 5 deletions(-) rename bundles/{postfix => icinga2}/files/check_spam_blocklist (100%) diff --git a/bundles/postfix/files/check_spam_blocklist b/bundles/icinga2/files/check_spam_blocklist similarity index 100% rename from bundles/postfix/files/check_spam_blocklist rename to bundles/icinga2/files/check_spam_blocklist diff --git a/bundles/icinga2/files/icinga2/check_commands.conf b/bundles/icinga2/files/icinga2/check_commands.conf index 2c914e2..f5d1afe 100644 --- a/bundles/icinga2/files/icinga2/check_commands.conf +++ b/bundles/icinga2/files/icinga2/check_commands.conf @@ -106,6 +106,13 @@ object CheckCommand "check_smtp" { } } +object CheckCommand "spam_blocklist" { + import "plugin-check-command" + import "ipv4-or-ipv6" + + command = [ "/usr/local/share/icinga/plugins/check_spam_blocklist", "$ip$" ] +} + object CheckCommand "check_usv" { import "plugin-check-command" import "ipv4-or-ipv6" diff --git a/bundles/icinga2/items.py b/bundles/icinga2/items.py index 6168dc7..a6c061a 100644 --- a/bundles/icinga2/items.py +++ b/bundles/icinga2/items.py @@ -86,6 +86,9 @@ files = { '/usr/local/share/icinga/plugins/check_freifunk_node': { 'mode': '0755', }, + '/usr/local/share/icinga/plugins/check_spam_blocklist': { + 'mode': '0755', + }, '/usr/local/share/icinga/plugins/check_usv_snmp': { 'mode': '0755', }, diff --git a/bundles/postfix/items.py b/bundles/postfix/items.py index 7346fe3..e66185f 100644 --- a/bundles/postfix/items.py +++ b/bundles/postfix/items.py @@ -62,9 +62,6 @@ files = { '/usr/local/share/icinga/plugins/check_postfix_queue': { 'mode': '0755', }, - '/usr/local/share/icinga/plugins/check_spam_blocklist': { - 'mode': '0755', - }, } actions = { diff --git a/bundles/postfix/metadata.py b/bundles/postfix/metadata.py index 4c83baf..e0dbe61 100644 --- a/bundles/postfix/metadata.py +++ b/bundles/postfix/metadata.py @@ -137,8 +137,8 @@ def icinga2(metadata): for ip in ip_type: if not ip.is_private: services[f'SPAM BLOCKLIST {ip}'] = { - 'command_on_monitored_host': f'/usr/local/share/icinga/plugins/check_spam_blocklist {ip}', - 'vars.sshmon_timeout': 15, + 'check_command': 'spam_blocklist', + 'vars.ip': str(ip), } return {