Effective Linux Server Monitoring with SNMP and Nagios XI on RHEL 9

Picture of Tucker Falen
Tucker Falen
red-hat-render

Effective Linux server monitoring is critical for maintaining optimal performance and minimizing downtime. Simple Network Management Protocol (SNMP) provides an agentless approach to monitoring Linux servers, enabling seamless integration with Nagios XI to deliver real-time system insights and proactive issue detection.

This guide will walk you through the process of installing and configuring SNMP on RHEL 9, allowing you to integrate it easily with Nagios XI for efficient server monitoring.

Prerequisites

Before you begin, ensure the following:

  • A RHEL 9 system with root or sudo privileges.
  • Nagios XI installed and accessible, with the SNMP Wizard enabled.
  • A stable internet connection for downloading packages.

Step 1: Install SNMP on RHEL 9

To install SNMP and the required libraries, run the following command:

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

After installation, verify that SNMP has been successfully installed:

snmpd -v 

Step 2: Configure SNMP Access

SNMP v2c Configuration

1. To configure SNMP v2c, create a backup of the existing configuration:

sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak

2. Now, edit the SNMP configuration file:

sudo nano /etc/snmp/snmpd.conf

3. Find and modify the following line to define the community string and allow access from your Nagios XI server (replace Str0ngC0mmunity with your desired community string and 10.25.5.12 with your Nagios XI server’s IP address):

rocommunity Str0ngC0mmunity 10.25.5.12

4. Save the file and restart the SNMP service:

sudo systemctl restart snmpd.service

SNMP v3 Configuration (More Secure)

1. Stop the SNMP service temporarily:

sudo systemctl stop snmpd.service

2. 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 (MD5 is also supported but less secure).
  • -x AES → Enables AES encryption (DES is another option but less secure).

3. Restart the SNMP service:

sudo systemctl restart snmpd.service

Step 3: Configure Firewall Rules

1. If firewalld is active (check with sudo systemctl status firewalld), allow SNMP traffic on UDP port 161:

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

2. Confirm firewall rules:

sudo firewall-cmd --list-ports

Step 4: Enable SNMP Service on Boot

To ensure SNMP starts automatically at boot, run:

sudo systemctl enable snmpd.service

Step 5: Test SNMP Communication

To test if SNMP is responding correctly, run the following commands from your Nagios XI server.

For SNMP v2c:

snmpwalk -v2c -c Str0ngC0mmunity 10.25.5.12

For SNMP v3:

snmpwalk -v3 -u nagios -l authPriv -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy 10.25.5.12

Expected Output (Example)

iso.3.6.1.2.1.1.1.0 = STRING: "Linux myserver 4.18.0-305.19.1.el8.x86_64"
iso.3.6.1.2.1.1.3.0 = Timeticks: (100032) 0:16:40.32

If the command does not return data, review SNMP configuration and firewall settings.

Step 6: Add RHEL 8 Host to Nagios XI Using SNMP Wizard

Log in to Nagios XI.

Navigate to Configure > Run a Configuration Wizard.

Search for and select the Linux SNMP Wizard.

Screenshot 2025 03 14 074544 1
Linux SNMP

Enter the IP address of your RHEL 9 server and the SNMP credentials.

Click Next, then choose the system metrics you wish to monitor (CPU, memory, disk usage, network traffic, etc.).

Apply the configuration, and verify that Nagios XI is collecting SNMP data.

Common Issues & Fixes

SNMP Service is Not Running

Check logs for errors:

sudo journalctl -u snmpd --no-pager | tail -20

Restart SNMP if necessary:

sudo systemctl restart snmpd.service

Host Appears “Down” in Nagios XI

  • Check firewall rules:
sudo firewall-cmd --list-ports
  • Ensure SNMP is running:
sudo systemctl status snmpd
  • Verify Nagios XI configuration

Incorrect SNMP Credentials Error

Confirm that the correct community string (for SNMP v2c) or authentication details (for SNMP v3) are used.

Restart the SNMP service after making changes:

sudo systemctl restart snmpd.service

Conclusion

You’ve successfully configured SNMP on RHEL 9 for agentless monitoring with Nagios XI, providing real-time insights into system performance. For advanced setups, explore custom SNMP OIDs or additional Nagios XI plugins. For support, visit the Nagios Support Forum or the Nagios Knowledgebase.

Share: