[rancid] Re: show cdp neighbor

Andrew Fort afort at choqolat.org
Mon Nov 6 05:58:00 UTC 2006


On 11/3/06, Hopper, Faron  W. <faron.hopper at capgemini.com> wrote:
>
> I have need of having a record of the show cdp neighbor command in
> rancid/cvs.  Is it as simple as adding
>
> @commandtable = (
>
>         {'show cdp neighbor detail'           => 'ShowCdpDetail'},
>
> Or is there more work to do? (* Note* I am not what you would call a
> programmer…I thought I was doing pretty good to find the file to update…*)

Aaron, you'll also need to add a subroutine named 'ShowCdpDetail' that
will parse the output of the 'show cdp nei detail' command to your
liking.  See the other parser routines in the relevant *rancid script
for more detail.  Regarding the arguments for ProcessHistory, you can
leave them all blank, and it will place the new command output at one
end of the comments (towards the end, if I recall correctly).  By
changing the argument that is usually of the form '[A-Z][0-9]' will
move the output around within the comments section.  Remember to
prefix the line with a '!' in the processhistory call, so that the
command output will appear as a comment.

You will also need to use regular expressions to match the necessary
fields you care about in the 'show cdp nei detail' output, as the
detail includes the hold-time, which will change each time you run the
command (causing a diff each time rancid runs, a situation you'd
rather avoid).

-andrew



More information about the Rancid-discuss mailing list