bundles/wireguard: one icinga2 check per peer
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
Some checks failed
bundlewrap/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3ab39f9ede
commit
67d8293201
2 changed files with 44 additions and 52 deletions
|
@ -12,15 +12,6 @@ defaults = {
|
|||
},
|
||||
},
|
||||
},
|
||||
'icinga2_api': {
|
||||
'wireguard': {
|
||||
'services': {
|
||||
'WIREGUARD CONNECTED': {
|
||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_wireguard_connected',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'iptables': {
|
||||
'bundle_rules': {
|
||||
'wireguard': [
|
||||
|
@ -83,3 +74,23 @@ def get_my_wireguard_peers(metadata):
|
|||
'peers': peers,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@metadata_reactor
|
||||
def icinga2(metadata):
|
||||
services = {}
|
||||
|
||||
for peer, config in metadata.get('wireguard/peers', {}).items():
|
||||
services[f'WIREGUARD CONNECTION {peer}'] = {
|
||||
'command_on_monitored_host': 'sudo /usr/local/share/icinga/plugins/check_wireguard_connected wg0 {}'.format(
|
||||
config['pubkey'],
|
||||
),
|
||||
}
|
||||
|
||||
return {
|
||||
'icinga2_api': {
|
||||
'wireguard': {
|
||||
'services': services,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue