How to Monitor CentOS 7 with SNMP in Nagios XI

SNMP (Simple Network Management Protocol) is a powerful tool for monitoring network devices and servers. This guide will walk you through installing and configuring SNMP on CentOS 7.
Step 1: Install SNMP and Utilities
CentOS 7 uses yum
as the default package manager. Install SNMP packages with:
sudo yum 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 snmpd
sudo systemctl start 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 <server-ip>
Replace <server-ip>
with the IP address of your CentOS 7 server. If SNMP is correctly configured, you will receive SNMP data from the remote server.
Monitoring with Nagios XI
In 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
andFinish with Defaults
.

Conclusion
You have successfully installed and configured SNMP on CentOS 7. 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
- Top 4 Reasons Why You Should Migrate to Nagios Log Server R2
- Installing Nagios Cross Platform Agent (NCPA) on CentOS 7 and Monitoring with Nagios XI
- Monitoring Oracle Linux 8 with SNMP in Nagios XI: A Step-by-Step Guide
- Step-by-Step Guide: Monitoring Oracle Linux 8 with NCPA in Nagios XI
- How to Install Nagios Cross-Platform Agent (NCPA) on Apple Silicon macOS