WUG.ninja

Search

How do I configure SNMP on Linux or Unix?

SNMP v1/v2c

On Linux or Unix, you will need configure snmpd.conf. The operating system itself may or may not have snmpd installed by default. If you don’t see the /etc/snmp/snmpd.conf file, you will need to install net-snmp first.

For Debian:

sudo apt update
sudo apt install snmpd

For Redhat:

yum install net-snmp

Once you are sure it is installed, you can proceed to use the basic configuration sample below. Refer to the documentation here for all the potential configuration options: SNMP_CONFIG and here: SNMPD.CONF.

Once you update your /etc/snmp/snmpd.conf file properly, restart snmpd. Note that you will want to replace “wugninja” with your own community string and “192.168.1.0/24” with your own allowed network(s), use this configuration for SNMP v1 and v2:

syslocation Office123
syscontact [email protected]
rocommunity wugninja

## sec.name source community
## ======== ====== =========
com2sec local localhost wugninja
com2sec network_1 192.168.1.0/24 wugninja

## Access.group.name sec.model sec.name
## ================= ========= ========
group MyROGroup_1 v1 local
group MyROGroup_1 v2c network_1

## MIB.view.name incl/excl MIB.subtree mask
## ============== ========= =========== ====
view all-mibs included .1 80

## MIB
## group.name context sec.model sec.level prefix read write notif
## ========== ======= ========= ========= ====== ==== ===== =====
access MyROGroup_1 "" v1 noauth exact all-mibs none none
access MyROGroup_1 "" v2c noauth exact all-mibs none none

##This setting disables the log messages for accepted connections
##Denied connections will still be logged
dontLogTCPWrappersConnects yes

##This setting forces network disks to show as 'fixed disks'
##as required by WUG disk utilization monitor
storageUseNFS 2

SNMP v3

But what if you want to use SNMP v3 instead? The configuration is a bit simpler. Not only that, but SNMP v3 also uses authentication and encryption so it is much more secure when compared to v1/v2. The first step is creating the SNMP v3 user account:

  • Stop snmpd (different commands depending on your *nix flavor)
    • service snmpd stop
    • systemctl stop snmpd
  • Run the command
    • net-snmp-create-v3-user
  • Follow the steps from the command to create a user
  • Once done, start your snmpd service
    • service snmpd start
    • systemctl start snmpd

Then your final snmpd.conf should look something like this, replacing ‘snmpadmin’ with your created username:

rwuser snmpadmin
syslocation Office123
syscontact [email protected]
##This setting disables the log messages for accepted connections
##Denied connections will still be logged
dontLogTCPWrappersConnects yes
##This setting forces network disks to show as 'fixed disks'
##as required by WUG disk utilization monitor
storageUseNFS 2

Share This Post

More To Explore

WhatsUp Gold

WhatsUp Gold Tip #3: Monitor your systems

Focus on what is important It’s nice to have detailed monitoring information for every system on your network, but if a non-critical system is unavailable

Blog Posts

WhatsUp Gold Tip #2: Discover your systems

Introduction When you finish adding your credentials to WhatsUp Gold, the next step to success is configuring the discovery process in WhatsUp Gold to work for you.

credentials
Blog Posts

WhatsUp Gold Tip #1: Add your credentials first

Introduction Following installation, the first step to success is adding credentials for your infrastructure. WhatsUp Gold Network Monitoring and Log Management is an agentless solution