SNMP Installation und Konfiguration (Debian/Ubuntu)

Aus Laub-Home Wiki

Hier eine kleine Anleitung wie man SNMP unter Debian oder Ubuntu zum laufen bekommt.

Installation

aptitude update && aptitude install snmpd

Konfiguration Ubuntu / Debian Lenny

Die Standard Konfigurations Datei editieren:
/etc/snmp/snmpd.conf

#SNMP group
com2sec readonly  default          yourSNMPGroup

view all    included  .1     80
#view system included  .1.3.6.1.2.1.1
#view system included  .iso.org.dod.internet.mgmt.mib-2.system

#where the Maschine is located
syslocation Machine Location (configure /etc/snmp/snmpd.local.conf)

#Your Mountpoints and the critical disk full percentage
disk / 10%
disk /srv 10%

Debians default Konfiguration editieren, wichtig hier ist, das man dem "127.0.0.1" noch die Interface IP hinzufügt auf die man eine SNMP Abfrage von einem anderen System starten will.

# 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 -g snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1 192.168.0.1'

# 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

Nun den Dienst neu starten:

/etc/init.d/snmpd restart

Konfiguration Debian Squeeze

/etc/snmp/snmpd.conf

#  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
#  Listen for connections on all interfaces (only IPv4)
agentAddress udp:161


                                                 #  Full access from an example network
                                                 #     Adjust this network address to match your local
                                                 #     settings, change the community string,
                                                 #     and check the 'agentAddress' setting above
#rocommunity secret  10.0.0.0/16
rocommunity community  192.168.50.5

sysLocation    Laub-Home

#
#  Disk Monitoring
#
                               # 10MBs required on root disk, 5% free on /var, 10% free on all other disks
disk       /     5%
disk       /srv  5%
includeAllDisks  10%

Test via snmpwalk

snmpwalk

snmpwalk -v 2c -c COMMUNITY localhost .1

Quelle

http://www.cyberciti.biz/faq/debain-ubuntu-install-net-snmpd-server/