Re: snmptrapd not sending complete trap to default

[email protected]
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hei Christopher,

You where right about that.

I changed the code in php, i did this :

#!/usr/bin/php -q
<?php

$file = file_get_contents("php://stdin", "r");

$fp = fopen('/tmp/snmptrapd.log', "a");

fwrite($fp,$file);

fclose($fp);

?>

And this worked great!

This solved my headache, thanks!


Peter


Christopher Fowler wrote:
> Peter,
>
> I'm not an php expert but it seems you are writing the command line
> arguments to a file.  I do not believe that is how traphandle works.
> I've got a traphandle program written in C.  They way snmptrapd sends it
> traps is via executing the C program and then writing the traps to
> STDOUT to be read by STDIN.
>
> Equivalent Perl solution
>
> #!/usr/bin/perl
>
> open OUT, ">> /tmp/snmptrapd.log";
> while(<STDIN>) {
>  print OUT "$_";
> }
> close OUT;
>
>
>
>
>   



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
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.