Step-by-Step Guide: Setting Up SNMP on Ubuntu 24 for Nagios XI
Efficient network monitoring is essential for maintaining system performance and preventing downtime. SNMP (Simple Network Management Protocol) provides a robust mechanism for monitoring network devices and Linux servers with Nagios XI, eliminating the need for additional agents.
This guide walks you through the installation and configuration of SNMP on Ubuntu 24 for seamless integration with Nagios XI. We will cover both SNMP v2c (widely used but less secure) and SNMP v3 (offering authentication and encryption for enhanced security).
Target Audience
This document is intended for Nagios XI administrators who want to implement SNMP-based monitoring on Ubuntu machines to gain real-time visibility into system metrics.
Prerequisites
Before proceeding, ensure the following:
- You have administrative or sudo privileges on the Ubuntu machine.
- You are using Ubuntu 24.04 or later.
- Nagios XI is installed and accessible, with the SNMP Wizard enabled.
Step 1: Install SNMP Packages
To install SNMP and the necessary libraries, log in to your Ubuntu machine and execute the following command:
sudo apt-get update
sudo apt-get install snmpd libsnmp-dev -yThis updates your package list and installs:
libsnmp-dev(SNMP development libraries for querying SNMP devices).snmpd(the SNMP daemon for handling SNMP requests).
Step 2: Configure SNMP
SNMP v2c Configuration
To configure SNMP v2c, first, create a backup of the existing configuration:
sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bakNow, edit the SNMP configuration file:
sudo nano /etc/snmp/snmpd.confChange #agentAddress to:
agentAddress udp:161Find and modify the following line to define the community string and allow access from your Nagios XI server (replace public with your desired community string and 192.168.0.23 with your Nagios XI server’s IP address):
rocommunity public 127.0.0.1 #loclal host
recommunity public 192.168.1.0/24
recommunity public 192.168.0.23/32 #My Nagios XI Example
recommunity6 public 192.168.1.0/24Example .conf file.

Save the file and restart the SNMP service:
sudo systemctl restart snmpd.serviceSNMP v3 Configuration (Optional, More Secure)
To configure SNMP v3, create an SNMP user with authentication and encryption:
sudo net-snmp-create-v3-user -ro -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy nagios-a SHA→ Specifies SHA for authentication (useMD5if needed, but it’s less secure)-x AES→ Enables AES encryption (alternatively, useDESfor lower security)
Restart the SNMP service:
sudo systemctl restart snmpd.serviceStep 3: Configure Firewall Rules
If your Ubuntu firewall (ufw) is enabled, allow SNMP traffic:
sudo ufw allow snmp
sudo ufw reloadFor better security, allow SNMP traffic only from the Nagios XI server:
sudo ufw allow from 192.168.1.0/24 to any port 161 proto udpStep 4: Enable SNMP Service on Boot
To ensure SNMP starts automatically on system boot, run:
sudo systemctl enable snmpd.serviceStep 5: Test SNMP Communication
On your Nagios XI server, test SNMP connectivity using the following commands.
For SNMP v2c:
snmpwalk -v2c -c public <Your-IP-Address>#your For SNMP v3:
snmpwalk -v3 -u nagios -l authPriv -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy <Your-IP-Address>Expected Output (Example)
iso.3.6.1.2.1.1.1.0 = STRING: "Linux myserver 5.15.0-72-generic"
iso.3.6.1.2.1.1.3.0 = Timeticks: (100032) 0:16:40.32Troubleshooting Steps
If SNMP does not return data:
1. Verify SNMP service is running:
sudo systemctl status snmpd2. Check listening ports:
sudo systemctl status snmpd3. Ensure firewall allows traffic:
sudo ufw status4. Check SNMP logs for errors:
sudo journalctl -u snmpd --no-pager | tail -205. Test local SNMP response:
snmpwalk -v2c -c public-O e 127.0.0.1Step 6: Add Ubuntu Host to Nagios XI Using SNMP Wizard
1. In Nagios XI, navigate to Configure > Run a Configuring Wizard.
2. Search for and select the Linux SNMP Wizard.
3. Enter the Ubuntu machine’s IP address and SNMP credentials.

4. Click Next, select the system metrics to monitor (CPU, memory, disk, network traffic, etc.).
5. Apply the configuration and verify that Nagios XI is collecting SNMP data.

Common Issues & Fixes
- Host appears “Down” in Nagios XI:
- Check SNMP configuration and firewall rules.
- Incorrect SNMP credentials error:
- Verify the community string (SNMP v2c) or authentication details (SNMP v3).
- No data returned in
snmpwalk:- Ensure
snmpdis running and listening on port 161.
- Ensure
Conclusion
You have successfully installed and configured SNMP on Ubuntu for monitoring with Nagios XI. If you encounter issues, check the firewall settings and ensure the correct SNMP configurations are applied.
For further support, visit the Nagios Support Forum or the Nagios Docs.



