Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmpd: ignore Docker network interfaces #170

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}

#

Loading