Adding a new RANCID device class

The RANCID system is used by many network service providers to backup and audit their network device configurations. It supports many device vendors (Cisco, Juniper, etc) but you might run into a vendor which is not supported. Adding a new device class (in other words, a vendor) to RANCID is not difficult.

Starting with the basics, we need a script which will connect to the device and emit the output of any commands you want to run there. You could clone and modify one of the existing RANCID scripts such as /usr/bin/jrancid or write your own. Either way, when run it needs to:

Accept as its final command line argument the name of the device

Save output to a file in the current working directory, called <devicename>.new

Install this script into /usr/bin/... with a suitable name.

The next step is to make RANCID aware of this new class of device. Load up the file /usr/bin/rancid-fe in your editor, and scroll down to see the lookup table for all device classes. Add an entry in there which has a “friendly name” as the key on the left, and the name of your script (created in the previous step) as the value on the right.

That’s it, you can now use this device class (the “friendly name”) in your router.db files and RANCID will execute your script to retrieve the configuration. You aren’t limited only to devices with a CLI now, of course. Your script could retrieve configuration (or any other text data) from any source by any means and save it to the .new file.