[rancid] Which command subset is actually run?
alan.mckinnon at gmail.com
Wed Oct 16 13:01:45 UTC 2013
It's in the man pages, but you have to read all of them to get the full
picture. Here's the somewhat detailed overview (followed by the method
on how to get it to do what you want it to do).
* The controlling script is rancid-run. This reads rancid.conf to set up
the environment and read the list of groups etc.
* rancid-run launches control_rancid for each group in turn
* control_rancid launches par (a helper script that deals with the
drudge work of running many instances in parallel)
Now the real meat of it starts:
* par launches rancid-fe which looks up the device details in router.db.
The device type is the key in %vendortable and the value is the
specific script to run.
* The specific script for the device type launches *login to login and
fetch the config, then process it. Each script can do this job in
whatever way it chooses, but most simply adapt the original "rancid"
script. The commands to be run are listed in @commandtable which is
an array of hashes:
the key is the command to be run
the value is a perl sub to process the output
That's the description of how the bits fit together. It's well-thought
out and each bit makes sense, as well as do one very specific part of
the process. It works extremely well (other than the actual command to
be run are hard coded and somewhat inflexible).
In your case, "show idprom backplane" is not supported by the device and
you will get an invalid command error. Rancid should detect this, exit
the sub and add nothing extra to the output file. This is by design, it
is perfectly correct and takes maybe 200 ms extra - not worth worrying
about. It happens a *lot* with all the various hadwares Cisco have made
over the years, this is why rancid tries to run every imaginable command
that could be useful, and only deal with those that worked.
If you want to do more and customize it, you have to get your hands
dirty by copying the rancid script and tweaking it. Something like this:
1. copy rancid to asarancid
2. remove and delete entries from @commandtable to suit your needs
2a. if none of the existing subs do what you need with a specific
command, then write a new sub and edit the entry in @commandtable
3. add a new entry to rancid-fe for your new device type
4. edit router.db changing the type for the relevant devices
 I've been forced to do this a few times myself. Recent IOS is a very
different beast to old IOS, and GSRs running IOS really don't like
running 4 variations of "show run" rapidly with 3000+ interfaces to deal
with. And then XR, XE and NX are similar enough to make you think it
works well and just different enough to leave lots of useful info out of
the output file. Lucky making changes is very simple.
On 16/10/2013 09:27, Paweł Rzepa wrote:
> I'm trying to introduce rancid to my environment. Before I run it into
> prod, I try to understand it.
> I want to use rancid to get config from Cisco ASA. I was able to get
> configuration, but don't understand which commands and *why *are
> actually run by rancid.
> I know that for this type of device 'rancid' script is run. I've looked
> at commandtable variable. But the list is not valid for ASA. E.g. ASA
> does not support command 'show idprom backplane'.
> When I run 'rancid -d 10.1.1.1' I get the output pasted below. So how
> can i verify/modify what commands are actually run by rancid?
> #rancid -d 10.1.1.1
> executing clogin -t 90 -c"show version;show redundancy secondary;show
> idprom backplane;show install active;show env all;show rsp
> chassis-info;show gsr chassis;show diag chassis-info;show boot;show
> bootvar;show variables boot;show flash;dir /all nvram:;dir /all
> bootflash:;dir /all slot0:;dir /all disk0:;dir /all slot1:;dir /all
> disk1:;dir /all slot2:;dir /all disk2:;dir /all harddisk:;dir /all
> harddiska:;dir /all harddiskb:;dir /all sup-bootdisk:;dir /all
> sup-bootflash:;dir /all sup-microcode:;dir /all slavenvram:;dir /all
> slavebootflash:;dir /all slaveslot0:;dir /all slavedisk0:;dir /all
> slaveslot1:;dir /all slavedisk1:;dir /all slaveslot2:;dir /all
> slavedisk2:;dir /all slavesup-bootflash:;dir /all sec-nvram:;dir /all
> sec-bootflash:;dir /all sec-slot0:;dir /all sec-disk0:;dir /all
> sec-slot1:;dir /all sec-disk1:;dir /all sec-slot2:;dir /all
> sec-disk2:;show controllers;show controllers cbus;show diagbus;show
> diag;show capture;show module;show spe version;show c7200;show inventory
> raw;show vtp status;show vlan;show vlan-switch;show debug;show shun;more
> system:running-config;show running-config view full;show
> running-config;write term" 10.1.1.1
> PROMPT MATCH: fw-asa#
> HIT COMMAND:fw-asa# show version
> In ShowVersion: fw-asa# show version
> HIT COMMAND:fw-asa# show redundancy secondary
> In ShowRedundancy: fw-asa# show redundancy secondary
> HIT COMMAND:fw-asa# show idprom backplane
> In ShowIDprom: fw-asa# show idprom backplane
> HIT COMMAND:fw-asa# show install active
> In ShowInstallActive: fw-asa# show install active
> HIT COMMAND:fw-asa# show env all
> In ShowEnv: fw-asa# show env all
> HIT COMMAND:fw-asa# show rsp chassis-info
> In ShowRSP: fw-asa# show rsp chassis-info
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
alan.mckinnon at gmail.com
More information about the Rancid-discuss