in reply to Net::SNMP get_request problem
Try to see if you understand this small example (read: perldoc it);-)my ($s,$e)=Net::SNMP->session(-hostname=> $ip, -community =>$community +); if (!defined($s)) { printf("error: %s.\n", $e); exit 1; } $oid = ".1.3.6.1.4.1.9.9.42.1.2.1.1.2"; my @args = ( -varbindlist => [$oid]); while ( defined $s->get_next_request(@args) ) { $_ = ( keys(%{ $s->var_bind_list }) )[0]; if (!oid_base_match($oid, $_)) { last; } printf("%s => %s", $_, $s->var_bind_list->{$_}); my @n = split /\./, $_; print " (index: ",$n[$#n],")\n"; @args = (-varbindlist => [$_]); } # Let the user know about any errors if ($s->error() ne '') { print $s->error(),"\n"; }
cheers
PS: I think *your* problem is just that you have to start your OID with a DOT (like the error message says). Nothing more...
to ask a question is a moment of shame
to remain ignorant is a lifelong shame
|
|---|