in reply to Re: Reading IP from a file and SNMP
in thread Reading IP from a file and SNMP
The above is more or less straight from the doc, and your situation is probably more complicated than that, but maybe this helps get started?open IPFILE,'<',"/tmp/ipfile.txt"; my @ip_list = <IPFILE>; close IPFILE; foreach my $ip_in_list ( @ip_list ) { ... ($session, $error) = Net::SNMP->session( -hostname => $ip_in_list, ... => ..., .. all other options ...; ); $newval = $session->get_request( [-callback => sub {},] [-delay => $seconds,] [-contextengineid => $engine_id,] [-contextname => $name,] -varbindlist => \@oids, ); # now do something with the data found in $newval # use -callback to point to a subroutine where you put further operati +ons to be carried out on $newval }
|
|---|