[rancid] Need help with fixing custom Rancid script (IBM flex switches)

Auzzik auzzik at gmail.com
Tue Feb 5 05:55:42 UTC 2013


Good day,

I am trying to backup configs from IBM flex switches.
They have different commands like: /info/l2/dump or /cfg/dump.

I made a copy of 'flogin' and 'francid' files: ibmlogin and ibmrancid.

I added a new line into /usr/bin/rancid-fe to specify a new device class 
'ibm'.

The file has now:

%vendortable = (
     'agm'               => 'agmrancid',
     'alteon'            => 'arancid',
     'arista'            => 'arrancid',
     'avocent'           => 'avorancid',
     'baynet'            => 'brancid',
     'cat5'              => 'cat5rancid',
     'cisco'             => 'rancid',
     'cisco-nx'          => 'nxrancid',
     'cisco-xr'          => 'xrrancid',
     'css'               => 'cssrancid',
     'enterasys'         => 'rivrancid',
     'erx'               => 'jerancid',
     'extreme'           => 'xrancid',
     'ezt3'              => 'erancid',
     'f5'                => 'f5rancid',
     'force10'           => 'f10rancid',
     'fortigate'         => 'fnrancid',
     'foundry'           => 'francid',
     'hitachi'           => 'htrancid',
     'hp'                => 'hrancid',
# ibm was added manually
     'ibm'               => 'ibmrancid',
     'juniper'           => 'jrancid',
     'mrtd'              => 'mrancid',
     'mrv'               => 'mrvrancid',
     'netopia'           => 'trancid',
     'netscaler'         => 'nsrancid',
     'netscreen'         => 'nrancid',
     'procket'           => 'prancid',
     'redback'           => 'rrancid',
     'riverstone'        => 'rivrancid',
     'smc'               => 'srancid',
     'tnt'               => 'tntrancid',
     'zebra'             => 'zrancid'
);

I specified device names in .cloginrc:
add     user            sw* rancid
add     password        sw* {www.rancid.net}
add     method          sw* ssh
add     autoenable      sw* 1

I added device into router.db:
sw1.ibm:ibm:up

In ibmrancid I added:

sub WriteTerm {
....
# custom added lines
         if (/^Press q to quit, any other key to continue/) {
                 next;
         }
         if (/script end*/) {
             $found_end = 1;
             return(1);
         }
     }
     return(0);
}

So, when I do '/usr/libexec/rancid/ibmrancid -c "/cfg/dump" sw1.ibm' it 
works fine.
When I try to run 'racnid-run -r sw1.ibm" if fails.

To troubleshoot I tried to run:

/usr/libexec/rancid/ibmrancid -d sw1.ibm

executing /usr/libexec/rancid/ibmlogin -t 30 -c"/cfg/dump" sw1.ibm
PROMPT MATCH: >> sw1.aus - Main#
HIT COMMAND:>> sw1.aus - Main# /cfg/dump
     In WriteTerm: >> sw1.aus - Main# /cfg/dump
sw1.ibm /usr/libexec/rancid/ibmlogin error: Error: TIMEOUT reached
sw1.ibm /usr/libexec/rancid/ibmlogin error: Error: TIMEOUT reached
sw1.ibm: End of run not found 0 || 1
sw1.ibm: End of run not found
results: found END string
sw1.ibm: End of run not found
script end  /**** DO NOT EDIT THIS LINE!

Also, ibmrancid has the following commands to run:

@commandtable = (
#       {'/info/sys/general'    => 'WriteTerm'},
#       {'/info/sys/chassis'    => 'WriteTerm'},
#       {'/info/l2/vlan'        => 'WriteTerm'},
#       {'/info/l2/failovr/trigger'     => 'WriteTerm'},
#       {'/info/transcvr'       => 'WriteTerm'},
         {'/cfg/dump'    => 'WriteTerm'},
);


Please help me find out what's wrong. Looks like it tries to get run 
command but fails.

The outpuif of /cfg/dump looks like (the end):

/c/sys/syslog
     console dis
/c/l2/lldp
     on
/c/sys/ntp
     on
/
script end  /**** DO NOT EDIT THIS LINE!


Thanks.
Auzzik


More information about the Rancid-discuss mailing list