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

updated to support snmp config from redis configdb #6134

Merged
merged 11 commits into from
Jan 5, 2021
28 changes: 28 additions & 0 deletions dockers/docker-snmp/snmpd.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@ rocommunity6 {{ community }}
rocommunity {{ snmp_rocommunity }}
rocommunity6 {{ snmp_rocommunity }}
{% endif %}

{% if snmp_rwcommunities is defined %}
{% for community in snmp_rwcommunities %}
rwcommunity {{ community }}
rwcommunity6 {{ community }}
{% endfor %}
{% elif snmp_rwcommunity is defined %}
rwcommunity {{ snmp_rwcommunity }}
rwcommunity6 {{ snmp_rwcommunity }}
{% else %}
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}

{% if SNMP_USER is defined %}
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
{% for user in SNMP_USER %}
{% if SNMP_USER[user]['SNMP_USER_PERMISSION'] == 'RO' %}
rouser {{ user }} {{ SNMP_USER[user]['SNMP_USER_TYPE'] }}
CreateUser {{ user }} {{ SNMP_USER[user]['SNMP_USER_AUTH_TYPE'] }} {{ SNMP_USER[user]['SNMP_USER_AUTH_PASSWORD'] }} {{ SNMP_USER[user]['SNMP_USER_ENCRYPTION_TYPE'] }} {{ SNMP_USER[user]['SNMP_USER_ENCRYPTION_PASSWORD'] }}
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
rwuser {{ user }} {{ SNMP_USER[user]['SNMP_USER_TYPE'] }}
CreateUser {{ user }} {{ SNMP_USER[user]['SNMP_USER_AUTH_TYPE'] }} {{ SNMP_USER[user]['SNMP_USER_AUTH_PASSWORD'] }} {{ SNMP_USER[user]['SNMP_USER_ENCRYPTION_TYPE'] }} {{ SNMP_USER[user]['SNMP_USER_ENCRYPTION_PASSWORD'] }}
{% endif %}
{% endfor %}
{% else %}
{% endif %}

###############################################################################
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
#
Expand All @@ -52,7 +76,11 @@ rocommunity6 {{ snmp_rocommunity }}
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
# See snmpd.conf(5) for more details
sysLocation {{ snmp_location }}
{% if SNMP_CONTACT is defined %}
sysContact {{ SNMP.CONTACT.keys()[0] }} {{ SNMP.CONTACT.values()[0] }}
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
{% else %}
sysContact Azure Cloud Switch vteam <linuxnetdev@microsoft.com>
tsvanduyn marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
# Application + End-to-End layers
sysServices 72

Expand Down