snmptrap.conf file


 
Thread Tools Search this Thread
Special Forums IP Networking snmptrap.conf file
# 1  
Old 04-17-2008
snmptrap.conf file

Hi
I tried a lot bt could not configure snmptrapd.conf...
Can any one tell me the steps or give me the configured snmptrapd.conf file??
Its really important..Plz help me..

Thanx
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Configure resolv.conf and nsswitch.conf

Hi, I've installed Solaris 11.3(live media) and configured DNS. Everytime I reboot the server, resolv.conf got deleted and it created a new nsswitch.conf. I used below to configure both settings: # svccfg -s dns/client svc:/network/dns/client> setprop config/nameserver = (xx.xx.xx.aa... (1 Reply)
Discussion started by: flexihopper18
1 Replies

2. Shell Programming and Scripting

Script to update rsyslog.conf and auditd.conf

Hello all, Newbie here. I'm currently tasked with updating rsyslog.conf and auditd.conf on a large set of servers. I know the exact logging configurations that I want to enable. I have updated both files on on a server and hope to use the updated files as a template for the rest of the... (3 Replies)
Discussion started by: Mide
3 Replies

3. UNIX for Advanced & Expert Users

Snmptrap command help

Dear all, I have configured the "snmpd.conf" to be able to send traps to a network manager. The file is saved in "/etc/net-snmp/snmp/". Attached is my configuration, which seems to be correct. (The IP address 10.192.4.4 is the trap receiver). Next my aim was to send a test trap to verify... (0 Replies)
Discussion started by: nms
0 Replies

4. Shell Programming and Scripting

Spawn snmptrap from python

Hi I am trying to spawn an snmptrap from python but i keep getting the following error Invalid version specified after -v flag: 2c -c public 192.168.2.162 SNMPv2-SMI::enterprises.3.1.1 here is the python code i am using from subprocess import Popen Popen() When i test the same... (0 Replies)
Discussion started by: kaf3773
0 Replies

5. Solaris

snmptrap command - Help Please!!

Hi All, I am trying to generate a trap with in the localhost. Please see the attachment for the exact syntax what I am using to generate the traps. However, I am getting the following error. Unknown Object Identifier (Sub-id not found: (top) -> ) Can you please guide me how to use the... (1 Reply)
Discussion started by: ntgobinath
1 Replies

6. Shell Programming and Scripting

Help with awk and conf file

hello i have a configuration file with some fields, for example: #file conf.cfg name;object;var1;var2;var8 then i have a csv data file: var1;var2;var3;var4;var5;var6;var7;var8;var9 aaa;bbb;ccc;ddd;eee;fff;ggg;hhh;iii ... now i should read the conf.cfg file and extract the... (3 Replies)
Discussion started by: drain
3 Replies

7. Shell Programming and Scripting

Conf file entry.

Hi, Lets say I have a script which reads a conf file (say MASTERFILE) line by line to fetch file_name, source_path, dest_path. But currently, here the file name are static for eg: ABC.txt or XYZ.txt. So i have hard-coded in the conf file. So what happens that the script picks up the file_name... (1 Reply)
Discussion started by: amit.mathur08
1 Replies

8. UNIX for Advanced & Expert Users

How can i tell which conf file it is using

i have this program running on my solaris and there are two identical config files, i am not sure which one is being used by this program but I am sure it uses one of them. I run lsof -p {pid} but it does not show which config file has been read by this program, what i am doing wrong? thanks (4 Replies)
Discussion started by: fedora
4 Replies

9. Solaris

basic question on sd.conf and lpc.conf file

Hello Guys, Do we need to configure this file only if we add SAN disk or even if we add local disk, do we need to modify? (4 Replies)
Discussion started by: mokkan
4 Replies

10. 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
Login or Register to Ask a Question
TrapReceiver(3) 					User Contributed Perl Documentation					   TrapReceiver(3)

