bundlewrap/bundles/mosquitto/metadata.py
Franziska Kunsmann 513eb4bed6
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/mosquitto: add monitoring
2021-04-03 09:43:24 +02:00

42 lines
880 B
Python

from bundlewrap.metadata import atomic
defaults = {
'apt': {
'packages': {
'mosquitto': {},
'mosquitto-clients': {},
},
},
'icinga2_api': {
'mosquitto': {
'services': {
'MOSQUITTO PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C mosquitto -c 1:',
},
},
},
},
'mosquitto': {
'listeners': {
'1883': {},
},
},
}
@metadata_reactor.provides(
'iptables/port_rules',
)
def iptables(metadata):
sources = metadata.get('mosquitto/restrict-to', {'*'})
result = {}
for listener in metadata.get('mosquitto/listeners').keys():
result[listener] = atomic(sources)
return {
'iptables': {
'port_rules': result,
},
}