snmptrapd


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users snmptrapd
# 1  
Old 01-25-2011
snmptrapd

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
Code:
# 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
Code:
# 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 :
Code:
#!/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 :

Code:
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 Smilie 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.
This User Gave Thanks to dedibox For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Snmptrapd configuration on rhel 8

I need to configure snmptrap on rhel 8 server and send trap to nimsoft for file system , memory and cpu load and network diconnection status. please help me, if any one configured. (1 Reply)
Discussion started by: yash_message
1 Replies

2. Linux

Snmptrapd is not receiving generated traps in centos 5.7

Hi, I tried to run snmptrapd from my customized service in centos 5.7 machine... the command used to start snmptrapd is .... /opt/snmpdemo/bin/snmptrapd -Le -c /opt/snmpdemo/etc/snmp/snmptrapd.conf -n -C -t -m "" And tried to trigger a trap... Trap got triggered but snmptrapd didn't... (0 Replies)
Discussion started by: sharathpadman
0 Replies

3. UNIX for Advanced & Expert Users

logOption warning in snmptrapd.conf

Hi, trying to get snmp traps logged in /var/log/messages. I put this option in snmptrapd.conf: logOption Ls d then restarting the snmptrad daemon I got this warning: Unknown token: logoption. and server is not logging traps. Starting snmptrapd manually works, traps are logged.... (0 Replies)
Discussion started by: neutrino
0 Replies

4. UNIX for Advanced & Expert Users

snmptrapd trap variable value truncated

I have configured snmptrapd to log the traps to log file. the traps received and logged ok based on the mib file definition. there is only one problem. the value of one of the variables seems to be truncated due to end of line or some special char. linux is centos 6.2 snmp software... (4 Replies)
Discussion started by: ahmad.zuhd
4 Replies

5. UNIX for Dummies Questions & Answers

snmptrapd uses all the CPU and 4 Go memory

Hello all, Below what I saw on my solaris 10 box : $ prstat PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 683 root 4082M 91M run 10 0 41:45:39 96% snmptrapd/1 syslog gives a lot of : snmptrapd: illegal data attempted to be added to table nlmLogVariableTable... (0 Replies)
Discussion started by: Gino_75
0 Replies

6. UNIX for Advanced & Expert Users

Configuring snmpd.conf and snmptrapd.conf

HI, I want a help for Configuring snmpd.conf and snmptrapd.conf (i.e Configuring SNMP) for receiving TRAPS in my networks. I am using RHEL4.0 OS. Please tell me How I can configure above two files in a proper way and at an advanced level. Especially I am getting... (2 Replies)
Discussion started by: jagdish.machhi@
2 Replies

7. UNIX for Dummies Questions & Answers

snmptrapd.conf

i tried this to get snmptrapd.conf bt unable... # snmpconf The following installed configuration files were found: 1: /etc/snmp/snmp.conf 2: /etc/snmp/snmpd.conf 3: /usr/share/snmp/snmp.conf 4: /usr/share/snmp/snmpd.conf Would you like me to read them in? Their... (0 Replies)
Discussion started by: jeenat
0 Replies

8. UNIX for Dummies Questions & Answers

snmptrapd.conf

Hi All Can anybody tell me how to configure snmptrapd.conf ? Thanx (0 Replies)
Discussion started by: jeenat
0 Replies

9. Solaris

how to activate snmptrapd deamon in solaris machine

hi i am able to see the snmpd service running in my machine. i would like to get activate snmptrapd deamon services in my solaris box, could any one suggest me in getting activate the snmptrapd service (0 Replies)
Discussion started by: praveen.yenegal
0 Replies
Login or Register to Ask a Question