bundlewrap/bundles/netdata/metadata.py
Franziska Kunsmann 2d42e5f7dd
All checks were successful
bundlewrap/pipeline/head This commit looks good
update bw to 4.3, add .provides() to metadata reactors
2021-01-07 18:44:38 +01:00

39 lines
929 B
Python

defaults = {
'apt': {
'packages': {
'netdata': {},
},
},
'icinga2_api': {
'netdata': {
'services': {
'NETDATA PROCESS': {
'command_on_monitored_host': '/usr/lib/nagios/plugins/check_procs -C netdata -c 1:',
},
},
},
},
}
@metadata_reactor.provides(
'iptables/bundle_rules/netdata',
)
def iptables(metadata):
interfaces = metadata.get('netdata/restrict-to-interfaces', set())
iptables = []
if len(interfaces):
for iface in sorted(interfaces):
iptables.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 19999 -j ACCEPT')
else:
iptables.append('iptables_both -A INPUT -p tcp --dport 19999 -j ACCEPT')
return {
'iptables': {
'bundle_rules': {
'netdata': iptables,
},
},
}