How to Monitor CentOS 8 with SNMP in Nagios XI

SNMP (Simple Network Management Protocol) isa powerful tool for monitoring network devices and servers. This guide will walk you through installing and configuring SNMP on CentOS 8.
Step 1: Install SNMP and Utilities
CentOS 8 uses dnf
as the default package manager. Install SNMP packages with:
sudo dnf install net-snmp net-snmp-utils -y
Step 2: Start and Enable the SNMP Service
Once installed, start and enable the SNMP service so that it runs at boot:
sudo systemctl enable --now snmpd
Step 3: Configure SNMP
The main configuration file for SNMP is located at:
/etc/snmp/snmpd.conf
Before making changes, back up the original file:
sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
Now, edit the configuration file:
sudo nano /etc/snmp/snmpd.conf
Modify or add the following lines to set up SNMPv2c with a community string (replace YourCommunity
with a strong name):
com2sec readonly default YourCommunity
group MyROGroup v2c readonly
view all included .1
access MyROGroup "" any noauth exact all none none
syslocation "Data Center"
syscontact "Admin <admin@example.com>"
Save and exit the file, then restart the SNMP service:
sudo systemctl restart snmpd
Step 4: Adjust Firewall Rules
To allow SNMP traffic, open the necessary UDP port (161):
sudo firewall-cmd --permanent --add-port=161/udp
sudo firewall-cmd --reload
Step 5: Verify SNMP Functionality
Test if SNMP is working correctly with:
snmpwalk -v2c -c YourCommunity -O e 127.0.0.1
If you see output with system information, SNMP is working correctly.
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
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

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

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 8. 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:
On this page
Related Articles
- Setting Up SNMP on Arch Linux 2023 for Seamless Monitoring with Nagios XI
- How to Monitor Arch Linux 2023 with NCPA in Nagios XI
- How to Set Up SNMP on Fedora 40 for Monitoring with Nagios XI
- Step-by-Step Guide to Monitoring Fedora 40 with NCPA in Nagios XI
- Monitoring RHEL 8 with SNMP in Nagios XI: A Step-by-Step Guide