Monitoring Rocky Linux 9 with SNMP in Nagios XI: A Step-by-Step Guide

Picture of Ayub Huruse
Ayub Huruse
Rocky Linux 9

Monitoring Rocky Linux 9 with Simple Network Management Protocol (SNMP) in Nagios XI offers a streamlined, agentless approach to tracking system performance and availability. By leveraging SNMP, Nagios XI can efficiently collect key metrics—such as CPU usage, memory utilization, disk space, and network activity—without requiring additional software installations.

This guide provides a step-by-step walkthrough on configuring SNMP on Rocky Linux 9, a reliable RHEL-compatible distribution, and seamlessly integrating it with Nagios XI for real-time monitoring.

Prerequisites

Before you begin, make sure you have:

  • A Rocky Linux 9 system with root or sudo privileges
  • A working Nagios XI server with SNMP Wizard enabled
  • Network connectivity between the server and Nagios XI
  • Port 161/UDP open in the Rocky Linux firewall

Step 1: Install SNMP and Utilities

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

Verify installation:

snmpd -v

Step 2: Configure SNMP Access

SNMP v2c Configuration

  1. Backup the default config:
sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
  1. Configure access for Nagios XI:
echo "rocommunity Str0ngC0mmunity <Nagios-XI-IP>" | sudo tee /etc/snmp/snmpd.conf
  1. Restart SNMP:
sudo systemctl restart snmpd.service

SNMP v3 Configuration (More Secure)

  1. Stop SNMP service:
sudo systemctl stop snmpd.service
  1. Clear old config and create user:
sudo sh -c "echo '' > /etc/snmp/snmpd.conf"
sudo net-snmp-create-v3-user -ro -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy nagios
  1. Start SNMP:
sudo systemctl start snmpd.service

Step 3: Configure the Firewall

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

Check allowed ports:

sudo firewall-cmd --list-ports

Step 4: Enable SNMP on Boot

sudo systemctl enable snmpd.service

Step 5: Test SNMP Communication

Run from the Nagios XI server:

For SNMP v2c:

snmpwalk -v2c -c Str0ngC0mmunity <rocky-linux-ip>

For SNMP v3:

snmpwalk -v -u nagios -l authPriv -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy <rocky-linux-ip><br>

Check for responses like:

iso.3.6.1.2.1.1.1.0 = STRING: "Linux rocky9"

Step 6: Add Rocky Linux 9 to Nagios XI Using the SNMP Wizard

Integrate the Rocky Linux system into Nagios XI:

1. Log into Nagios XI:

  • Access the web interface.

2. Run the SNMP Wizard:

  • Navigate to Configure > Configuration Wizards.
  • Select Linux SNMP.
Linux SNMP 9
Linux SNMP

3. Configure the Host:

  • Hostname/IP: Enter the Rocky Linux 9 IP (e.g., 192.168.0.31).
  • SNMP Version: Choose v2c or v3.
  • For v2c:
    • Community String: Str0ngC0mmunity.
  • For v3:
    • Username: nagios.
    • Auth Protocol: SHA.
    • Auth Password: Str0ng@uth3ntic@ti0n.
    • Privacy Protocol: AES.
    • Privacy Password: Str0ngPriv@cy.
  • Click Next.
Linux SNMP step 1 9
Rocky Linux credentials

4. Select Metrics:

  • Choose CPU, Memory, Disk, Processes, etc.
  • Set thresholds (e.g., Disk warning at 80%, critical at 90%).

5. Apply Configuration:

  • Click Finish and apply changes.

6. Verify Monitoring:

  • Go to Monitoring > Hosts, find your Rocky Linux host, and check service statuses.

    Troubleshooting Tips

    SNMP Service Not Running

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

    Restart service if needed:

    sudo systemctl restart snmpd

    Host Appears Down in Nagios XI

    • Ensure SNMP is running
    • Verify firewall allows UDP 161
    • Double-check SNMP credentials

    Conclusion

    You’ve now configured Rocky Linux 9 to communicate with Nagios XI via SNMP. Whether using v2c or the more secure v3, SNMP provides essential monitoring capabilities for your Linux infrastructure without the need for additional agents.

    For support:

    Share: