insaniac has asked for the wisdom of the Perl Monks concerning the following question:
Does anybody know how I can get the IP address of the peer that makes the SNMP call to the NetSNMP::agent module?
I've written a MySQL SNMP agent (I can post the code if someone's interested) and I'd like to see the IP address of the peer in my debugging output.
Is it hidden in one of these variables?
my ($handler, $registration_info, $request_info, $requests) = @_;
These are the variables of the handler function request_handler.
my $agent = new NetSNMP::agent( # searches for /etc/snmp/$agent_name.conf !! 'Name' => $agent_name, 'Ports' => "udp:$port,tcp:$port", ); pdebug("SNMP agent created"); my $regoid = new NetSNMP::OID($reg_oid); $agent->register($agent_name, $regoid, \&request_handler); pdebug("SNMP agent registered");
Many thanks!
UPDATE: the full source of the agent is on my scratchpad
to ask a question is a moment of shame
to remain ignorant is a lifelong shame
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IP address of peer when using NetSNMP::agent
by zentara (Cardinal) on Mar 16, 2009 at 11:55 UTC | |
by insaniac (Friar) on Mar 16, 2009 at 11:57 UTC | |
by zentara (Cardinal) on Mar 16, 2009 at 12:04 UTC |