CongoGrey has asked for the wisdom of the Perl Monks concerning the following question:
If I print the array i see the following information: .1.3.6.1.4.1.78.0.100147 4 IFName .1.3.6.1.4.1.78.0.100147 4 HASH(0xeea8c)#!/opt/VRTSnc/bin/perl -w use Net::SNMP; my $NodeAddress = '10.72.36.1'; my $ReadCommunity = 'public'; my ($session1, @trapvars, $error) = Net::SNMP->session( -hostname => $NodeAddress, -community => $ReadCommunity); if (!defined($session1)){ printf("ERROR: %s.'n", $error); exit 1;} my $ifAlias = '.1.3.6.1.2.1.31.1.1.1.18.110'; my $result = $session1->get_request( -varbinds => [$ifAlias]); if (!defined($session1)){ printf("ERROR: %.'n", $error); exit 1;} my $ifDescr = $result->{$ifAlias}; my ($session2) = Net::SNMP->session( -hostname => '10.62.11.58', -port => '162', -community => 'public'); if (!defined($session2)){ printf("ERROR: %s.'n", $error); exit 1;} $trapvars[0] = ".1.3.6.1.4.1.78.0.100147"; $trapvars[1] = OCTET_STRING; $trapvars[2] = 'IFName'; $trapvars[3] = ".1.3.6.1.4.1.78.0.100147"; $trapvars[4] = OCTET_STRING; $trapvars[5] = $result->{$ifDescr}; $session2->trap( -enterprise => '1.3.6.1.4.1.78', -agentaddr => $NodeAddress, -generictrap => '6', -specifictrap => '100147', -varbindlist => \@trapvars); if (!defined($session2)){ printf("ERROR: %s.'n", $error); exit 1;} $session1->close;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SNMP Get and Trap
by AcidHawk (Vicar) on Jan 10, 2003 at 06:47 UTC |