[rancid] excluding output from cisco routers and switches

allonon allonon at gmail.com
Mon Jan 4 20:16:33 UTC 2016


I wanted to start a different topic as mine is not about flash or bootflash.

I have a similar issue with nexus output and want to prevent diff emails
but I want the data in the the saved config.  One of switches will
constantly adjust output watts by a few points.


  !Env: -------  -------------------  ----------  ----------  ----------
 --------------
- !Env: 1        N9K-PAC-650W-B             67 W                   649 W
  Ok
- !Env: 2        N9K-PAC-650W-B             71 W                   649 W
  Ok
+ !Env: 1        N9K-PAC-650W-B             68 W                   649 W
  Ok
+ !Env: 2        N9K-PAC-650W-B             70 W                   649 W
  Ok


My scripting-fu is non-existent and am trying to learn this.

I figure I have 3 options.
    Just have Rancid ignore the line.  (not preferred as I want to see the
PS as OK or not)
    Filter email output.
    Filter the actual diff.  (can the diff actually handle advanced
parsing?  Everything I see shows how to ignore line based on simple match)

I found this snippet from another thread on how to filter email output but
I'm getting lost on what it is doing after the first grep
> DIFF=`cat $TMP.diff | grep -v "^===" | grep -v "^diff " | grep -v
> "^Index: " | grep -v "^retrieving revision" | grep -v "^$"`
> if [ -n "$DIFF" ]; then
> ...email stuff here...
> fi

How do I best adjust this so that it greps for the ENV or N9K-PAC line, and
ignore (not send diff email) it if the Ok is there.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20160104/5955b7cd/attachment.html>


More information about the Rancid-discuss mailing list