bundles/wireguard: health checks for everyone
This commit is contained in:
parent
15eaa94397
commit
4f260932c3
5 changed files with 45 additions and 22 deletions
|
@ -244,3 +244,37 @@ def snat(metadata):
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@metadata_reactor.provides(
|
||||
'wireguard/health_checks',
|
||||
'systemd-timers/timers/wg-health-check',
|
||||
)
|
||||
def health_checks(metadata):
|
||||
checks = {}
|
||||
|
||||
for peer, config in metadata.get('wireguard/peers', {}).items():
|
||||
if (
|
||||
config.get('exclude_from_monitoring', False)
|
||||
or 'endpoint' not in config
|
||||
):
|
||||
continue
|
||||
|
||||
checks[peer] = config['their_ip']
|
||||
|
||||
if not checks:
|
||||
return {}
|
||||
|
||||
return {
|
||||
'systemd-timers': {
|
||||
'timers': {
|
||||
'wg-health-check': {
|
||||
'command': '/usr/local/bin/wg_health_check',
|
||||
'when': 'minutely',
|
||||
},
|
||||
},
|
||||
},
|
||||
'wireguard': {
|
||||
'health_checks': checks,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue