[rancid] Cisco GSS 4492 Config Fetch...

Chris Weakland chris.weakland at gmail.com
Wed Mar 28 18:48:51 UTC 2012


I had some time today and added a routine into my rancid config to gather
my Cisco GSS's running config and gslb config. Here is how you add it:

Edit file: rancid-fe

In the %vendortable section near the top of the file add the following:

    'gss'               => 'gssrancid',

Here is some context to help you:

    'foundry'           => 'francid',
    'gss'               => 'gssrancid',
    'hitachi'           => 'htrancid',

In the same directory as your rancid-fe file, you have a file called
"rancid". Copy this file to a new file named gssrancid.

Edit file: gssrancid

Add the follwing code:

# This routine parses "show gslb-config"
sub ShowGslbConfig {
    print STDERR "    In ShowGslbConfig: $_" if ($debug);
    ProcessHistory("","","","!Begin GSLB Config\n!\n");
    while (<INPUT>) {
        tr/\015//d;
        last if (/^$prompt/);
        next if (/^(\s*|\s*$cmd\s*)$/);
        return(1) if /^\s*\^\s*$/;
        return(1) if /Line has invalid autocommand /;
        return(1) if /(Invalid input detected|Type help or )/;
        return(-1) if (/command authorization failed/i);
        # the pager can not be disabled per-session on the PIX
        if (/^(<-+ More -+>)/) {
            my($len) = length($1);
            s/^$1\s{$len}//;
        }

        ProcessHistory("","","","$_");
    }
    ProcessHistory("","","","\n!\n!End GSLB Config\n!\n");
    return(0);
}

I added the above section right above this line:

# This routine processes a "write term"
sub WriteTerm {


Lastly, in the commandtable section add the following line:

        {'show gslb-config'             => 'ShowGslbConfig'},

Again here is some context to guide you:

#       {'show debug'                   => 'ShowDebug'},
        {'show gslb-config'             => 'ShowGslbConfig'},
        {'show running-config'          => 'WriteTerm'},

Optionally, you can rem out the `show debug` as it does not work at all on
the GSS and it makes your rancid config look ugly.

Here is a diff of my gssrancid vs rancid:

~/bin$ diff gssrancid rancid
1525,1548d1524
< # This routine parses "show gslb-config"
< sub ShowGslbConfig {
<     print STDERR "    In ShowGslbConfig: $_" if ($debug);
<     ProcessHistory("","","","!Begin GSLB Config\n!\n");
<     while (<INPUT>) {
<         tr/\015//d;
<         last if (/^$prompt/);
<         next if (/^(\s*|\s*$cmd\s*)$/);
<         return(1) if /^\s*\^\s*$/;
<         return(1) if /Line has invalid autocommand /;
<         return(1) if /(Invalid input detected|Type help or )/;
<         return(-1) if (/command authorization failed/i);
<         # the pager can not be disabled per-session on the PIX
<         if (/^(<-+ More -+>)/) {
<             my($len) = length($1);
<             s/^$1\s{$len}//;
<         }
<
<       ProcessHistory("","","","$_");
<     }
<     ProcessHistory("","","","\n!\n!End GSLB Config\n!\n");
<     return(0);
< }
<
1946,1947c1922,1923
< #     {'show debug'                   => 'ShowDebug'},
<         {'show gslb-config'             => 'ShowGslbConfig'},
---
>       {'show debug'                   => 'ShowDebug'},
>       {'more system:running-config'   => 'WriteTerm'},        # ASA/PIX


Enjoy,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20120328/954ffaae/attachment.html>


More information about the Rancid-discuss mailing list