Merge branch 'kunsi-icinga2' into main
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2020-11-13 13:03:16 +01:00
commit f04dac11e5
Signed by: kunsi
GPG key ID: 12E3D2136B818350
8 changed files with 797 additions and 11 deletions

View file

@ -26,10 +26,6 @@ if node.has_bundle('postfixadmin'):
}
defaults['icinga2_api']['postfix']['services'].update({
'SPAM BLOCKLIST': {
'check_command': 'spam_blocklist',
# vars.ip will be filled using a metadata reactor
},
'SMTP CONNECT': {
'check_command': 'check_smtp',
},
@ -48,17 +44,20 @@ else:
@metadata_reactor
def fill_icinga_spam_blocklist_check_with_hostname(metadata):
if not node.has_bundle('postfixadmin'):
raise DoNotRunAgain
checks = {}
for variant, ips in repo.libs.tools.resolve_identifier(repo, node.name).items():
for ip in ips:
if not ip.is_private:
checks[f'SPAM BLOCKLIST {ip}'] = {
'check_command': 'check_rbl',
'vars.ip': str(ip),
}
return {
'icinga2_api': {
'postfix': {
'services': {
'SPAM BLOCKLIST': {
'vars.ip': metadata.get('postfix/myhostname', metadata.get('hostname', node.hostname)),
},
},
'services': checks,
},
},
}