Help Admin Adding a monitor Configuring SNMP Agents on Linux Servers

Configuring SNMP Agents on different Linux Servers

Monitor your Linux servers agentless, with the support of SNMP. Simply install and configure SNMP agents on your servers, install an On-Premise Poller, and your server for monitoring. 

Linux flavours

Ubuntu

Installation

Execute the command:

> apt update
> apt install snmpd

Configuration

Edit the file: /etc/snmp/snmpd.conf 

    1. Set the SNMP v1 Read-Only Community String as 'public' by adding the line: 
      rocommunity public
    2. #agentAddress udp is the IP address from which SNMP requests will be accepted by the server. Hence, comment the line:
      #agentAddress udp:127.0.0.1:161
    3. For the same reason mentioned above, uncomment the line: 
      agentAddress udp:161,udp6:[::1]:161
    4. Restart the SNMP Service:
      service snmpd restart

Allowing SNMP ports in firewall

Execute the following commands to allow necessary ports:

ufw allow 161/udp
ufw allow 162/udp


CentOS

Installation

Execute the commands:

> yum update
> yum install net-snmp

Configuration

Edit the file: /etc/snmp/snmpd.conf 

    1. Set the SNMP v1 Read-Only Community String as 'public' by adding the line: 
      rocommunity public
    2. Replace the line below:
      view systemview included .1.3.6.1.2.1.25.1.1
      with the following line:
      view systemview included .1.3.
    3. Restart the SNMP Service:
      service snmpd restart

Allowing SNMP ports in Firewall

Execute the commands:

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


Oracle Solaris

Execute the command:

svcadm enable net-snmp


FreeBSD

1. Fetching Ports Collection

The FreeBSD operating system offers Ports Collection as a simple way to install SNMP applications.

Execute the commands:

portsnap fetch
portsnap extract

2. Installing net-snmp

cd /usr/ports/net-mgmt/net-snmp
make install clean

Click OK on the next screen and wait for the installation to complete.

3. Configuration file

    1. Copy the following configuration file:
      cp /usr/local/share/snmp/snmpd.conf.example /usr/local/etc/snmpd.conf
    2. Set the SNMP v1 Read-Only Community String as 'public' by adding the line: 
      rocommunity public
    3. #agentAddress udp is the IP address from which SNMP requests will be accepted by the server. Hence, comment the line:
      #agentAddress udp:127.0.0.1:161
    4. For the same reason mentioned above, uncomment the line:
      agentAddress udp:161,udp6:[::1]:161

4. Firewall configuration

Edit the /etc/rc.conf file and add the following lines:

snmpd_enable="YES"
snmpd_conffile="/usr/local/etc/snmpd.conf"

5. Starting the SNMP Service

service snmpd start


RHEL

Installation

    1. Execute the command:
      yum install -y net-snmp
    2. Set the SNMP v1 Read-Only Community String as 'public' by adding the line below to the configuration file (/etc/snmp/snmpd.conf):
      rocommunity public
    3. #agentAddress udp is the IP address from which SNMP requests will be accepted by the server. Hence, comment the line:
      agentAddress udp:161,udp6:[::1]:161
    4. Start the snmpd service:
      systemctl enable snmpd && systemctl start snmpd

Allowing SNMP ports in firewall

Execute the following commands:

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


Debian

Installation

Execute the commands:

> apt update
> apt install snmpd

Configuration

Edit the file: /etc/snmp/snmpd.conf 

    1. Set the SNMP v1 Read-Only Community String as 'public' by adding the line: 
      rocommunity public
    2. #agentAddress udp is the IP address from which SNMP requests will be accepted by the server. Hence, comment the line:
      #agentAddress udp:127.0.0.1:161
    3. For the same reason mentioned above, uncomment the line: 
      agentAddress udp:161,udp6:[::1]:161
    4. Restart the snmpd service:
      /etc/init.d/snmpd restart

Fedora

Installation

    1. Execute the following command:
      > yum install net-snmp
    2. Set the SNMP v1 Read-Only Community String as 'public' by adding the line below to the configuration file (/etc/snmp/snmpd.conf):
      rocommunity public
    3. Restart the snmpd service:
      /bin/systemctl restart snmpd.service

Firewall Configuration

Excecute the following commands to allow the necessary ports:

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

Replace the word "public" with the active zone name.

macOS

Configuration

    1. Edit the SNMP configuration file (/etc/snmp/snmpd.conf) and set the SNMP v1 Read-Only Community String as 'public' by adding the line:
      rocommunity public
    2. Start the snmp service:
      sudo launchctl load -w /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist

Testing SNMP on Linux 

Test the SNMP reachability using MIB browser

Related articles

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help Admin Adding a monitor Configuring SNMP Agents on Linux Servers