Skip to content

Commit

Permalink
Merge pull request #170 from DasSkelett/snmpd-ignore-docker-nics
Browse files Browse the repository at this point in the history
snmpd: ignore Docker network interfaces
  • Loading branch information
DasSkelett authored Aug 30, 2024
2 parents 9ad15fb + 1fb98f5 commit 8cc57b1
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions snmpd/snmpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

#

0 comments on commit 8cc57b1

Please sign in to comment.