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

Re: Cisco SNMP CDP Poll

by kderkinderen (Initiate)
on Aug 06, 2001 at 14:57 UTC ( #102427=note: print w/replies, xml ) Need Help??

in reply to Cisco SNMP CDP Poll

Sorry for the clueless question. How do I redirect the output to a test file? I tried a simple 1>/home/kderkind/outfile.txt but it was blank. I then tried to open a file from within - but I guess I don't understand the "format" and "write" well enough. Got nothing - output goes nowhere. Thanks, Kevin

Replies are listed 'Best First'.
Re: Re: Cisco SNMP CDP Poll
by fingers (Acolyte) on Aug 13, 2001 at 21:15 UTC
    Easiest way(I think) would be to change the bit of code that reads:
    #Prompt for SNMP community string print "community: "; chomp($community = <STDIN>); to $community=WHATEVERYOURCOMMUNITYSTRINGIS;
    Then launch the script with ip > nameoftextfile
    I am sure that there is a better way to do this(and one day I'll get off my but and add some text output as an option)
    Or if you open a filehandle to write to inside the code change the format STDOUT to format FILEHANDLE and the write to write FILEHANDLE. That should work as well.
      Put stuff like the community string into a config file and load it as needed. I use Config::Tiny but there are a host of alternatives.

      I put any variable that I may need in more than one program into a central system config file. That way, when community strings, passwords, file paths, etc. change, I only have to modify one file instead of twenty.

      Hope this helps,


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2023-10-03 20:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found