Skip to content

SNMPD auf Ubuntu funktionsfähig bekommenGetting SNMPD to work on Ubuntu

Snmpd auf Ubuntu zu installieren scheint einfach zu sein, ist es auch, aber hat bei mir nie wirklich 100% funktioniert. Der snmpd funktionierte immer nur lokal, aber nicht für entfernte Zugriffe meines cacti Servers. Das Problem ist jenes, dass Ubuntu standartmässig den snmpd auf dem Loopback Interface startet, was Zugriffe von aussen verhindert.

Meine /etc/default/snmpd sieht nun so aus:

# This file controls the activity of snmpd and snmptrapd

# MIB directories.  /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

# snmptrapd control (yes means start daemon).  As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run.  See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes

Das war’s. Nun nur noch mit $ sudo /etc/init.d/snmpd restart den snmp Server neu starten und alles funktioniert so wie’s soll.

Setting up snmpd on ubuntu seems easy, but i never got it full working. It was working locally, but not for a cacti setup from another server. The problem was that the default install of snmpd on Ubuntu starts the demon on the loopback interface only, refusing connections from other computers.

Edit /etc/default/snmpd to fix that:

# This file controls the activity of snmpd and snmptrapd

# MIB directories.  /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs

# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux -p /var/run/snmpd.pid'

# snmptrapd control (yes means start daemon).  As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run.  See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes

that’s it. To restart the snmp server enter $ sudo /etc/init.d/snmpd restart

1 thought on “SNMPD auf Ubuntu funktionsfähig bekommenGetting SNMPD to work on Ubuntu

  1. THANKYOU! I’ve just wasted four hours of my time on this stupid issue – just another reason to hate Ubuntu.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.