10 More Discussions You Might Find Interesting
1. AIX
After I had successfully installed bash I wanted to install emacs. I downloaded the packages from IBM (emacs, emacs-nox, and emacs-X11), but I could not install emacs-X11. It needs libjpeg and libtiff, but I couldn't install both libs. Error messages:
file /opt/freeware/64 from install of... (2 Replies)
Discussion started by: BuSchu
2 Replies
2. UNIX for Dummies Questions & Answers
gnus doesn't seem to work for me. I tried giving it a couple different servers in the GNUs config file, including textnews.news.cambrium.nl and news.gnus.org. The first one I've used before, through Lynx with the nntp:// scheme (not the news: scheme). When I try starting gnus, it gives the... (1 Reply)
Discussion started by: Ultrix
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I am new to this forum and a beginner in unix. Please correct me if I put the question in a wrong way..
How to use emacs editor? Also how to open existing emacs files with .cgi format?
I have the following link :-
http link i.e. url and path : /abc/xyz.dev/xyz/documents
What... (7 Replies)
Discussion started by: swathi123
7 Replies
4. Shell Programming and Scripting
Hello,
i have a demon 'c' program that have a dynamic table of logic registers ( 2000 variables ).
exemple of registers:
I1.34.5
M23.4.1
I want from shell acess to this table of registers.
How can i do this?
with something like for read I1.34.5:
#cat... (3 Replies)
Discussion started by: rzyz
3 Replies
5. UNIX for Dummies Questions & Answers
could someone please tell me how do I work emacs on unix?? how do you input the command and open up files and edit stuff. I know M-x info will lauch the info viewer, C-x u is undo, M-x spell-region run a spell check but when i use some of these command on emacs in Unix, I'm getting no results or... (1 Reply)
Discussion started by: starwind4
1 Replies
6. Shell Programming and Scripting
Hello all
i need to implement demon that needs to extract data from db load the data to memory and according to this data
to perform actions like sending emails or write/update files this action needs to be preformed each 30 min's
now i really don't know what to decide or to compile c++... (5 Replies)
Discussion started by: umen
5 Replies
7. UNIX and Linux Applications
Hey everybody!
Not sure if this goes here, but I think it's the best fit.
I was just wondering, how do I use a compiler from Emacs?
Also, how do I turn syntax highlighting on?
Thanks in advance! (5 Replies)
Discussion started by: led3234
5 Replies
8. Shell Programming and Scripting
Hello
im kinda new to perl programming in unix
i need to make some kind of perl demon that sites and waits to see if there is files in the dir
if there is complete file ( not part of it ) , I need to mv it to different dir
ok so the easy parts to cp files and perl I know , but how the hell... (1 Reply)
Discussion started by: umen
1 Replies
9. UNIX for Dummies Questions & Answers
Any one has a good documentation on How To Use EMACs editor??
Thanks
Ven :eek: (4 Replies)
Discussion started by: VENC22
4 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I am working with xEmacs 21.1 patch 14.
I see I can configure it to be very User Friendly.
I can highlight variables, color them, and actually make it look like a Visual IDE.
How do I configure it?
How do I color Variables in one color, and make them bold, and how do I change the... (1 Reply)
Discussion started by: sierra_aar
1 Replies
TrapReceiver(3pm) User Contributed Perl Documentation TrapReceiver(3pm)
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.14.2 2009-10-29 TrapReceiver(3pm)