LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-14-2007, 07:15 AM   #1
poonamsaurab
LQ Newbie
 
Registered: Dec 2007
Posts: 1

Rep: Reputation: 0
snmpdtrapd configuration process


Dear All
I am noive in configuring snmp.I have managed the configuration process but now i am working in snmpdtrap. I am not getting idea about the snmpd configuration process.Can anybody suggest me
 
Old 12-14-2007, 09:48 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,397
Blog Entries: 1

Rep: Reputation: 64
What about a simple (yet functional) example ?

Code:
[root@agente86 ~]# more /etc/snmp/snmpdtrapd.conf 
authCommunity log,execute LiebertEM 
authCommunity log pfSense
traphandle default /bin/bash /usr/local/sbin/myactionscript.sh
In my network I have two sources of SNMP traps: a firewall and a no-break. The firewall is configured to send SNMP traps to this machine (agente86) using the community string "pfSense". The same with no-break, but using the community string "LiebertEM".

For both I want to log the traps.
For SNMP traps from no-break I want to analyze the SNMP trap and if it is just info messages (battery tests, for instances) I discard those messages. Otherwise I want to receive those messages by e-mail. To do that, I use the line "authCommunity log,execute LiebertEM" and traphandle line specifies the script which will decide if the received trap (in standart input) is test related or not. In the last case, it will basically send the msg by e-mail using the helper program traptoemail:
(I'm hiding the dirty details)
Code:
#!/bin/bash

# if the community is not LiebertEM, exit.
....

#create a temporary file to store the input from snmptrap handler.
TMPFILE=$(mktemp /tmp/snmptraphandle.XXXXXXXXXX) || exit 1
# the output of snmptrap handler
cat > $TMPFILE
...

# if the message is test related, exit.
# (process/analyze the msg in $TMPFILE)
...
# else
...
# send the output to traptoemail
cat $TMPFILE | traphandle default /usr/bin/perl /usr/bin/traptoemail -s smtp.yourdomain.com.br -f smtpdtrap@yourdomain.com.br you@yourdomain.com.br
You need to start the snmptrapd daemon and open the firewall ports to be able to receive the SNMP trap messages.
On the sources you need to specify the IP of the machine which is running the snmpttrapd.

I hope this can help you to start with snmptrap.


good luck !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how a father process know which child process send the signal SIGCHLD icoming Programming 10 07-20-2010 08:26 AM
Need to install process at end of boot process ch485de Linux - Newbie 5 12-07-2006 06:47 PM
child process usses same amount of ram as parent process socialjazz Programming 7 10-19-2006 06:48 PM
SLACKWARE10.1-full process from (HardDisk)installation to configuration! zhy2111314 Slackware - Installation 2 08-07-2005 10:54 PM
Bash Scripting - child process affecting parent process mthaddon Linux - General 1 05-02-2004 02:19 PM


All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration