From: <m.z...@t-...> - 2006-01-31 17:27:08
|
Hello, thanks for help. Everything is ok. I have a no name router and i write with the vi in the IOS.pm term len =20= 0 and it works not only for cisco. Thanks all Bye Markus Am 31.01.2006 um 16:41 schrieb Conaway, Aaron: > DonKiShoot is right. > > The pagination problems ( the "--- More ---" showing up ) is solved by = =20 > the module itself. When you log into the device, the first thing the =20= > module does is send a "terminal length 0". This solves a lot of =20 > problems in converting pages of output to arrays in Perl. > > The method "getConfig()" actually does a "show running-config" and =20 > stores the output in the return variable. The sample script then =20 > takes the output and writes it to a file using the Perl file handling =20= > 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... =20 > [mailto:ntc...@li...] On Behalf Of =20 > 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 =20 > router > > For your "more" problem, when you logged on cisco first use "terminal > length 0" but i think that it is automatically does in the perl module > fonctions. > Next question, i think you want to know if $conn->getConfig(); copy > 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 =20= > file > : cisco....ios.pm for knowing if it is the running or startup that is =20= > get. > If you want to put on a tftp server, find a function that do it or put = =20 > 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 > 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 =20 >> 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 =20 >> 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 = =20 >> at a time >> 6 my $conn =3D Net::Telnet::Cisco::IOS->new(HOST =3D> $host); = # =20 >> connect to the host >> 7 $conn->login( Name =3D> $username, # Log into the = =20 >> device >> Password =3D> $password); >> 8 @output =3D $conn->getConfig(); # Put the config in an = array >> 9 $outfile =3D ">" . $host . "-confg"; # create a filename =20= >> called ">host-confg" >> 10 open ( OUTFILE, $outfile ); # open a file for =20 >> writing >> 11 print "Writing $host to file\n"; # write a status = message >> 12 print ( OUTFILE @output ); # print the config to =20= >> file >> 13 close OUTFILE; # close the file >> 14 $conn->close; # close the connection =20= >> to the device >> 15 } >> >> Bye Markus >> >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through =20= >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD =20 >> SPLUNK! >> http://sel.as-us.falkag.net/sel?=20 >> cmd=3Dlnk&kid=3D103432&bid=3D230486&dat=3D121642 >> _______________________________________________ >> Ntci-users mailing list >> Ntc...@li... >> https://lists.sourceforge.net/lists/listinfo/ntci-users >> >> >> > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log = =20 > 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 > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log = =20 > 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=103432&bid#0486&dat=121642= > _______________________________________________ > Ntci-users mailing list > Ntc...@li... > https://lists.sourceforge.net/lists/listinfo/ntci-users > |