Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: snmpwalk in perl

by Nouhira (Initiate)
on May 17, 2019 at 08:51 UTC ( #11100155=note: print w/replies, xml ) Need Help??


in reply to Re: snmpwalk in perl
in thread snmpwalk in perl

yes, so sorry for that. Im still in learning phase in perl, i wanted to snmpwalk for 3 to 4 IP's using snmpwalk command and store the result in an array, After that i want to use a 'for' loop to iterate that array and print the output for one IP at a time. I hope u understood my query. I will staring writing the script for one IP. Please correct it
#!/usr/bin/perl use strict; use warnings; my $ip = "199.223.232.10"; my $community = "public"; my $oid = "1.3.6.1.2.1.25.2.2.0"; my @arr = `snmpwalk _v2c _$community _$ip _$oid`; print "@arr";

Replies are listed 'Best First'.
Re^3: snmpwalk in perl
by thanos1983 (Parson) on May 17, 2019 at 17:23 UTC

    Hello again Nouhira,

    On your sample of code you are not using _ (underscores) why on your sample of code you use?

    Does this code compile?

    On my LinuxOS test box your code gives me this error:

    $ perl test.pl _public: Unknown Object Identifier (Sub-id not found: (top) -> _public +)

    Please test your code before posting.

    Hope this helps, Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11100155]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-12-03 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (56 votes). Check out past polls.

    Notices?