bundlewrap/bundles/netdata/metadata.py

40 lines
912 B
Python
Raw Normal View History

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())
2021-02-12 19:37:36 +00:00
rules = []
2021-02-12 19:37:36 +00:00
if interfaces:
for iface in sorted(interfaces):
2021-02-12 19:37:36 +00:00
rules.append(f'iptables_both -A INPUT -i {iface} -p tcp --dport 19999 -j ACCEPT')
else:
2021-02-12 19:37:36 +00:00
rules.append('iptables_both -A INPUT -p tcp --dport 19999 -j ACCEPT')
return {
'iptables': {
'bundle_rules': {
2021-02-12 19:37:36 +00:00
'netdata': rules,
},
},
}