2017-01-19 22:56:26 -06:00
|
|
|
###############################################################################
|
2017-02-03 23:01:34 -06:00
|
|
|
# Managed by sonic-config-engine
|
2017-01-19 22:56:26 -06:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# EXAMPLE.conf:
|
|
|
|
# An example configuration file for configuring the Net-SNMP agent ('snmpd')
|
|
|
|
# See the 'snmpd.conf(5)' man page for details
|
|
|
|
#
|
|
|
|
# Some entries are deliberately commented out, and will need to be explicitly activated
|
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# AGENT BEHAVIOUR
|
|
|
|
#
|
|
|
|
|
2018-04-10 22:15:20 -05:00
|
|
|
# Listen for connections on all ip addresses, including eth0, ipv4 lo
|
2019-09-18 19:26:45 -05:00
|
|
|
#
|
2020-01-28 19:41:21 -06:00
|
|
|
{% if SNMP_AGENT_ADDRESS_CONFIG %}
|
|
|
|
{% for (agentip, port, vrf) in SNMP_AGENT_ADDRESS_CONFIG %}
|
|
|
|
agentAddress {{ agentip }}{% if port %}:{{ port }}{% endif %}{% if vrf %}%{{ vrf }}{% endif %}{{ "" }}
|
|
|
|
{% endfor %}
|
2019-09-18 19:26:45 -05:00
|
|
|
{% else %}
|
2017-02-03 23:01:34 -06:00
|
|
|
agentAddress udp:161
|
2019-09-24 17:13:18 -05:00
|
|
|
agentAddress udp6:161
|
2019-09-18 19:26:45 -05:00
|
|
|
{% endif %}
|
|
|
|
|
2017-01-19 22:56:26 -06:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# ACCESS CONTROL
|
|
|
|
#
|
|
|
|
|
|
|
|
# system + hrSystem groups only
|
|
|
|
view systemonly included .1.3.6.1.2.1.1
|
|
|
|
view systemonly included .1.3.6.1.2.1.25.1
|
|
|
|
|
|
|
|
# Default access to basic system info
|
2021-01-05 15:43:29 -06:00
|
|
|
|
|
|
|
|
|
|
|
{% if SNMP_COMMUNITY is defined %}
|
|
|
|
{% for community in SNMP_COMMUNITY %}
|
|
|
|
{% if SNMP_COMMUNITY[community]['TYPE'] == 'RO' %}
|
2018-04-10 22:20:35 -05:00
|
|
|
rocommunity {{ community }}
|
2019-09-26 20:23:12 -05:00
|
|
|
rocommunity6 {{ community }}
|
2021-01-05 15:43:29 -06:00
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if SNMP_COMMUNITY is defined %}
|
|
|
|
{% for community in SNMP_COMMUNITY %}
|
|
|
|
{% if SNMP_COMMUNITY[community]['TYPE'] == 'RW' %}
|
|
|
|
rwcommunity {{ community }}
|
|
|
|
rwcommunity6 {{ community }}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if SNMP_USER is defined %}
|
|
|
|
{% 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'] }}
|
|
|
|
{% elif SNMP_USER[user]['SNMP_USER_PERMISSION'] == 'RW' %}
|
|
|
|
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 %}
|
2018-04-10 22:20:35 -05:00
|
|
|
{% endfor %}
|
|
|
|
{% else %}
|
2018-04-13 12:50:58 -05:00
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
|
2021-01-05 15:43:29 -06:00
|
|
|
|
2017-01-19 22:56:26 -06:00
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# SYSTEM INFORMATION
|
|
|
|
#
|
|
|
|
|
|
|
|
# Note that setting these values here, results in the corresponding MIB objects being 'read-only'
|
|
|
|
# See snmpd.conf(5) for more details
|
2021-01-05 15:43:29 -06:00
|
|
|
|
|
|
|
{% if SNMP is defined and SNMP.LOCATION is defined %}
|
|
|
|
sysLocation {{ SNMP.LOCATION.Location }}
|
|
|
|
{% else %}
|
|
|
|
sysLocation public
|
|
|
|
{% endif %}
|
|
|
|
{% if SNMP is defined and SNMP.CONTACT is defined %}
|
2022-02-10 11:01:46 -06:00
|
|
|
sysContact {{ SNMP.CONTACT.keys() | first }} {{ SNMP.CONTACT.values() | first }}
|
2021-01-05 15:43:29 -06:00
|
|
|
{% else %}
|
2017-01-19 22:56:26 -06:00
|
|
|
sysContact Azure Cloud Switch vteam <linuxnetdev@microsoft.com>
|
2021-01-05 15:43:29 -06:00
|
|
|
{% endif %}
|
|
|
|
|
2017-01-19 22:56:26 -06:00
|
|
|
# Application + End-to-End layers
|
|
|
|
sysServices 72
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Process Monitoring
|
|
|
|
#
|
2017-09-21 19:31:39 -05:00
|
|
|
# todo: should we enable snmp based monitoring of sswsyncd and other processes?
|
2017-01-19 22:56:26 -06:00
|
|
|
|
|
|
|
# At least one 'sendmail' process, but no more than 10
|
|
|
|
#proc sendmail 10 1
|
|
|
|
|
|
|
|
# Walk the UCD-SNMP-MIB::prTable to see the resulting output
|
|
|
|
# Note that this table will be empty if there are no "proc" entries in the snmpd.conf file
|
|
|
|
|
|
|
|
|
2018-05-01 20:32:49 -05:00
|
|
|
#
|
|
|
|
# Disk Monitoring
|
|
|
|
#
|
|
|
|
# 10MBs required on root disk, 5% free on /var, 10% free on all other disks
|
|
|
|
disk / 10000
|
|
|
|
disk /var 5%
|
|
|
|
includeAllDisks 10%
|
|
|
|
|
2017-01-19 22:56:26 -06:00
|
|
|
# Walk the UCD-SNMP-MIB::dskTable to see the resulting output
|
|
|
|
# Note that this table will be empty if there are no "disk" entries in the snmpd.conf file
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# System Load
|
|
|
|
#
|
|
|
|
# Unacceptable 1-, 5-, and 15-minute load averages
|
|
|
|
load 12 10 5
|
|
|
|
|
|
|
|
# Walk the UCD-SNMP-MIB::laTable to see the resulting output
|
|
|
|
# Note that this table *will* be populated, even without a "load" entry in the snmpd.conf file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# ACTIVE MONITORING
|
|
|
|
#
|
|
|
|
# Note: disabled snmp traps due to side effect of causing snmpd to listen on all ports (0.0.0.0)
|
|
|
|
#
|
|
|
|
# send SNMPv1 traps
|
2020-01-28 19:41:21 -06:00
|
|
|
{% if SNMP_TRAP_CONFIG and SNMP_TRAP_CONFIG['v1TrapDest'] %}
|
|
|
|
{% set v1SnmpTrapIp = SNMP_TRAP_CONFIG['v1TrapDest']['DestIp'] %}
|
|
|
|
{% set v1SnmpTrapPort = SNMP_TRAP_CONFIG['v1TrapDest']['DestPort'] %}
|
|
|
|
{% set v1SnmpTrapVrf = SNMP_TRAP_CONFIG['v1TrapDest']['vrf'] %}
|
|
|
|
{% set v1SnmpTrapComm = SNMP_TRAP_CONFIG['v1TrapDest']['Community'] %}
|
|
|
|
trapsink {{ v1SnmpTrapIp }}:{{ v1SnmpTrapPort }}{% if v1SnmpTrapVrf != 'None' %}%{{ v1SnmpTrapVrf }}{% endif %} {{ v1SnmpTrapComm }}{{ "" }}
|
2019-09-18 19:26:45 -05:00
|
|
|
{% else %}
|
2017-01-19 22:56:26 -06:00
|
|
|
#trapsink localhost public
|
2019-09-18 19:26:45 -05:00
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
# send SNMPv2c traps
|
2020-01-28 19:41:21 -06:00
|
|
|
{% if SNMP_TRAP_CONFIG and SNMP_TRAP_CONFIG['v2TrapDest'] %}
|
|
|
|
{% set v2SnmpTrapIp = SNMP_TRAP_CONFIG['v2TrapDest']['DestIp'] %}
|
|
|
|
{% set v2SnmpTrapPort = SNMP_TRAP_CONFIG['v2TrapDest']['DestPort'] %}
|
|
|
|
{% set v2SnmpTrapVrf = SNMP_TRAP_CONFIG['v2TrapDest']['vrf'] %}
|
|
|
|
{% set v2SnmpTrapComm = SNMP_TRAP_CONFIG['v2TrapDest']['Community'] %}
|
|
|
|
trap2sink {{ v2SnmpTrapIp }}:{{ v2SnmpTrapPort }}{% if v2SnmpTrapVrf != 'None' %}%{{ v2SnmpTrapVrf }}{% endif %} {{ v2SnmpTrapComm }}{{ "" }}
|
2019-09-18 19:26:45 -05:00
|
|
|
{% else %}
|
2017-01-19 22:56:26 -06:00
|
|
|
#trap2sink localhost public
|
2019-09-18 19:26:45 -05:00
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
# send SNMPv2c INFORMs
|
2020-01-28 19:41:21 -06:00
|
|
|
{% if SNMP_TRAP_CONFIG and SNMP_TRAP_CONFIG['v3TrapDest'] %}
|
|
|
|
{% set v3SnmpTrapIp = SNMP_TRAP_CONFIG['v3TrapDest']['DestIp'] %}
|
|
|
|
{% set v3SnmpTrapPort = SNMP_TRAP_CONFIG['v3TrapDest']['DestPort'] %}
|
|
|
|
{% set v3SnmpTrapVrf = SNMP_TRAP_CONFIG['v3TrapDest']['vrf'] %}
|
|
|
|
{% set v3SnmpTrapComm = SNMP_TRAP_CONFIG['v3TrapDest']['Community'] %}
|
|
|
|
trapsink {{ v3SnmpTrapIp }}:{{ v3SnmpTrapPort }}{% if v3SnmpTrapVrf != 'None' %}%{{ v3SnmpTrapVrf }}{% endif %} {{ v3SnmpTrapComm }}{{ "" }}
|
2019-09-18 19:26:45 -05:00
|
|
|
{% else %}
|
2017-01-19 22:56:26 -06:00
|
|
|
#informsink localhost public
|
2019-09-18 19:26:45 -05:00
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
|
|
|
|
# Note that you typically only want *one* of these three lines
|
|
|
|
# Uncommenting two (or all three) will result in multiple copies of each notification.
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Event MIB - automatically generate alerts
|
|
|
|
#
|
|
|
|
# Remember to activate the 'createUser' lines above
|
2017-05-16 18:46:30 -05:00
|
|
|
#iquerySecName internalUser
|
2017-01-19 22:56:26 -06:00
|
|
|
#rouser internalUser
|
|
|
|
# generate traps on UCD error conditions
|
|
|
|
#defaultMonitors yes
|
|
|
|
#note, this release of snmpd does not support linkUpDownNotifications
|
|
|
|
# generate traps on linkUp/Down
|
|
|
|
#linkUpDownNotifications yes
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# AgentX Sub-agents
|
|
|
|
#
|
|
|
|
# Run as an AgentX master agent
|
|
|
|
master agentx
|
2019-06-19 03:24:42 -05:00
|
|
|
# internal socket to allow extension to other docker containers
|
|
|
|
# Currently the other container using this is docker-fpm-frr
|
|
|
|
# make sure this line matches bgp:/etc/snmp/frr.conf
|
|
|
|
# please see testing procedure in the same file to verify this works
|
|
|
|
# to verify the SNMP docker side look for the following string in the log file:
|
|
|
|
# INFO snmp-subagent [ax_interface] INFO: Using agentx socket type tcp with path tcp:localhost:3161
|
|
|
|
# INFO supervisord snmp-subagent INFO:ax_interface:Using agentx socket type tcp with path tcp:localhost:3161
|
|
|
|
agentxsocket tcp:localhost:3161
|
2017-01-19 22:56:26 -06:00
|
|
|
|
|
|
|
#
|
|
|
|
# SysDescription pass-through
|
|
|
|
#
|
|
|
|
|
|
|
|
pass -p 10 .1.3.6.1.2.1.1.1 /usr/share/snmp/sysDescr_pass.py
|