Share this post
Louie Mattia
Table of Contents
How to Monitor Ubuntu 22 using SNMP
|
Louie Mattia
![](https://library.nagios.com/wp-content/uploads/2025/02/snmp_shutterstock_2091229405.jpg)
Simple Network Management Protocol (SNMP) is a widely used protocol designed to manage and monitor network devices such as routers, switches, servers, and printers. It allows administrators to gather information on network performance, troubleshoot issues, and configure devices remotely. By setting up SNMP on Ubuntu 22, you can enable comprehensive monitoring through Nagios XI, making it easier to track system health and performance.
Prerequisites
- A working instance of Nagios XI
- A internet connection
Step 1: Install SNMP Daemon onto Ubuntu 22
To start, we need to install the SNMP Daemon (snmpd
) on Ubuntu. The SNMP Daemon is responsible for allowing SNMP-enabled tools, like Nagios XI, to collect and manage data from the system. First, update your package lists with the following command:
sudo apt update
This command updates the local package database to ensure we have the latest information about available software packages. After the update is complete, install snmpd
by running the following command:
sudo apt install snmpd
For testing purposes, we’ll also install the snmp
package. This is primarily needed for running the snmpwalk
command, which helps us verify the configuration locally. To install it, enter the following command:
sudo apt install snmp
Step 2: Configure SNMP
Now that it is installed we need to configure it, as it is now we will not be able to pull any information from the device. We need to edit the snmp.conf
file, to do this use the command:
sudo nano /etc/snmp/snmpd.conf
We are looking for a few sections in this, first thing we want to do is find the agentadress
section.
![How to Monitor Ubuntu 22 using SNMP 1 agentaddress line](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-110421.png)
You can change this to match the IP address of your instance of Nagios XI for greater security, but if you use what’s listed above, it will work, it will allow the wizard we are using to recognize and access it through SNMP. Now we do want snmpwalk
to access this, we need to change the view section now.
![How to Monitor Ubuntu 22 using SNMP 2 Screenshot 2025 02 11 153611](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-153611.png)
These SNMP view definitions specify which parts of the MIB tree are accessible to users. The first line grants access to standard system-related information (under .1.3.6.1.2.1
), while the second allows access to enterprise-specific objects (under .1.3.6.1.4.1
), thereby controlling the visibility of SNMP data for monitoring and management purposes. Next, the rocommunity
line defines the read-only community string for SNMP access, which acts as a password for SNMP clients to retrieve data from the SNMP daemon. In this example, we will be using the default community string “public” for simplicity, though for enhanced security, it’s recommended to replace it with a more secure word or phrase of your choice.
![How to Monitor Ubuntu 22 using SNMP 3 rocommunity string in snmpd.conf](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-145547.png)
Step 3: Restart the service
The next step is to restart the SNMP service so that the changes take effect. To do this, simply run the following command:
sudo service snmpd restart
This will restart the SNMP service, and you shouldn’t receive any output if everything is configured correctly. If you do get output, it likely indicates an error in the snmpd.conf
file—most often a typo in one of the lines. Please review the file and check for any mistakes. Once that’s sorted, we’ll want to verify that our configurations are working. To do this, we can use the snmpwalk
command locally. Alternatively, if you have access to the Nagios XI Linux host, you can perform the test from there as well. The command to use is:
snmpwalk -v 2c -c <rocommunity> localhost/<ip address>
You should receive a very long output, whether you’re testing locally or through the Nagios XI Linux host. If this happens, it confirms that SNMP is set up correctly. It’s even better if you’re able to get it working through the Nagios XI Linux host, as this will verify that the system is correctly receiving and processing SNMP data for monitoring.
Step 4: Set up on Nagios XI
With everything set up, we can now configure monitoring through Nagios XI using the Linux SNMP Wizard. You’ll need to enter the IP address of your Ubuntu device along with the rocommunity
string. The SNMP daemon supports multiple versions of SNMP, so the default settings for both the SNMP version and port should work perfectly.
![How to Monitor Ubuntu 22 using SNMP 4 Screenshot 2025 02 11 151739](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-151739.png)
After configuring the settings, you can choose the hostname and select any services you want to monitor through SNMP. Once these steps are completed, your host will be set up for monitoring. By clicking on the hostname, you’ll see that it is being actively monitored and collecting data for the selected services.
![How to Monitor Ubuntu 22 using SNMP 5 Screenshot 2025 02 11 111531](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-111531-1024x474.png)
![How to Monitor Ubuntu 22 using SNMP 6 Screenshot 2025 02 11 153207](https://library.nagios.com/wp-content/uploads/2025/02/Screenshot-2025-02-11-153207-1024x338.png)
Conclusion
With these steps, we’ve successfully set up Ubuntu 22 to be monitored using SNMP with Nagios XI. If you encounter any issues, please refer to the Nagios Support Forum for assistance. Alternatively, if you prefer to monitor using the Nagios Cross-Platform Agent, you can find more information here.