Search 85,581 posts contributed by 43,255 members or post a topic.

Already Joined? Sign in

Featured Download

SQL Server 2005 Database - WMI Only

This template assesses the status and performance of a Microsoft SQL Server 2005 database. Prerequisites: SQL Authentication access to target server for...

Read more »

Uploaded by: gwgrimes
Date Created: Sun, Aug 16 2009
Downloads: 21
Rating:

points legend_

Icon Point Totals
2,000+
1000 - 1,999
400 - 999
100 - 399
1-99

 

Automated router/switch tftp backups when config changes

Here's a quick and dirty perl script that backs up your cisco ios router and switch configs via tftp when ever someone makes a config change. You need to have activestate perl install and Net::Telnet::Cisco and Timestamp::Simple perl mods.

  1. You need to make sure your devices are sending syslog message to orion.
  2. Create an alert/filter rule in syslog view that looks for messages containing *CONFIG*
  3. Add an alert action that executes an external app.  ie "C:\Perl\bin\perl.exe" D:\scripts\save_router_config.pl ${Hostname}
  4. Copy perl script below. Make necessary changes.  Our routers require usernames and passwords to login.  If you routers only require password, the username variable is ignored.

#!/usr/bin/perl

use Net::Telnet::Cisco;
use Timestamp::Simple qw(stamp);


my $device = "$ARGV[0]";
my $user = "username";
my $pass = "password";
my $enable_pass = "enable_password";
my $backup_host = 'tftp_server';
my $numArgs = $#ARGV + 1;
my $dt = stamp;


if ($numArgs != 1 )
{
    print "usage: save_router_config.pl device name\n";
    exit;
}

my $session = Net::Telnet::Cisco->new(Host => $device );
$session->login($user, $pass);

my @output = "";

if ($session->enable($enable_pass) )
{
    @output = $session->cmd('show privilege');
    print "My privileges: @output";
}
else
{
    warn "Can't enable: " . $session->errmsg;
}

$session->cmd("copy run tftp://$backup_host/configs/$device/$dt-$device.cfg\n\n\n");

$session->close;

Product Details
Uploaded by: jkeife
Date Created: 07/23/2008
Downloads: 59
Rating:
Comments: 0
File Size: 779 B
Like this content?
Do something with it!

 

© 2003 - 2010 SolarWinds, Inc. All Rights Reserved.

Who is SolarWinds?

SolarWinds is rewriting the rules for how companies manage their networks. Guided by a global community of network engineers, SolarWinds develops simple and powerful network management software and network monitoring software for networks of all sizes. SolarWinds also offers a network certification program to become a SolarWinds Certified Professional (SCP).

What is thwack?

thwack, SolarWinds online community site, was designed by network engineers, for network engineers. thwack is a vibrant, growing community of more than 30,000 IT pros who share a passion for technology.

Explore Resources, Answers, Templates, and Advice

Download Free Networking Tools


Learn More About SolarWinds Products