[rancid] Re: Adding "show interfaces status" to rancid

Per Carlson pelle at hemmop.com
Fri May 28 07:46:24 UTC 2010


> I would like to add the “show interfaces status” command to rancid. From
> what I can gather from previous postings, I will need to:
>
> -        Modify %commands :
> %commands=(
>         'show interfaces status'          => "ShowIntStatus",  …
>
> -        Modify @commands :
> @commands=(
>         "show interfaces status", …

Are you looking at an old RANCID version? In 2.3.2 there is only one
list of hashes to modify:

# Main
@commandtable = (
       {'admin show version'           => 'ShowVersion'},
       {'show version'                 => 'ShowVersion'},
       ...
       {'write term'                   => 'WriteTerm'},
);

The actual %commands and @commands variables are automatically built based on
@commandtable.

To answer the question: yes, just add
   {'show interfaces status' => "ShowIntStatus"},
to @commandtable.


> -        Develop a new sub (“ShowIntStatus”) to process/format the output

Correct. The hard part is to figure out how to use ProcessHistory.


> Is there any other (easier) way to accomplish this, or is this the
> recommended approach?

AFAIK it's the recommended and only way.

I would also recommend to put the code in a separate patch. That way
it's easier to re-apply it whenever a new upstream is released.

-- 
Pelle

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


More information about the Rancid-discuss mailing list