ivancheng has asked for the wisdom of the Perl Monks concerning the following question:
The oids information will be read from the file as below. MIB_OID.dat file: interface:.1.3.6.1.2.1.2.2.1.2.1 in_octet:.1.3.6.1.2.1.2.2.1.10.1 out_octet:.1.3.6.1.2.1.2.2.1.16.1 :my ($result, $err) = snmpget( hosts => \@ARGV, snmp => \%snmparam, oids => \%hash );
Kindly advise how I can extract the oids data from the $result as I have no idea for it. Ivanuse Net::SNMP::Util; open $input_fh, '<', "MIB_OID.dat" or die 'Could not open file: ', $OS +_ERROR; my %hash; while ( my $line = <$input_fh> ) { chomp $line; last if ! $line; my ( $word1 , $word2 ) = split /:/, $line, 2; $hash{$word1} = $word2; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extract data using snmpget with hash array
by tangent (Parson) on Sep 02, 2015 at 11:30 UTC | |
by ivancheng (Initiate) on Sep 04, 2015 at 11:16 UTC |