Configuring SNMP for Rocky Linux 8 Monitoring in Nagios XI: A Complete Guide

Picture of Ayub Huruse
Ayub Huruse
Rocky Linux 8

Enhance your Rocky Linux 8 monitoring by leveraging SNMP with Nagios XI for real-time performance tracking without additional agents. This guide walks you through configuring SNMP v2c and v3, ensuring secure and efficient system monitoring.

Prerequisites

Ensure the following before starting:

  • Rocky Linux 8 with root or sudo access
  • Nagios XI installed and accessible with SNMP wizard enabled
  • Port 161/UDP open on the server’s firewall

Step 1: Install SNMP

Install the SNMP packages:

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

Verify SNMP version:

snmpd -v

Step 2: Configure SNMP Access

SNMP v2c Configuration

  1. Backup and create a new config file:
sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.bak
sudo sh -c "echo 'rocommunity Str0ngC0mmunity 10.25.5.12' > /etc/snmp/snmpd.conf"
  1. Restart SNMP:
sudo systemctl restart snmpd.service

SNMP v3 Configuration

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

Step 3: Open SNMP Port in Firewall

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

Check port:

sudo firewall-cmd --list-ports

Step 4: Enable SNMP on Boot

sudo systemctl enable snmpd.service

Step 5: Test SNMP Communication

From Nagios XI server:

SNMP v2c Test:

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

SNMP v3 Test:

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

Example successful response:

iso.3.6.1.2.1.1.1.0 = STRING: "Linux rocky8"

Step 6: Add Rocky Linux 8 to Nagios XI with SNMP Wizard

1. Log into Nagios XI

2. Go to Configure > Run a configuring wizard

3. Choose Linux SNMP wizard

Linux SNMP 10
Linux SNMP

4. Enter IP address and SNMP credentials

Linux SNMP step 1 10
Rocky Linux Credentials

5. Select metrics (disk, CPU, processes, etc.)

6. Complete the wizard and apply configuration

Step 7: Customize Monitoring Items

  • Use check_snmp_storage.pl to test disk checks:
cd /usr/local/nagios/libexec
./check_snmp_storage.pl -H <ip> -C Str0ngC0mmunity -m "^/$" -w 80 -c 90
  • For SNMP v3:
./check_snmp_storage.pl -H <ip> -l nagios -x Str0ng@uth3ntic@ti0n -X Str0ngPriv@cy -L SHA,AES -m "^/$" -w 80 -c 90

Conclusion

You’ve successfully configured SNMP on Rocky Linux 8 for Nagios XI monitoring. Choose v2c for simplicity or v3 for enhanced security. Use Nagios XI’s SNMP wizard to streamline host and service creation.

Support Resources:

Share: