H
HansHG
Hi all!
I have a script that returns one SNMP OID from an SNMP Agent. It works
perfectly:
#!/usr/bin/perl -w
use strict;
use IO::Handle;
use Net::SNMP;
my $agentIdUniqueId = '.1.3.6.1.4.1.1977.1.1.2.1.0';
sub getuid {
my ($session, $error) = Net::SNMP->session
(
-hostname => shift || $_[0],
-community => shift || $community,
-port => shift || $port
);
my %hash = ($session->hostname, $result->{$agentIdUniqueId});
while ( ($k, $v) = each %hash) {
print "key $k value $v\n";
}
this works. But what do I do, when I have more than one varbind in my
varbindlist? Like:
my $result = $session->get_request(-varbindlist =>
[$agentIdUniqueId,$agentIdName,$agentBuildDescription,
$agentBuildVersion,$agentBuildNumber,$agentIdPlatformDescription]);
How do I need to change the script so that it returns all requested
OIDs? The query is done from perl. I can see the OIDs getting
requested in wireshark. But how do I return them?
please help
cheers
Hans
I have a script that returns one SNMP OID from an SNMP Agent. It works
perfectly:
#!/usr/bin/perl -w
use strict;
use IO::Handle;
use Net::SNMP;
my $agentIdUniqueId = '.1.3.6.1.4.1.1977.1.1.2.1.0';
sub getuid {
my ($session, $error) = Net::SNMP->session
(
-hostname => shift || $_[0],
-community => shift || $community,
-port => shift || $port
);
my %hash = ($session->hostname, $result->{$agentIdUniqueId});
while ( ($k, $v) = each %hash) {
print "key $k value $v\n";
}
this works. But what do I do, when I have more than one varbind in my
varbindlist? Like:
my $result = $session->get_request(-varbindlist =>
[$agentIdUniqueId,$agentIdName,$agentBuildDescription,
$agentBuildVersion,$agentBuildNumber,$agentIdPlatformDescription]);
How do I need to change the script so that it returns all requested
OIDs? The query is done from perl. I can see the OIDs getting
requested in wireshark. But how do I return them?
please help
cheers
Hans