|
From: Conaway, A. <aar...@mo...> - 2006-01-31 15:43:45
|
DonKiShoot is right. =20
The pagination problems ( the "--- More ---" showing up ) is solved by =
the module itself. When you log into the device, the first thing the =
module does is send a "terminal length 0". This solves a lot of =
problems in converting pages of output to arrays in Perl.
The method "getConfig()" actually does a "show running-config" and =
stores the output in the return variable. The sample script then takes =
the output and writes it to a file using the Perl file handling =
functions. It actually doesn't do an FTP or TFTP at all.
Does that answer your question, Markus?
---------
Aaron Conaway | Network Architect | Morris DigitalWorks
-----Original Message-----
From: ntc...@li... =
[mailto:ntc...@li...] On Behalf Of DonKiShoot
Sent: Tuesday, January 31, 2006 6:15 AM
To: Markus Zielonka
Cc: ntc...@li...
Subject: Re: [Ntci-users] Question Script save config from a Cisco =
router
For your "more" problem, when you logged on cisco first use "terminal=20
length 0" but i think that it is automatically does in the perl module=20
fonctions.
Next question, i think you want to know if $conn->getConfig(); copy=20
running-config or start-up config in the local file $host."-confg" ????
I don't know but you can look in the source code of the perl module file =
: cisco....ios.pm for knowing if it is the running or startup that is =
get.
If you want to put on a tftp server, find a function that do it or put a =
command like "copy running-config tftp" on cli.
If you want to put on a ftp server, use the script below and after put=20
your config file on a ftp server with a ftp module fonction.
Hope i help you
Sorry for my poor englishfrenchamerican language ;)
Markus Zielonka a =E9crit :
> Hello NG,
>
> i have a one question.
> How is the script to save the config?
> Normel ist sh run but the problem ist the "more" or copy run or =
start-up
> config with TFTP or FTP.
> How it works in the script?
>
> 1 use Net::Telnet::Cisco::IOS; # import NTCI
> 2 $username =3D "username"; # the username to use when =
logging in
> 3 $password =3D "password"; # the matching password
> 4 @hosts =3D qw( switch1 # an array of hosts to log into
> router1
> switch2
> router2
> );
> 5 foreach $host ( @hosts ) { # go through the array one element =
at a time
> 6 my $conn =3D Net::Telnet::Cisco::IOS->new(HOST =3D> $host); =
# connect to the host
> 7 $conn->login( Name =3D> $username, # Log into the =
device
> Password =3D> $password);
> 8 @output =3D $conn->getConfig(); # Put the config in an =
array
> 9 $outfile =3D ">" . $host . "-confg"; # create a filename =
called ">host-confg"
> 10 open ( OUTFILE, $outfile ); # open a file for =
writing
> 11 print "Writing $host to file\n"; # write a status message
> 12 print ( OUTFILE @output ); # print the config to =
file
> 13 close OUTFILE; # close the file
> 14 $conn->close; # close the connection =
to the device
> 15 }
>
> Bye Markus
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD =
SPLUNK!
> =
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D103432&bid=3D230486&dat=3D=
121642
> _______________________________________________
> Ntci-users mailing list
> Ntc...@li...
> https://lists.sourceforge.net/lists/listinfo/ntci-users
>
>
> =20
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log =
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=103432&bid#0486&dat=121642
_______________________________________________
Ntci-users mailing list
Ntc...@li...
https://lists.sourceforge.net/lists/listinfo/ntci-users
|