01-05-2005 05:53 PM - edited 02-20-2020 11:50 PM
Hi,
Altho there are several theads dealing with auto (sheduled or due to config changes) backups they all involve Cisco management tools.
Does anyone know if these can be done using Linux preferably or even Win2k via tftp or anything else.
Thanks in advance
Miek
Solved! Go to Solution.
01-11-2005 10:42 AM
You can use the EXPECT application, it is available for both Linux and Windows, and the scrips already exist.
01-11-2005 10:42 AM
You can use the EXPECT application, it is available for both Linux and Windows, and the scrips already exist.
01-12-2005 09:17 PM
Thanks for that - looks interesting.
01-14-2005 06:05 AM
Windows solution is Kiwi CatTools. The freeware version lets you do 5 hosts (scheduled backups but not due to configuration changes).
04-04-2005 07:40 AM
where can I download expect from?
Thanks
01-20-2005 05:45 PM
Here is a script that that someone at else here improved. It uses freeware script and perl. The scripts needs to have HPOV and NNM. There are implied Perllibraries as well. You may look at the perl script that ciscoworks uses as well.
Here is the script for you to get ideas from:
#! /usr/local/bin/perl
use lib '/apps/utils/bin';
use BER '0.58';
use SNMP_Session '0.58';
use Sys::Hostname;
open (TOPODUMP, "/opt/OV/bin/ovtopodump -f Routers |") or die "cant get topodump
";
while (
@router = split;
$flag = 1 if ($router[0] eq "NODES:");
next if ! $flag;
next if ($router[2] eq "");
$router[2] =~ s/.changetodomain.com$//i;
print "$router[2]\n";
$destFile = '/tftpboot/' . $router[2] . '-confg0';
$destFileTest = '/tftpboot/' . $router[2] . '-confg';
if (! -f $destFileTeste){
`echo test >$destFileTest`;
`/usr/bin/chmod 666 $destFileTest`;
}
if (! -f $destFile){
`echo test >$destFile`;
`/usr/bin/chmod 666 $destFile`;
`echo test >$destFileTest`;
`/usr/bin/chmod 666 $destFileTest`;
system ("/opt/OV/bin/snmpset -t 50 -c \writecommunitystring -r5 $router[2] .
1.3.6.1.4.1.9.2.1.55.131.219.234.134 octetstring $router[2]-confg0");
print"/opt/OV/bin/snmpset -t 50 -c \writecommunitystring -r5 $router[2] .1.3
.6.1.4.1.9.2.1.55.131.219.234.134 octetstring $router[2]-confg0\n";
}else
{
system ("/opt/OV/bin/snmpset -t 50 -c \writecommunitystring -r5 $router[2] .
1.3.6.1.4.1.9.2.1.55.131.219.234.134 octetstring $router[2]-confg");
print "/opt/OV/bin/snmpset -t 50 -c \writecommunitystring -r5 $router[2] .1.
3.6.1.4.1.9.2.1.55.131.219.234.134 octetstring $router[2]-confg\n";
my $diff = `diff $destFile $destFileTest`;
if ($diff ne ""){
&rotate($destFileTest, $router[2]);
}else{
print "xx cp $destFileTest $destFile\n";
system("cp $destFileTest $destFile");
}
}
}
sub rotate {
my $file = shift;
my $router = shift;
&sendtrap($router);
my $count = 10;
while ($count > 0){
my $fromFile = $file . ($count - 1);
my $toFile = $file . $count;
if ( -f $fromFile){
print "aa cp $fromFile $toFile\n";
system("cp $fromFile $toFile");
}
$count--;
}
my $fromFile = $file;
my $toFile = $file . $count;
if ( -f $fromFile){
print "zz cp $fromFile $toFile\n";
system("cp $fromFile $toFile");
}
}
sub sendtrap{
$hostname = shift;
my $myIpAddress = gethostbyname($hostname);
{ @bytes = unpack("C4", $myIpAddress);
shift @bytes while @bytes && $bytes[0] == 0;}
my $trap_receiver = "127.0.0.1";
my $trap_community = "publiccommunity string";
my $trap_session = SNMP_Session->open ($trap_receiver, $trap_community, 162);
my $start_time = time;
my $genericTrap = 6; # Enterprise Specific
my $specificTrap = 0;
my $upTime = 0;
my @myOID = ( 1,3,6,1,3,5000,3,1 );
push @VarBinds, ([encode_oid (@myOID), encode_string ($hostname)]);
push @VarBinds, ([encode_oid (@myOID), encode_string ("The configuration on $hos
tname has changed")]);
$trap_session->trap_request_send (encode_oid (@myOID),
encode_ip_address ($myIpAddress),
encode_int ($genericTrap),
encode_int ($specificTrap),
encode_timeticks ($upTime),
@VarBinds
) ;
}
exit;
01-20-2005 07:35 PM
Thanks,
Ive been getting a few resonses to my question so a few avenues to explore. I have handed the script over to a collegue who knows far more about Perl than I do, but we do have HP-OV and NNM so could prove very useful.
Will probably now need to ask a question re:
VPN concentrators backup and up/down monitoring of LAN-LAN IPsec tunnels. But that need it's own thread probably.
Thanks again
01-21-2005 05:59 PM
Glad to be of help on my own behalf and my collogues who contributed to the script.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide