[rancid] Adding IOS Commands to Rancid 3.1

Chip Pleasants wpleasants at gmail.com
Fri Apr 10 13:39:50 UTC 2015

I'm making some strides, but still not getting it to work.  I made the
changes discussed in the previous message except creating a new perl
module. It looks like it issues the command from the output below, but
nothing shows up in the file.  I'm expecting things starting with !Difff.
Does there need to be more logic for the output?

[rancid at server02 ~]$ cat /etc/rancid/rancid.types.conf
# Custom Commands for Cisco IOS devices
cisco-ios;script;rancid -t cisco-ios
cisco-ios;command;ios::ShowArchiveConfigDiff;show archive config diff

[rancid at server02 ~]$ cat /usr/share/perl5/vendor_perl/rancid/ios.pm
# This routine parses "ShowArchiveConfigDiff"
sub ShowArchiveConfigDiff {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowArchiveConfigDiff: $_" if ($debug);

    while (<$INPUT>) {
        last if (/^$prompt/);
        next if (/^(\s*|\s*$cmd\s*)$/);
        next if (/^\s+\^$/);
        return(1) if (/Line has invalid autocommand /);
        return(1) if (/(invalid (input|command) detected|type help or )/i);

        if (/current template is/) {
            ProcessHistory("COMMENTS","keysort","IO","!Diff: $_");

[rancid at server02 ~]$ /usr/libexec/rancid/rancid -t cisco-ios -d
loadtype: device type cisco-ios
loadtype: found device type cisco-ios in /etc/rancid/rancid.types.conf
executing clogin -t 90 -c"show archive config diff;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 switch detail;show sdm prefer;show system
mtu;show debug;show shun;more system:running-config;show running-config
view full;show running-config;write term" router.inc.net
HIT COMMAND:router#show archive config diff
    In ShowArchiveConfigDiff: router#show archive config diff

router#sh archive config differences
!Contextual Config Diffs:
crypto pki certificate chain TP-self-signed-1439941376
 +certificate self-signed 01 nvram:router#7474.cer
+ntp clock-period 36029336
crypto pki certificate chain TP-self-signed-1439941376
 -certificate self-signed 01
  -308202BE 30820227 A0030201 02020101 300D0609 2A864886 F70D0101 04050030
  -63312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
  -69666963 6174652D 31343339 39343133 37363130 302E0609 2A864886 F70D0109
  -02162143 4D48312D 49444631 302D4130 312E646F 6D61696E 30312E76 63647369
  -2E6E6574 301E170D 39333033 30313030 30323439 5A170D32 30303130 31303030
  -3030305A 3063312F 302D0603 55040313 26494F53 2D53656C 662D5369 676E6564
  -2D436572 74696669 63617465 2D313433 39393431 33373631 30302E06 092A8648
  -86F70D01 09021621 434D4831 2D494446 31302D41 30312E64 6F6D6169 6E30312E
  -76636473 692E6E65 7430819F 300D0609 2A864886 F70D0101 01050003 818D0030
  -81890281 8100A2CC 9B49301D 797D5BC5 97A5358C B59D932E 1435D3C3 C03B3E7B
  -BA351D78 1F3705DA D3C91C08 C47BD867 3047AB49 A31E5EC8 5B449984 8D78A2C0
  -E7BBC91E B286EBAB C2E105DB 1E1CF2AE BEC48BD6 4B1A247F DB6A1CD8 DEBE1505
  -0F5DE00D C28D5A49 D6F9D076 120E14EC FDDEF22A 3173AF94 BC3CE14D 9B1160EF
  -9098D071 CFE50203 010001A3 8181307F 300F0603 551D1301 01FF0405 30030101
  -FF302C06 03551D11 04253023 8221434D 48312D49 44463130 2D413031 2E646F6D
  -61696E30 312E7663 6473692E 6E657430 1F060355 1D230418 30168014 9B3F993D
  -E8086DD2 CC598472 04B43B3A D2309645 301D0603 551D0E04 1604149B 3F993DE8
  -086DD2CC 59847204 B43B3AD2 30964530 0D06092A 864886F7 0D010104 05000381
  -81004365 4AC25D08 C9AD3506 F146FBFA B51487AE EB8BBDD6 C5E18571 1320D367
  -FE26C7C5 402535FD 80A267E6 1AAF099A D034CED7 5EDA462C FC465FB3 CD02B792
  -72455D7D A1440B68 54AE7AB9 F5E5B42F 339D793B B315645C C29FE3A7 EA5EB2D9
  -76DD8DF5 C0A0F984 864451CB 867F2869 73493329 1CACE7B4 6313183C CB38B6DC
-ntp clock-period 36029341



On Thu, Apr 9, 2015 at 11:13 AM, heasley <heas at shrubbery.net> wrote:

> Wed, Apr 08, 2015 at 07:58:03PM -0400, Chip Pleasants:
> > Thank you very much for assisting. Was I right in modifying the ios.pm?
> By
> you can do that; again it will be overwritten by the next installation.
> you can create a separate pm for this command and include it with another
> module line - i cant recall if i added that in 3.1 or 3.2.
> > definition do you mean something like below? I'm assuming if I wanted to
> > use this definition I'd have to change devices in router.db that I wanted
> > to run this command on?  If it does work this way I suppose I'll want to
> > add all the other commands normally baked in the cisco definition?
> yes, yes, yes.
> >
> > # Custom Commands for Cisco IOS devices
> > cisco-custom;script;rancid -t cisco
> > cisco-custom;login;clogin
> > cisco-custom;module;ios
> > cisco-custom;inloop;ios::inloop
> > cisco-custom;command;ios::ShowArchiveConfigDiff;show archive config diff
> cisco-custom;module;ios
> cisco-custom;module;myios
> cisco-custom;command;ios::ShowVersion;show version
> cisco-custom;command;ios::etc etc
> cisco-custom;command;myios::ShowArchiveConfigDiff;show archive config diff
> or if you wanted ShowVersion to do something different; you could create
> your own:
> cisco-custom;module;myios
> cisco-custom;command;myios::ShowVersion;show version
> cisco-custom;command;ios::etc etc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20150410/7474071a/attachment.html>

More information about the Rancid-discuss mailing list