SNMP (Simple Network Management Protocol) and Zabbix integration

SNMP is a component of the Internet Protocol Suite as defined by the Internet Engineering Task Force (IETF). SNMP is widely used in network management for network monitoring. It consists of a set of standards for network management, including an application layer protocol, a database schema, and a set of data objects.

Example model & SONiC version:

  • Aurora 610/710
  • Netberg SONiC: sonic-202111-barefoot-230322
Note Some SONiC releases don’t have a CLI command to modify an SNMP community. Edit the file /etc/sonic/snmp.yml instead.

SNMP Config commands

This sub-section explains how to configure SNMP.

config snmp location add/del/modify

This command is used to add, delete, or modify the SNMP location.

Usage:

config snmp location (add | del | modify) <location>

Example (Add new SNMP location “Main Office” if it does not already exist):

admin@sonic:~$ sudo config snmp location add Main Office
SNMP Location Main Office has been added to configuration
Restarting SNMP service...

Example (Delete SNMP location “Main Office” if it already exists):

admin@sonic:~$ sudo config snmp location del Main Office
SNMP Location Main Office removed from configuration
Restarting SNMP service...

Example (Modify SNMP location “Main Office” to “Backup”):

admin@sonic:~$ sudo config snmp location modify Backup
SNMP location Backup modified in configuration
Restarting SNMP service...

config snmp contact add/del/modify

This command is used to add, delete, or modify the SNMP contact.

Usage:

config snmp contact add <contact> <contact_email>

Example:

admin@sonic:~$ sudo config snmp contact add user user@domain.com
Contact name user and contact email user@domain.com have been added to configuration
Restarting SNMP service...

Usage:

config snmp contact del <contact>

Example:

admin@sonic:~$ sudo config snmp contact del user
SNMP contact user removed from configuration
Restarting SNMP service...

Usage:

config snmp contact modify <contact> <contact_email>

Example:

admin@sonic:~$ sudo config snmp contact modify test test@domain.com
SNMP contact test and contact email test@domain.com updated
Restarting SNMP service...

config snmp community add/del/replace

This command is used to add, delete, or replace the SNMP community.

Usage:

config snmp community add <community> (RO | RW)

Example:

admin@sonic:~$ sudo config snmp community add netberg ro
SNMP community netberg added to configuration
Restarting SNMP service...

Usage:

config snmp community del <community>

Example:

admin@sonic:~$ sudo config snmp community del netberg
SNMP community netberg removed from configuration
Restarting SNMP service...

Usage:

config snmp community replace <community> <new_community>

Example:

admin@sonic:~$ sudo config snmp community replace netberg newnetberg
SNMP community newnetberg added to configuration
SNMP community newnetberg replace community netberg
Restarting SNMP service...

config snmp user add/del

This command is used to add or delete the SNMP user for SNMPv3.

Usage:

config snmp user add <user> (noAuthNoPriv|AuthNoPriv|Priv) (RO|RW) [[(MD5|SHA|MMAC-SHA-2) <auth_password>] [(DES|AES) <encrypt_password>]]

Example:

admin@sonic:~$ sudo config snmp user add testuser1 noauthnopriv ro
SNMP user testuser1 added to configuration
Restarting SNMP service...

Example:

admin@sonic:~$ sudo config snmp user add testuser2 authnopriv ro sha testuser2_auth_pass
SNMP user testuser2 added to configuration
Restarting SNMP service...

Example:

admin@sonic:~$ sudo config snmp user add testuser3 priv rw md5 testuser3_auth_pass aes testuser3_encrypt_pass
SNMP user testuser3 added to configuration
Restarting SNMP service...

Usage:

config snmp user del <user>

Example:

admin@sonic:~$ sudo config snmp user del testuser1
SNMP user testuser1 removed from configuration
Restarting SNMP service...

SNMP Show commands

show runningconfiguration snmp

This command displays the global SNMP configuration that includes the location, contact, community, and user settings.

Usage:

show runningconfiguration snmp

Example:

admin@sonic:~$ show runningconfiguration snmp
Location
------------
Netberg
SNMP_CONTACT    SNMP_CONTACT_EMAIL
--------------  --------------------
user            user@domain.com
Community String    Community Type
------------------  ----------------
public              RO
User    Permission Type    Type    Auth Type    Auth Password    Encryption Type    Encryption Password
------  -----------------  ------  -----------  ---------------  -----------------  ---------------------
admin   RO                 Priv    SHA          adminAuthPass    AES                adminEncryptPass

show runningconfiguration snmp location

This command displays the SNMP location setting.

Usage:

show runningconfiguration snmp location

Example:

admin@sonic:~$ show runningconfiguration snmp location
Location
------------
Netberg

Usage:

show runningconfiguration snmp location --json

Example:

admin@sonic:~$ show runningconfiguration snmp location --json
{'Location': 'Netberg'}

show runningconfiguration snmp contact

This command displays the SNMP contact setting.

Usage:

show runningconfiguration snmp contact

Example:

admin@sonic:~$ show runningconfiguration snmp contact
Contact    Contact Email
---------  ---------------
user       user@domain.com

Usage:

show runningconfiguration snmp contact --json

Example:

admin@sonic:~$ show runningconfiguration snmp contact --json
{'user': 'user@domain.com'}

show runningconfiguration snmp community

This command display the SNMP community settings.

Usage:

show runningconfiguration snmp community

Example:

admin@sonic:~$ show runningconfiguration snmp community
Community String    Community Type
------------------  ----------------
public              RO

Usage:

show runningconfiguration snmp community –json

Example:

admin@sonic:~$ show runningconfiguration snmp community --json
{'public': {'TYPE': 'RO'}}

show runningconfiguration snmp user

This command display the SNMP user settings.

Usage:

show runningconfiguration snmp user

Example:

admin@sonic:~$ show runningconfiguration snmp user
User       Permission Type    Type          Auth Type    Auth Password        Encryption Type    Encryption Password
---------  -----------------  ------------  -----------  -------------------  -----------------  ---------------------
admin      RO                 noAuthNoPriv

Usage:

show runningconfiguration snmp user --json

Example:

admin@sonic:~$ show runningconfiguration snmp user --json
{'admin': {'SNMP_USER_AUTH_PASSWORD': '', 'SNMP_USER_AUTH_TYPE': '', 'SNMP_USER_ENCRYPTION_PASSWORD': '', 'SNMP_USER_ENCRYPTION_TYPE': '', 'SNMP_USER_PERMISSION': 'RO', 'SNMP_USER_TYPE': 'noAuthNoPriv'}}

How to verify SNMP is working with the correct community string

Use the command line:

sudo docker exec -it snmp snmpwalk -v2c -c public 127.0.0.1 iso.3.6.1.2.1.1.1.0

Example:

iso.3.6.1.2.1.1.1.0 = STRING: "SONiC Software Version: SONiC.202111.0-dirty-20230321.222722 - HwSku: aurora-710 - Distribution: Debian 11.6 - Kernel: 5.10.0-8-2-amd64"

Integration with Zabbix

Create a new host using LINUX by SNMP template.

apt install snmp-mibs-downloader
download-mibs
Zabbix add Linux by SNMP for SONiC device
Figure 1. Add a host

Check the hosts monitoring page.

Zabbix hosts with SONiC device
Figure 2. Available hosts

Check SONiC interface data using the “show interfaces counters” command.

SONiC show interfaces counters
Figure 3. SONiC interface counters

Verify statistics in Zabbix.

 Traffic report in Zabbix
Figure 4. Zabbix traffic report
NEWS

Latest news