NAME
NetSNMP::TrapReceiver - Embedded perl trap handling for Net-SNMP's snmptrapd SYNOPSIS
Put the following lines in your snmptrapd.conf file: perl NetSNMP::TrapReceiver::register("trapOID", &myfunc); ABSTRACT
The NetSNMP::TrapReceiver module is used to register perl subroutines into the Net-SNMP snmptrapd process. Net-SNMP MUST have been configured using --enable-embedded-perl. Registration of functions is then done through the snmptrapd.conf configuration file. This module can NOT be used in a normal perl script to receive traps. It is intended solely for embedded use within the snmptrapd demon. DESCRIPTION
Within the snmptrapd.conf file, the keyword "perl" may be used to call any perl expression and using this ability, you can use the NetSNMP::TrapReceiver module to register functions which will be called every time a given notification (a trap or an inform) is received. Registered functions are called with 2 arguments. The first is a reference to a hash containing information about how the trap was received (what version of the SNMP protocol was used, where it came from, what SNMP user name or community name it was sent under, etc). The second argument is a reference to an array containing the variable bindings (OID and value information) that define the noification itself. Each variable is itself a reference to an array containing three values: a NetSNMP::OID object, the value that came associated with it, and the value's numeric type (see NetSNMP::ASN for further details on SNMP typing information). Registered functions should return one of the following values: NETSNMPTRAPD_HANDLER_OK Handling the trap succeeded, but lets the snmptrapd demon check for further appropriate handlers. NETSNMPTRAPD_HANDLER_FAIL Handling the trap failed, but lets the snmptrapd demon check for further appropriate handlers. NETSNMPTRAPD_HANDLER_BREAK Stops evaluating the list of handlers for this specific trap, but lets the snmptrapd demon apply global handlers. NETSNMPTRAPD_HANDLER_FINISH Stops searching for further appropriate handlers. If a handler function does not return anything appropriate or even nothing at all, a return value of NETSNMPTRAPD_HANDLER_OK is assumed. Subroutines are registered using the NetSNMP::TrapReceiver::register function, which takes two arguments. The first is a string describing the notification you want to register for (such as "linkUp" or "MyMIB::MyTrap" or ".1.3.6.1.4.1.2021...."). Two special keywords can be used in place of an OID: "default" and "all". The "default" keyword indicates you want your handler to be called in the case where no other handlers are called. The "all" keyword indicates that the handler should ALWAYS be called for every notification. EXAMPLE
As an example, put the following code into a file (say "/usr/local/share/snmp/mytrapd.pl"): #!/usr/bin/perl sub my_receiver { print "********** PERL RECEIVED A NOTIFICATION: "; # print the PDU info (a hash reference) print "PDU INFO: "; foreach my $k(keys(%{$_[0]})) { if ($k eq "securityEngineID" || $k eq "contextEngineID") { printf " %-30s 0x%s ", $k, unpack('h*', $_[0]{$k}); } else { printf " %-30s %s ", $k, $_[0]{$k}; } } # print the variable bindings: print "VARBINDS: "; foreach my $x (@{$_[1]}) { printf " %-30s type=%-2d value=%s ", $x->[0], $x->[2], $x->[1]; } } NetSNMP::TrapReceiver::register("all", &my_receiver) || warn "failed to register our perl trap handler "; print STDERR "Loaded the example perl snmptrapd handler "; Then, put the following line in your snmprapd.conf file: perl do "/usr/local/share/snmp/mytrapd.pl"; Start snmptrapd (as root, and the following other opions make it stay in the foreground and log to stderr): snmptrapd -f -Le You should see it start up and display the final message from the end of the above perl script: Loaded the perl snmptrapd handler 2004-02-11 10:08:45 NET-SNMP version 5.2 Started. Then, if you send yourself a fake trap using the following example command: snmptrap -v 2c -c mycommunity localhost 0 linkUp ifIndex.1 i 1 ifAdminStatus.1 i up ifOperStatus.1 i up ifDescr s eth0 You should see the following output appear from snmptrapd as your perl code gets executed: ********** PERL RECEIVED A NOTIFICATION: PDU INFO: notificationtype TRAP receivedfrom 127.0.0.1 version 1 errorstatus 0 messageid 0 community mycommunity transactionid 2 errorindex 0 requestid 765160220 VARBINDS: sysUpTimeInstance type=67 value=0:0:00:00.00 snmpTrapOID.0 type=6 value=linkUp ifIndex.1 type=2 value=1 ifAdminStatus.1 type=2 value=1 ifOperStatus.1 type=2 value=1 ifDescr type=4 value="eth0" EXPORT
None by default. # =head2 Exportable constants # NETSNMPTRAPD_AUTH_HANDLER # NETSNMPTRAPD_HANDLER_BREAK # NETSNMPTRAPD_HANDLER_FAIL # NETSNMPTRAPD_HANDLER_FINISH # NETSNMPTRAPD_HANDLER_OK # NETSNMPTRAPD_POST_HANDLER # NETSNMPTRAPD_PRE_HANDLER SEE ALSO
NetSNMP::OID, NetSNMP::ASN snmptrapd.conf(5) for configuring the Net-SNMP trap receiver. snmpd.conf(5) for configuring the Net-SNMP snmp agent for sending traps. http://www.Net-SNMP.org/ AUTHOR
W. Hardaker, <hardaker@users.sourceforge.net> COPYRIGHT AND LICENSE
Copyright 2004 by W. Hardaker This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2009-05-19 TrapReceiver(3)