Hi everybody,
I'm trying to run a SNMP supervisor on Debian Lenny to supervise Uninteruptible Power Systems which support SNMP. I've installed snmp and snmpd debian packages for NET-SNMP 5.4.1 et i've configured /etc/snmp file with the snmpconf perl script :
file /etc/snmp/snmp.conf
# snmp.conf
# Configuration du superviseur SNMP (snmpd)
# SECTION: Debugging output options
#dodebugging 0
#dumppacket no
#notokenwarnings yes
# SECTION: Output style options
logtimestamp yes
printnumericenums 1
printnumericoids no
dontbreakdownoids yes
escapequotes no
quickprinting yes
numerictimeticks yes
suffixprinting 1
# SECTION: Textual mib parsing
mibdirs /etc/snmp/mibs:/usr/share/snmp/mibs
#mibdirs /etc/snmp/mibs
showmiberrors no
mibwarninglevel 2
strictcommentterm 1
miballowunderline no
mibreplacewithlatest no
# SECTION: Default Authentication Options
# port UDP, version de SNMP, groupe snmp pour ecriture
defaultport 161
defversion 1
defcommunity perso
# Access Control
# sec.name source community
com2sec paranoid default public
com2sec readonly default public
com2sec readwrite default askco
# sec.model sec.name
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
# incl/excl subtree mask
view all included .1 80
view system included .iso.org.dod.internet.mgmt.mib-2.system
# context sec.model sec.level match read write notif
access MyROSystem "" any noauth exact system none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
file /etc/snmp/snmptrapd.conf
# snmptrapd.conf:
# Gestion des messages d'alertes (trap) par le service
# de gestion des alertes (snmptrapd)
# Runtime options
#pidfile /var/run/snmptrapd.pid
# SECTION: Output formatting for traps received.
format2 %02.2l/%02.2m/%y %02.2h:%02.2j:%02.2k %W de %A\n
# SECTION: Logging options
donotlogtraps no
logoption s 2
logoption f /var/log/snmptrapd.log
outputoption S
printeventnumbers yes
# SECTION: Trap Handlers / Traitement des alertes
#traphandle " .oid" /chemin/programme "arguments"
traphandle default /usr/bin/eject
# notice : I've tried other OIDs
# SECTION: Authentication options
ignoreauthfailure no
# Access Control
# sec.name source community
com2sec paranoid default public
com2sec readonly default public
com2sec readwrite default perso
# sec.model sec.name
group MyROSystem v1 paranoid
group MyROSystem v2c paranoid
group MyROSystem usm paranoid
group MyROGroup v1 readonly
group MyROGroup v2c readonly
group MyROGroup usm readonly
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
# incl/excl subtree mask
view all included .1 80
#view system included .iso.org.dod.internet.mgmt.mib-2
# context sec.model sec.level match read write notif
access MyROSystem "" any noauth exact none none none
access MyROGroup "" any noauth exact all none none
access MyRWGroup "" any noauth exact all all none
The /etc/snmpd.conf file is empty because I do not want a SNMP agent on the supervisor.
I launch with :
#!/bin/bash
killall snmpd
killall snmptrapd
snmpd -d -c /etc/snmp/snmp.conf
snmptrapd -d -c /etc/snmp/snmptrapd.conf
with -d option to get debug logs. In the syslog file I can read :
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0000: 30 58 02 01 00 04 05 61 73 6B 63 6F A4 4C 06 0B 0X.....perso.L..
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0000: 30 58 02 01 00 04 05 61 73 6B 63 6F A4 4C 06 0B 0X.....perso.L..
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0016: 2B 06 01 04 01 93 24 01 02 01 02 40 04 C0 A8 00 +.....$....@....
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0016: 2B 06 01 04 01 93 24 01 02 01 02 40 04 C0 A8 00 +.....$....@....
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0032: 01 02 01 06 02 01 02 43 03 0B 09 89 30 2C 30 2A .......C....0,0*
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0032: 01 02 01 06 02 01 02 43 03 0B 09 89 30 2C 30 2A .......C....0,0*
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0048: 06 0B 2B 06 01 04 01 93 24 01 02 01 02 04 1B 55 ..+.....$......U
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0048: 06 0B 2B 06 01 04 01 93 24 01 02 01 02 04 1B 55 ..+.....$......U
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0064: 74 69 6C 69 74 79 20 70 6F 77 65 72 20 6E 6F 74 tility power not
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0064: 74 69 6C 69 74 79 20 70 6F 77 65 72 20 6E 6F 74 tility power not
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0080: 20 61 76 61 69 6C 61 62 6C 65 available
Jan 21 10:57:03 pi02-deb1 snmptrapd[3054]: 0080: 20 61 76 61 69 6C 61 62 6C 65 available
So the trap is well received but unfortunately the action associated to the traphandle (to open the cd tray with /bin/eject) fails I've tried other commands, the problem is with the traphandle instruction ...
On the web many people got this problem but I didn't manage to find any answer ...
Thanks in advance for your help and sorry for my bad English.
---------- Post updated 01-25-11 at 02:15 AM ---------- Previous update was 01-24-11 at 03:46 AM ----------
got the solution :
We had to add this line in the snmptrapd.conf file :
authCommunity log,execute,net public
the execute keyword permit executing external programs from the trap handling system.