From 1fb98f581eba21ba2d0630a519b084de1d88ff9e Mon Sep 17 00:00:00 2001 From: DasSkelett Date: Sun, 18 Aug 2024 00:18:54 +0200 Subject: [PATCH] snmpd: ignore Docker network interfaces --- snmpd/snmpd.conf | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/snmpd/snmpd.conf b/snmpd/snmpd.conf index fa376a71..7048c7b2 100644 --- a/snmpd/snmpd.conf +++ b/snmpd/snmpd.conf @@ -69,28 +69,15 @@ sysServices 72 # Network interfaces # -{%- for interface in salt['grains.get']('ip_interfaces') | sort %} +{%- set ip_interfaces = salt['grains.get']('ip_interfaces') | sort %} +{%- set hwaddr_interfaces = salt['grains.get']('hwaddr_interfaces') %} +{%- for interface in ip_interfaces if interface is not match('^veth') and ( interface is not match('^br-') or interface not in hwaddr_interfaces or hwaddr_interfaces[interface] | string is not match('^02:42') ) %} {%- if 'vlan' in interface or 'br0' in interface or 'eth0' in interface or 'enp' in interface %} interface {{ interface }} 6 1000000000 {%- else %} interface {{ interface }} 6 100000000 {%- endif %} {%- endfor %} -{%- set ovpn_networks = [] %} -{%- for netname, network in salt['pillar.get']('ovpn', {}).items () if grains['id'] in network %} - {%- do ovpn_networks.append (netname) %} -{%- endfor %} -{%- for netname in ovpn_networks|sort %} - {%- set network = salt['pillar.get']('ovpn:' ~ netname) %} - {%- set network_config = network.get ('config') %} - {%- set host_stanza = network.get (grains['id']) %} - {%- set host_config = host_stanza.get ('config', {}) %} - {%- set interface = host_config.get ('interface', network_config.get ('interface')) %} - {%- if loop.first %} -# OpenVPN interfaces - {%- endif %} -interface {{ interface }} 6 100000000 -{%- endfor %} #