Re: Traphandler problem
"Pedro Henrique Morsch Mazzoni" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Fixed, authentication problems. Anybody has written a c ansi traphandler? And what about the pidFile directive in snmptrapd.conf, can I send the notifications to another daemon? Anybody did that? Thanks, Pedro Mazzoni 2006/3/20, Pedro Henrique Morsch Mazzoni <[email protected]>: > > Hi, > > I am using the traphandler directive in snmptrapd to parse output to a > script: > > #snmptrapd.conf > authCommunity log public > authUser log lps > traphandle default /net/users/mazzoni/faculdade/pf/fontes/traphandler.pl > > And the script traphandler.pl: > > #!/usr/bin/perl > # A simple trap handler > my $TRAP_FILE = "/root/traps.all.log"; > > my $host = <STDIN>; # Read the Hostname - First line of input from > STDIN > chomp($host); > my $ip = <STDIN>; # Read the IP - Second line of input > chomp($ip); > > while(<STDIN>) { > chomp($_); > push(@vars,$_); > } > > open(TRAPFILE, ">> $TRAP_FILE"); > $date = `date`; > chomp($date); > print(TRAPFILE "New trap received: $date for $OID\n\nHOST: $host\nIP: > $ip\n"); > foreach(@vars) { > print(TRAPFILE "TRAP: $_\n"); > } > print(TRAPFILE "\n----------\n"); > close(TRAPFILE); > > The traps are logged in the log file, but the traphandler is not > generating any output. > > Any ideas? > > Thanks, > Pedro Mazzoni > >