in reply to Re: Reading IP from a file and SNMP
in thread Reading IP from a file and SNMP

Try starting off with module Net::SNMP, to get single values from a remote IP, probably the method $session->get_request is your best bet.. it's pretty well documented in perldoc Net::SNMP.. However you probably have to put your community in the file.. if this is undesirable, you could use module Term::ReadKey to allow "safe" reading of the password from the command line..

As far as getting the IP addresses out of a file, if they are listed one IP Address per line with nothing else included in the file itself: just read the file, put the contents in an array, then loop your SNMP get operations for each item in the array roughly something like:
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 }
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?