|
From: Markus Z. <mar...@ya...> - 2006-01-31 09:57:53
|
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 = "username"; # the username to use when logging in
3 $password = "password"; # the matching password
4 @hosts = 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 = Net::Telnet::Cisco::IOS->new(HOST => $host); # connect to the host
7 $conn->login( Name => $username, # Log into the device
Password => $password);
8 @output = $conn->getConfig(); # Put the config in an array
9 $outfile = ">" . $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
|