Traphandler problem

"Pedro Henrique Morsch Mazzoni" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.