|
From: DonKiShoot <don...@wa...> - 2006-01-31 11:14:38
|
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=20
: 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=20
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-u=
p
> 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 a=
t 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 d=
evice
> Password =3D> $password);
> 8 @output =3D $conn->getConfig(); # Put the config in an array
> 9 $outfile =3D ">" . $host . "-confg"; # create a filename cal=
led ">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 fil=
e
> 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=
=3D121642
> _______________________________________________
> Ntci-users mailing list
> Ntc...@li...
> https://lists.sourceforge.net/lists/listinfo/ntci-users
>
>
> =20
|