28

Ubuntu Version: Ubuntu 14.04.1 LTS

SNMP Version: 5.7.2

Short Issue: A lot of the entries in the "default" configuration file are broken. Which doesn't really matter because I can't even get SNMP started.

Desired Outcome: I want a working SNMP instance, one with as many of the defaults functional in it as possible.

NOTE: From a great many sources, including Canonical owned Ubuntu websites, it is said that I have to modify export and SNMPDOPTS, in order to have basic functionality.

/etc/default/snmpd

export MIBS=UCD-SNMP-MIB
SNMPDRUN=yes
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
TRAPDRUN=no
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
SNMPDCOMPAT=yes

/etc/snmp/snmpd.conf

view   systemonly  included   .1.3.6.1.2.1.1
view   systemonly  included   .1.3.6.1.2.1.25.1
rocommunity public
rwcommunity nanana
sysLocation    vm1-ryd-wlo
sysContact     Paul Adams <[email protected]>
sysServices    72
disk       /     10000
disk       /var  5%
load   12 10 5
trapsink     localhost public
iquerySecName   internalUser
rouser          internalUser
master          agentx

/var/log/syslog

Oct  3 13:59:51 mdnsreflector-ryd-wlo snmpd[9120]: Server Exiting with code 1
Oct  3 14:00:09 mdnsreflector-ryd-wlo snmpd[9143]: Turning on AgentX master support.
Oct  3 14:00:09 mdnsreflector-ryd-wlo snmpd[9145]: NET-SNMP version 5.7.2

sudo service --status-all

[ + ]  snmpd

sudo service ufw status

Status: inactive
  1. Even though this configuration loads and is apparently running. You can't actually query anything from this SNMP instance from a remote device. The connection ultimately times out.

  2. Querying it from the server itself yields nothing.

snmpwalk -Os -c public -v 1 localhost system

system: Unknown Object Identifier (Sub-id not found: (top) -> system)
  1. I had to remove the "agentAddress" entries because the software kept panicking every time it attempted to process that command. (Even though that is the default and the way it supposed to be listed in the configuration.)

/etc/var/syslog

Oct  3 14:10:32 mdnsreflector-ryd-wlo snmpd[9292]: Turning on AgentX master support.
Oct  3 14:10:32 mdnsreflector-ryd-wlo snmpd[9292]: Turning on AgentX master support.
Oct  3 14:10:32 mdnsreflector-ryd-wlo snmpd[9292]: Error opening specified endpoint "udp:161"
Oct  3 14:10:32 mdnsreflector-ryd-wlo snmpd[9292]: Server Exiting with code 1

sudo service --status-all

[ - ]  snmpd
  1. I had to remove several of the default entries in the config because they also caused errors upon running them.

/etc/snmp/snmpd.conf

proc mount
proc ntalkd    4
proc sendmail    10 1
includeAllDisks 10%
extend    test1   /bin/echo  Hello, world!
extend-sh test2   echo Hello, world! ; echo Hi there ; exit 35

/var/log/syslog

Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 90: Error: Already have an entry for this process.
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 92: Error: Already have an entry for this process.
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 94: Error: Already have an entry for this process.
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 106: Error: includeAllDisks already specified.
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 106: Error: #011ignoring: includeAllDisks 10%
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: message repeated 6 times: [ /etc/snmp/snmpd.conf: line 146: Error: duplicate trigger name]
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 148: Error: duplicate trigger name
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: /etc/snmp/snmpd.conf: line 148: Error: duplicate trigger name
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: duplicate table data attempted to be entered. row exists
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: Failed to register extend entry 'test1' - possibly duplicate name.
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: duplicate table data attempted to be entered. row exists
Oct  3 10:51:11 mdnsreflector-ryd-wlo snmpd[7575]: Failed to register extend entry 'test2' - possibly duplicate name.
1

2 Answers 2

2

SNMP is not broken. The process to get it working is just a bit convoluted.

The following steps have been verified to work on 14.04:

After installing SNMP and its daemon(sudo apt-get install snmp snmpd), you will need to edit the file /etc/snmp/snmp.conf and comment out the line containing "mibs:"

Within this file, change the line:

mibs :

to

#mibs : 

Next, assuming you haven't done this already, you will need to obtain the full set of IETF MIBs. These files do not ship, by default, on Debian/Ubuntu systems due to licensing issues.

From the terminal(Ctrl-Alt-t), enter the following commands:

sudo apt-get install snmp-mibs-downloader

sudo download-mibs

Then, you will need to modify /etc/snmp/snmpd.conf.

  1. To allow SNMP the system to receive queries on interfaces other than its loopback address. The lines for this should look like this:

    #  Listen for connections from the local system only
    #  agentAddress  udp:127.0.0.1:161
    #  Listen for connections on all interfaces (both IPv4 *and* IPv6)
    agentAddress udp:161,udp6:[::1]:161
    

    Note that this will allow ANY system to query your machine. You will need to adjust this to limit SNMP access to your device.

  2. You will now want to change your Read-only SNMP string from public to a custom string of your choosing, as below:

    #rocommunity public  default    -V systemonly
    rocommunity <My$ecret$tr1nG> (don't use this example!)
    

    Note: Removing -V systemonly from the line will allow access to the entire MIB tree and not restrict it to the system part of the tree.

  3. Restart the SNMP daemon

    sudo service snmpd restart
    

Finally, your SNMP query should now respond properly.

e.g.:

snmpwalk -v 2c -c <My$ecret$tr1nG> <MachineName> ipadd

IP-MIB::ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1
IP-MIB::ipAdEntAddr.192.168.1.7 = IpAddress: 192.168.1.7
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.192.168.1.7 = INTEGER: 2
IP-MIB::ipAdEntNetMask.127.0.0.1 = IpAddress: 255.0.0.0
IP-MIB::ipAdEntNetMask.192.168.1.7 = IpAddress: 255.255.255.0
IP-MIB::ipAdEntBcastAddr.127.0.0.1 = INTEGER: 0
IP-MIB::ipAdEntBcastAddr.192.168.1.7 = INTEGER: 1

See the following answers for additional reference:

How to get or configure IP-MIB in Ubuntu 12.04?

What is SNMP?

0

I would start with a stock config with a view to .1, enable debug logging, and try get queries to OIDs. I honestly never got the hang of MIBs, and since I only used SNMP for stuff like MRTG and cacti, I never really needed to know more. See if you can get the simplest config possible working, then add one element at a time while tailing the pertinent log file(s).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .