[rancid] How to extend Rancid. Basics.
Alan McKinnon
alan.mckinnon at gmail.com
Sat Aug 1 12:12:19 UTC 2015
On 01/08/2015 13:30, Alex DEKKER wrote:
> On 01/08/15 10:48, jm+rancid at roth.lu wrote:
>> Hi there,
>>
>> I wanted to extend Rancid with a script to monitor some Checkpoint
>> Gaia firewalls.
>
> Obviously not wanting to hijack the thread or anything, I have a related
> question: If one wanted to add a new device type, what is the best
> existing device type to use as a starting point?
It's not that simple, there is no "master reference device type" so to
speak.
Here's how rancid works:
For each device, a process is fired off that will return a text file.
This file is checked into CVS. If it has changed, CVS tracks the change.
If it has not changed, CVS does nothing (the usual CVS behaviour). You
will notice that the only thing rancid wants back from this script is a
text file, which could in fact be anything. You could return a Mickey
Mouse cartoon screenplay and rancid will dutifully book it into CVS for
you, complete with a diff. That this file is of no real use to you is
irrelevant, rancid will still track it,
The oldest and still most used of the various parsers is the one for
Cisco IOS and there is a persistent view that this script and it's
associated clogin is somehow a canonical script or a master model.
Nothing could be further from the truth - it is nothing more than a
script the original author wrote that reliably gets the job done. If you
need to track a different device type that mostly resembles IOS[1], then
start with that one. Note that you don't have to, it's just a reasonable
way to get started and get a result. It's also the most generic script
of the lot because it has to deal with everything Cisco has done for
years - the others all tend to be much more device-specific.
I wrote such a parser for AudioCodes once, the IOS script was a decent
starting point. To do the same for my NetGear DSL modem at home, using
the same starting point would be totally pointless, it is just so different.
To help you find a starting point, you would need to say what device it
is, clearly define exactly how one logs into it, what commands must be
run and what the output looks like. This last is most important, the
bulk of getting rancid to behave properly is getting the regexes right
that process the output text.
So the question you need to answer is how similar to IOS is your device?
[1] By "resemble", I mean log in with telnet or ssh, possibly enable,
issue some terminal setup commands, issue a bunch of get config commands
then trawl through it all with heaps of magic regexes. The exact list of
commands is completely irrelevant, they are stored in a perl array in
the script itself and you should change the list to suit what your
device needs. The list need not share anything in common with IOS! It
does need to do telnet/ssh and give EOL similarly.
--
Alan McKinnon
alan.mckinnon at gmail.com
More information about the Rancid-discuss
mailing list