Perl script to issue IOS commands and save to local files from a given IP list

Discussion in 'Cisco' started by aung.naingoo, May 5, 2007.

  1. aung.naingoo

    aung.naingoo Guest

    Can anybody point to a perl script that can issue IOS commands and
    save to local files from a given IP list. I am currently using one of
    the perl scripts and it doesn't have an error checking. So, whenever
    the remote device from a given IP list is not respond, it stop. It
    would be good to have a script that can skip the non-responding IP,
    log the non-responding IPs, and continue with the rest of the IPs in
    the given list.

    Below is the script that I am currently using:

    #!/usr/bin/perl -w
    use Net::Telnet::Cisco;
    @devices = `cat my_devices_ip_list.txt`;
    foreach my $device (@devices) {
    chomp($device);
    my $session = Net::Telnet::Cisco->new(Host => $device);
    $session->login('my_user_name','my_password');
    $session->enable("my_enable_password");
    @ver = $session->cmd("sh ver");
    open LOG, "> $device.conf";
    select LOG;
    print @ver;
    close LOG;
    }
     
    aung.naingoo, May 5, 2007
    #1
    1. Advertisements

  2. Phillip Remaker, May 9, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.