[rancid] How to config the output of a command to record in a file.

Lee ler762 at gmail.com
Tue Jan 24 18:16:13 UTC 2017


On 1/24/17, Harlei Lima <harlei.jlima at gmail.com> wrote:
> Dear colleagues.
>
> I'm starting with Rancid and I did  my frist basic config, but I'm not can
> or I'm not understanding how to config  the output of a command to record
> at file. For exemple a .clogin -c "show version" and record any file.

If you want to save the output from 'clogin -c ...' here's a snippet
from one of my scripts:

######### commands to run on every switch:
# show interface trunk
#   to get all the trunk ports
#   but none of the ports that make up a port channel on IOS are
listed, so have to do
#      "show etherchannel summary" to completely populate the interface list
#
# show etherchannel summary
#   to get the mapping of port-channels => physical ports on IOS switches
#   the output seems to ignore "term width" so port channels of 4 or more ports
#     are on separate lines
#
# show cdp neighbor
#   to find out what is on the other side of the link

clogin -c "show interface trunk;show etherchannel summary;show cdp
neighbor" $DEVLIST | tr -d "\r" |\
 awk '/show interface trunk/ , /exit/'   > $DATAFILE

### NOTE: the above removes trailing carriage returns as well as login
banner, motd, etc.
###       please try to do the same if you're creating the file yourself

fi
###################################################################


Regards,
Lee



More information about the Rancid-discuss mailing list