Mastering SNMP Configuration in Your Cisco Lab Using Nagios XI
Written on
Chapter 1: Introduction to SNMP Configuration
In this guide, I’ll share my recent experience of setting up SNMP in my network for the first time. I’ve been eager to configure SNMP for a while because it opens up a wealth of data about the network I've diligently built. This process truly enhances my understanding of network engineering.
For those interested in a visual guide, feel free to check out the video linked below.
What is SNMP?
SNMP, or Simple Network Management Protocol, is a protocol designed to assist in managing networks by gathering data and statistics regarding network devices. It uses two key port numbers: UDP port 161 for the agents on network devices and UDP port 162 for the Network Management Station (NMS).
The SNMP agent is the software embedded within the network devices we aim to monitor, facilitating communication with the NMS. This NMS can be a simple PC that collects and organizes data from the SNMP agents into various categories.
SNMP comes in several versions, with two prominent ones being SNMP version 2c and SNMP version 3. The latter introduces enhanced security features, such as message integrity checks, authentication, and encryption, making it a more secure option than its predecessor.
Chapter 2: Installing Nagios XI
For our network monitoring needs, we will utilize Nagios XI, a user-friendly software that simplifies the monitoring process. However, you are welcome to use alternative tools if you prefer.
After selecting your preferred installation method—be it for Microsoft, VMware, or Linux—I opted for the VirtualBox route, downloading the .ova file, which provides a compressed, pre-configured virtual machine for easy setup. Just follow the installation instructions and remember your server's IP address, which will be prominently displayed.
Log into your Nagios XI web server, create your account, and you’re all set.
Chapter 3: SNMP Configuration on Cisco IOS
To configure SNMP on your Cisco router, you can use the following command:
Router(config)#snmp-server community SNMP2c rw
This command sets a community string of "SNMP2c" with read-write privileges, effectively acting as a password. The "rw" option grants us the ability to read and write data, allowing for device configuration through SNMP.
It’s also a good practice to include the following commands for clarity:
Router(config)#snmp-server location London
Router(config)#snmp-server contact [email protected]
These commands aren’t essential but help identify the device's location and contact information.
Next, we need to configure the SNMP server to which messages will be sent:
Router(config)#snmp-server host 192.168.10.2 version 2c SNMP2c
SNMP agents can send two types of notifications: traps and informs. Traps are sent without requiring acknowledgment, while informs do require acknowledgment from the SNMP server, which can lead to additional overhead.
To enable traps, use the command:
Router(config)#snmp-server enable traps
If you encounter a message after executing this command, it may indicate that OSPF is enabled on your interfaces. For enabling traps on OSPF interfaces, you can issue:
Router(config)#snmp-server enable traps ospf cisco-specific errors config-error
Router(config)#snmp-server enable traps ospf cisco-specific errors shamlink
Chapter 4: Configuring Your NMS Software
Now, log into Nagios XI (or your chosen SNMP NMS software) and set up your configuration. The process should be straightforward. Access Nagios XI by entering the following in your web browser: http://youripaddress, where the IP address was noted during installation.
If this is your first login, you’ll need to establish your login credentials. Once on the dashboard, navigate to [Configure].
Search for "Network Switch / Router" and enter an IP address that’s always reachable—ideally one configured on a loopback interface. Set the community string to match the one you configured on your Cisco devices, which was "SNMP2c".
After clicking "next," you’ll see all ports that Nagios XI has detected and is ready to monitor. You can finalize the configuration settings and either save it as a template or apply the changes directly.
Feel free to explore the Nagios interface (outside of production environments) and test the alerts by enabling and disabling interfaces to observe how alerts are generated.
In future documentation, I plan to delve deeper into Nagios features, including setting up Ansible for pushing configurations to Cisco devices.
For now, that wraps up the basics of SNMP configuration in your Cisco lab environment.
Chapter 5: More Resources
For further learning, check out the following video on setting up SNMP software: