Configuring SNMP on Ubuntu 14.04 LTS for Effective Nagios XI Monitoring

Picture of Ayub Huruse
Ayub Huruse
Ubuntu 14 SNMP

Effective network monitoring is crucial for ensuring system performance and minimizing downtime. Simple Network Management Protocol (SNMP) provides a powerful solution for monitoring network devices and Linux servers with Nagios XI, eliminating the need for additional monitoring agents.

This guide will walk you through the step-by-step installation and configuration of SNMP on Ubuntu 14.04 LTS, enabling seamless integration with Nagios XI. We’ll cover both SNMP v2c (widely used but less secure) and SNMP v3 (which includes authentication and encryption for enhanced security), ensuring you have the right setup for your monitoring needs.

Important Note: Ubuntu 14.04 LTS reached end-of-life in April 2019 (standard support) and April 2022 (Extended Security Maintenance). For production environments, consider upgrading to a supported version like Ubuntu 22.04 LTS or 24.04 LTS. This guide is provided for legacy systems or educational purposes.

Prerequisites

Before proceeding, ensure the following:

  • You have administrative or sudo privileges on the Ubuntu machine.
  • You are using Ubuntu 14.04 LTS.
  • Nagios XI is installed and accessible, with the SNMP Wizard enabled.

Step 1: Install SNMP Packages

To install SNMP and the necessary libraries, log in to your Ubuntu machine and execute the following commands:

sudo apt-get update
sudo apt-get install snmpd libsnmp-dev -y

This updates your package list and installs:

  • libsnmp-dev (SNMP development libraries for querying SNMP devices)
  • snmpd (the SNMP daemon for handling SNMP requests)

Step 2: Configure SNMP

SNMP v2c Configuration

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

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

Now, edit the SNMP configuration file:

sudo nano /etc/snmp/snmpd.conf

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

Save the file and restart the SNMP service:

sudo service snmpd restart

SNMP v3 Configuration (Optional, More Secure)

To configure SNMP v3, create an SNMP user with authentication and encryption:

sudo net-snmp-config --create-snmpv3-user -ro -a SHA -A Str0ng@uth3ntic@ti0n -x AES -X Str0ngPriv@cy nagios
  • -a SHA → Specifies SHA for authentication (use MD5 if needed, but it’s less secure)
  • -x AES → Enables AES encryption (alternatively, use DES for lower security)

Restart the SNMP service:

sudo service snmpd restart

Step 3: Configure Firewall Rules

If ufw (Uncomplicated Firewall) is enabled, allow SNMP traffic:

sudo ufw allow snmp
sudo ufw reload

For better security, allow SNMP traffic only from the Nagios XI server:

sudo ufw allow from 10.25.5.0/24 to any port 161 proto udp
sudo ufw reload

Step 4: Enable SNMP Service on Boot

To ensure SNMP starts automatically on system boot, run:

sudo update-rc.d snmpd defaults

Step 5: Test SNMP Communication

On your Nagios XI server, test SNMP connectivity using the following commands.

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 3.13.0-32-generic"
iso.3.6.1.2.1.1.3.0 = Timeticks: (100032) 0:16:40.32

Troubleshooting Steps

If SNMP does not return data:

1. Verify SNMP Service is Running:

sudo service snmpd status

2. Check Listening Ports:

netstat -tulnp | grep snmp

3. Ensure Firewall Allows Traffic:

sudo ufw status

4. Check SNMP Logs for Errors:

sudo tail -20 /var/log/syslog

5. Test Local SNMP Response:

snmpwalk -v2c -c Str0ngC0mmunity -O e 127.0.0.1

    Step 6: Add Ubuntu Host to Nagios XI

    1. In Nagios XI, go to Configure > Run a configuring wizard.

    2. Select the Linux SNMP Wizard.

    Screenshot 2025 03 14 074544
    Linux SNMP

    3. Enter the Ubuntu machine’s IP (e.g., 10.25.5.12) and SNMP credentials (v2c community string or v3 details).

    Screenshot 2025 03 14 074634
    SNMP Config step 1

    4. Click Next, choose metrics to monitor (e.g., CPU, memory, disk), and apply the configuration.

    5. Verify data collection in Nagios XI’s dashboard

    Screenshot 2025 02 11 153207 1
    Host Status

      Common Issues & Fixes

      • Host appears “Down” in Nagios XI:
        • Check SNMP configuration and firewall rules.
      • Incorrect SNMP credentials error:
        • Verify the community string (SNMP v2c) or authentication details (SNMP v3).
      • No data returned in snmpwalk:
        • Ensure snmpd is running and listening on port 161.

      Conclusion

      You’ve now configured SNMP on Ubuntu 14.04 for monitoring with Nagios XI. For optimal security and support, consider migrating to a current Ubuntu LTS release. To customize monitoring further, explore Nagios XI’s advanced options or visit the Nagios Support Forum or the Nagios Knowledgebase.

      Share: