Commit c346fd07 authored by Dan Reading's avatar Dan Reading
Browse files

Extend to backup config files from procurve switches

parent 318c2fa4
......@@ -28,6 +28,8 @@ my $GRAB = "@prefix@/sbin/grabswitchconfig";
use lib '@prefix@/lib';
use libdb;
use lib '@prefix@/lib/snmpit_test';
use snmpit_lib;
use strict;
use English;
......@@ -60,10 +62,23 @@ my $datestr = "$year-$mon-$mday";
#
unlink $TMPFILE;
foreach my $switch (@ARGV) {
system "$GRAB $switch $TMPFILE"
and die "Unable to grab config for $switch\n";
system "mv $TMPFILE $BACKUPDIR/$switch-$datestr\n"
and die "Unable to move config file to $BACKUPDIR/$switch-$datestr\n";
#
# Is it a Cisco or maybe an HP
my $type = getDeviceType($switch);
if ($type !~ /cisco/ && $type !~ /catalyst/ && $type !~ /hp/ ) {
die " *** $0:\n" .
" only Cisco and Procurves supported NOT (type $type)\n";
}
if ($type =~ /cisco/ || $type =~ /catalyst/ ) {
system "$GRAB $switch $TMPFILE"
and die "Unable to grab config for $switch\n";
system "mv $TMPFILE $BACKUPDIR/$switch-$datestr\n"
and die "Unable to move config file to $BACKUPDIR/$switch-$datestr\n";
}
if ($type =~ /hp/ ) {
system "scp $switch:/cfg/running-config $BACKUPDIR/$switch-$datestr\n"
and die "Unable to grab and save config for $switch\n"
}
}
exit 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment