bundlewrap/bundles/bind/metadata.py

34 lines
779 B
Python
Raw Normal View History

2020-06-05 15:05:14 +00:00
from bundlewrap.metadata import atomic
2020-08-18 13:27:55 +00:00
defaults = {
'icinga2_api': {
'bind': {
'services': {
'BIND PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C named -c 1:1',
},
},
},
},
}
2020-06-05 15:05:14 +00:00
2020-08-18 13:27:55 +00:00
@metadata_reactor
def port_checks(metadata):
services = {}
2020-06-05 15:05:14 +00:00
2020-08-18 13:27:55 +00:00
for interface in metadata.get('bind/listen', set()):
services[f'BIND PORT {interface}'] = {
2020-06-05 15:05:14 +00:00
'check_command': 'tcp',
2020-08-18 13:27:55 +00:00
'vars.tcp_address': metadata.get(f'interfaces/{interface}/ip_addresses')[0],
2020-06-05 15:05:14 +00:00
'vars.tcp_port': 53,
2020-08-18 13:27:55 +00:00
}
2020-06-05 15:05:14 +00:00
return {
2020-08-18 13:27:55 +00:00
'icinga2_api': {
'bind': {
'services': services,
2020-06-05 15:05:14 +00:00
},
},
2020-08-18 13:27:55 +00:00
}