Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: changing localaddr

by Khen1950fx (Canon)
on Nov 02, 2011 at 17:30 UTC ( #935454=note: print w/ replies, xml ) Need Help??


in reply to changing localaddr

I was thinking along the same lines as NetWallah, but I discovered that -agentaddr isn't recognized by SNMPv2c. Maybe this is closer to what you need.

#!/usr/bin/perl use strict; use warnings; use Net::SNMP::XS; use Net::SNMP qw(:ALL); my ( $session, $error ) = Net::SNMP->session( -hostname => '127.0.0.1', -community => 'public', -localaddr => '192.168.1.108', -port => SNMP_TRAP_PORT, -version => 'snmpv2c', -community => 'public', -debug => '0x02', -nonblocking => 0, ); if ( not defined $session ) { printf "ERROR: %s.\n", $error; exit 1; } my $result = $session->snmpv2_trap( -varbindlist => [ '1.3.6.1.2.1.1.3.0', TIMETICKS, 600, '1.3.6.1.6.3.1.1.4.1.0', OBJECT_IDENTIFIER, '1.3.6.1.4.1', '1.3.6.1.2.1.1.1.0', OCTET_STRING, 'Hub', '1.3.6.1.2.1.1.5.0', OCTET_STRING, 'Closet Hub', ], ); if ( not defined $result ) { printf "ERROR: %s.\n", $session->error(); } else { printf "SNMPv2-Trap-PDU sent.\n"; }


Comment on Re: changing localaddr
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://935454]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (11)
As of 2015-07-08 06:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls