bundlewrap/bundles/netdata/metadata.py

29 lines
608 B
Python
Raw Normal View History

defaults = {
'apt': {
'packages': {
'netdata': {},
},
},
}
@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,
},
},
}