Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: snmpwalk in perl

by afoken (Canon)
on May 17, 2019 at 07:04 UTC ( #11100148=note: print w/replies, xml ) Need Help??


in reply to snmpwalk in perl

I need a snmpwalk script in Perl without using modules

... and I really, really need a mammoth to ride to work, right now, ASAP!

Are you aware that Perlmonks is not a code writing service? Show some effort. Start writing the script, show us where you are stuck, and we will gladly help you. Or make it a job and post it at https://jobs.perl.org/.

Here's a starter:

#!/usr/bin/perl use strict; use warnings; #### your code here ####

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: snmpwalk in perl
by Nouhira (Initiate) on May 17, 2019 at 08:51 UTC
    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";

      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://11100148]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2020-11-29 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?