Installing SNMP on CentOS 10 and Monitoring with Nagios XI

Picture of Tucker Falen
Tucker Falen
Monitoring CentOS

Simple Network Management Protocol (SNMP) is essential for monitoring and managing network devices. This guide outlines the steps to install and configure SNMP on CentOS Stream 10 and integrating with Nagios XI, allowing remote monitoring.

Prerequisites

Before proceeding, ensure you have:

  • A CentOS Stream 10 system with root or sudo access
  • An active internet connection to download packages
  • A Nagios XI Server

Step 1: Install SNMP

The first step is to install the SNMP packages on your CentOS system. The SNMP software includes net-snmp and net-snmp-utils.

sudo dnf install -y net-snmp net-snmp-utils

This command installs the SNMP service and utilities required to manage and interact with SNMP on your system.

Step 2: Enable + Start SNMP

After installation, enable the SNMP service to ensure it starts on boot:

sudo systemctl enable snmpd
sudo systemctl start snmpd

This ensures that the SNMP service will automatically start when your system boots, keeping it available for monitoring.

Step 3: Check SNMP Status

Verify that the SNMP service is running correctly:

sudo systemctl status snmpd

This command checks the current status of the SNMP service to ensure it is active and running without errors.

Step 4: Configure SNMP

To modify SNMP settings, edit the configuration file:

sudo nano /etc/snmp/snmpd.conf

Find and modify the community string under the com2sec section:

com2sec readonly default YourCommunityString

Replace YourCommunityString with a secure string for authentication. Save the file and restart SNMP:

sudo systemctl restart snmpd

Step 5: Test Connection from Localhost

To ensure SNMP is working correctly, test it locally using the snmpwalk command:

snmpwalk -v2c -c YourCommunityString localhost

This command queries the SNMP service on your local machine. The -v2c option specifies the SNMP version, and -c YourCommunityString is the community string used for authentication.

Step 6: Open Firewall for SNMP

If you want to allow SNMP traffic from remote machines, open the firewall to allow SNMP traffic:

sudo firewall-cmd --permanent --add-port=161/udp
sudo firewall-cmd --reload

This command opens port 161 (the default SNMP port) for UDP traffic, allowing SNMP queries from remote systems.

Step 7: Test SNMP from a Remote System

Finally, to ensure SNMP is accessible remotely, test it from another system using snmpwalk:

snmpwalk -v2c -c YourCommunityString <server-ip>

Replace <server-ip> with the IP address of your CentOS server. If SNMP is correctly configured, you will receive SNMP data from the remote server.

Monitoring with Nagios XI

On Nagios XI navigate to Run a Wizard and click on the SNMP wizard

Screenshot 2025 02 12 135716
Installing SNMP on CentOS 10 and Monitoring with Nagios XI 3

Add your Host Name and type in the SNMP Community string that you created.

Screenshot 2025 03 12 115626
Installing SNMP on CentOS 10 and Monitoring with Nagios XI 4

Pick the SNMP Services that you want to monitor and then click Next and Finish with Defaults.

Conclusion

You have successfully installed and configured SNMP on CentOS Stream 10. This setup allows your server to be monitored remotely, enhancing network management capabilities. You also configured SNMP monitoring with Nagios XI, which provides a powerful interface for tracking system performance and network activity. By adding your SNMP-enabled server to Nagios XI, you can gain deeper insights into system health, set up alerts, and optimize network monitoring for better performance.

Share: