Custom RANCID modules

john heasley heas at shrubbery.net
Wed May 5 07:13:58 UTC 2004


Mon, May 03, 2004 at 08:37:20AM -0600, Joshua Ginsberg:
> Thanks for your reply, Andrew. So let the questions begin... :-D
> 
> I'm not the Perl Gods' gift to mankind, so could somebody briefly
> explain to me what sub ProcessHistory does?

ProcessHistory(tag, command, command arg, line)

command is one of the functions keynsort, keysort, valsort, numsort, or
ipsort.  see the comments.

basically, lines (of the output collected from the router) are "buffered"
or "queued" with the given command and tag until of them changes, at
which point the buffer is flushed.

so,
        /^Cisco Secure PIX /i &&
            ProcessHistory("COMMENTS","keysort","F1", "!Image: $_") && next;
        /^This PIX has an?\s+(.*)$/ &&
            ProcessHistory("COMMENTS","keysort","C1", "!$_") && next;

lines matching these would be buffered and sorted with keysort whose
arg is F1 or C1.  if it then hit

        /^Serial Number:\s+(.*)$/ && 
            ProcessHistory("FOO","keysort","C1", "!$_") && next;
or
        /^(HD unit \d), idb/ &&
            ProcessHistory("INT","","","!Interface: $1\n") && next;

the buffer would be flushed due to tag or command change, respectively.



More information about the Rancid-discuss mailing list