
sreenmu
Novice
Jun 9, 2011, 10:40 PM
Post #1 of 1
(213 views)
|
|
How to establish session using Net::SNMP module and verify the same
|
Can't Post
|
|
Hello All, I want to send SNMP trap to host "10.207.x.x", so i am trying to establish session with host 10.207.x.x using NET::SNMP module before sending the trap. But i could not do it successfully. Code is shown below. #!/usr/bin/perl use strict; use warnings; use Net::SNMP; ($session, $error) = Net::SNMP->session(-hostname => 10.207.x.x, -port => 1162,); printf "The probe server hostname '%.10f'\n", $session->hostname(); $result = $session->trap( -enterprise => '1.3.6.1.6.3.1.1.4.1.0', -agentaddr => <source ip address where perl script is executed, -generictrap => 6, -specifictrap => 1, -varbindlist => '1.3.6.1.2.1.1.4.0', "STRING", 'WELCOME', ); printf "The trap enterprise id '%.10f'\n", $result->{'1.3.6.1.6.3.1.1.4.1.0'}; if (!defined $session) { printf "ERROR: %s.\n", $error; exit 1; } $session->close(); exit 0; If any one have worked on this? please let me know how to proceed in this regard. Advance Thanks Sreenivas
|