This guide walks you through the steps required to start basic monitoring of your network switch or router using Zabbix. A Cisco router is used as an example, but the procedure applies to any SNMP-enabled network device.
Who this guide is for
This guide is designed for new Zabbix users and network administrators who want to quickly enable basic monitoring for network devices. If you require deep customization or advanced configuration options, please refer to the SNMP agent page or the Configuration section of Zabbix manual.
Prerequisites
Before proceeding with this guide, ensure that you have:
To install MIB files on Ubuntu:
1. Install the MIB downloader package:
If you need to add vendor-specific MIBs (e.g., from Cisco, Juniper), place them in the appropriate MIB directory:
Ensure the MIBDIRS environment variable or the snmp.conf file includes the correct path.
To verify that your system recognizes the new MIBs, use:
For detailed instructions, refer to your SNMP library documentation:
2. Edit /etc/snmp/snmp.conf
and comment out the line that starts with mibs : to allow the system to load all available MIBs. 3. Verify by running an snmpwalk
(for example, snmpwalk -v 2c -c <your_community_string> <device_IP>
) and check that OIDs are displayed with descriptive names.
This guide is based on the following setup:
It is assumed that your network device is already physically installed and connected.
For monitoring via SNMP, you must configure your network device to allow SNMP queries. The example below is for SNMPv2 and does not take into account existing settings. Caution: applying these commands may override current SNMP configurations.
For a Cisco router, the configuration typically involves steps written below.
1. Enable SNMP and set community string.
Log in to your Cisco router’s console and enter configuration mode:
Then, enable SNMP by specifying a read-only community string. For example:
Replace <your_community_string>
with your secure community string. Note: the RO (Read-Only) option allows SNMP to retrieve data from the device but prevents any configuration changes.
It is recommended to restrict SNMP access to only the necessary devices for security reasons. For further guidance on configuring access control lists (ACLs), refer to Cisco's official documentation.
2. Save the configuration.
Save your changes to ensure SNMP settings persist after a reboot:
SNMPv3 provides enhanced security with authentication and encryption. Its configuration is more secure than SNMPv2 and should be verified against your device-specific documentation.
1. Create an SNMP group.
Configure an SNMPv3 group with privacy (encryption) enabled:
2. Create an SNMP user: Add an SNMPv3 user with authentication and privacy. Replace the placeholders with your desired values:
3. Save the configuration:
For further details or model-specific instructions, you may refer to external Cisco SNMP configuration tutorials. This guide, however, provides the basic steps for enabling SNMP monitoring.
1. Log into Zabbix frontend.
2. Add a new host.
Navigate to Data collection > Hosts and click on Create host.
3. Link Templates
In the Templates field, select the SNMP template that best matches your device. Zabbix provides a range of pre-built SNMP templates for many device families. For example, if you are monitoring a Cisco device, choose the template that corresponds to your device’s OS or model (such as Cisco IOS SNMP or Cisco Catalyst 3750<device model> SNMP).
4. Click on Add to save the host.
Congratulations! Zabbix is now set up to monitor your network device.
Latest Data:
To visualize the performance data, click on Graphs next to the SNMP items to see detailed metrics.
As a next step, you can:
Once the host is set up, you can create items to monitor specific metrics. Note: this step is optional if you're using a template, as templates already contain default sets of items.
1. Identify the SNMP OID:
Use the snmpwalk
command to list available OIDs on your device. For example:
Find the OID for the metric you wish to monitor (for instance, IF-MIB::ifHCInOctets.3 for incoming traffic on port 3). To get the numeric OID, you can use:
2. Create an SNMP item:
cisco.ifHCInOctets.3
).get[1.3.6.1.2.1.31.1.1.1.6.3]
for a single value;walk[1.3.6.1.2.1.31.1.1.1.6.3]
to retrieve a subtree of values asynchronously.To retrieve multiple values in one SNMP transaction, you can specify several OIDs using the syntax walk[OID1,OID2,...]
.
When working with SNMP, you might need to convert between numeric OIDs and their corresponding MIB names. This translation helps in identifying and troubleshooting metrics more easily.
Translating a MIB name to a numeric OID: use the snmptranslate
command with the -On
option. For example, to translate the MIB name IF-MIB::ifHCInOctets.3
to its numeric OID, run:
snmptranslate -On IF-MIB::ifHCInOctets.3
This command might output:
Translating a numeric OID to its MIB name: use the snmptranslate
command with the -IR
(or -m ALL
) option to reverse the translation. For example, to translate the numeric OID .1.3.6.1.2.1.31.1.1.1.6.3
back to its MIB name, run:
snmptranslate -IR -On .1.3.6.1.2.1.31.1.1.1.6.3
This command might output:
This guide provides basic configuration steps for sending email alerts.
1. Navigate to User settings > Profile, switch to the Media tab and add your email.
2. Follow the guide for Receiving a problem notification.
Next time, when Zabbix detects a problem, you should receive an alert via email.
To ensure that Zabbix correctly detects network performance issues, simulate a real problem by increasing the ICMP ping response time threshold.
1. Open your "Cisco Router" host configuration in Zabbix.
2. Navigate to the Macros tab and select Inherited and host macros.
3. Locate the {$ICMP_RESPONSE_TIME_WARN}
macro (or a similar response time threshold macro).
4. Set a very low value (e.g., 0.001) to trigger an alert when the ping response exceeds this value.
5. Click Update to apply the changes.
6. Wait a few moments for Zabbix to detect the simulated issue.
7. Navigate to Monitoring > Problems to verify that an alert appears (e.g., "High ICMP ping response time").
If alerts are configured, you should also receive a problem alert.
8. Revert the macro value to its original setting and click Update to save the changes.
9. Confirm that the problem is resolved and disappears from the Problems section.
If you notice that the SNMP icon in the Zabbix frontend appears RED or no data is collected, try the following steps:
1. Check SNMP connectivity.
For SNMPv2 run the following command from your Zabbix server:
This command verifies that the device responds to SNMP queries.
For SNMPv3, include the appropriate SNMPv3 credentials:
snmpwalk -v3 -u <your_user> -l authPriv -a MD5 -A <auth_password> -x AES -X <priv_password> <device_IP> .
This verifies that SNMPv3 credentials are correct and the device is responding securely.
2. Ensure that MIB files are installed and enabled as described in the prerequisites. To ensure that, following command must not give error when you query a network device:
This should return translated OIDs without errors.
3. Confirm that the SNMP version and credentials configured in Zabbix match those set on your device. For instance, review the SNMP settings in the Zabbix host configuration and verify them against your device’s configuration. On a Cisco device, you might check the SNMP settings by running:
This ensures that the community string (for SNMPv2) or SNMPv3 user details are correct.
4. Verify that SNMP is correctly enabled on your network device. On a Cisco router, log in to the console and run:
This command displays the active SNMP configuration and helps confirm that SNMP is properly configured.
5. Ensure that no firewalls or network issues are blocking SNMP traffic (typically on port 161) between the Zabbix server and the device. You can test connectivity using:
nc -zv <device_IP> 161
nc -zv
checks if port 161 is open and listening on the device.
Additionally, if you are using UFW on Ubuntu, check the firewall status:
Or, for iptables:
6. Review the Zabbix server log files for any SNMP-related errors to help pinpoint the issue:
tail -f
allows you to monitor log updates in real time.
See also: