bundlewrap/bundles/netdata/metadata.py
Franzi 5935aed0db
All checks were successful
bundlewrap/pipeline/head This commit looks good
bundles/{netdata,pppd,radvd,vmhost,vnstat,wide-dhcp6c}: add monitoring
2020-12-21 09:50:15 +01:00

38 lines
870 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
def iptables(metadata):
interfaces = metadata.get('netdata/restrict-to-interfaces', set())
iptables = []
if len(interfaces):
for iface in sorted(interfaces):
iptables.append(f'iptables -A INPUT -i {iface} -p tcp --dport 19999 -j ACCEPT')
else:
iptables.append('iptables -A INPUT -p tcp --dport 19999 -j ACCEPT')
return {
'iptables': {
'bundle_rules': {
'netdata': iptables,
},
},
}