Discussion:
[rancid] Excluding config lines in Rancid
Vincent Aniello
2014-04-23 14:49:49 UTC
Permalink
Rancid is detecting configuration changes on a few configuration items in
Cisco switch configurations that are automatically updated and Rancid
should exclude from it's comparisons.

On a Cisco Catalyst 3560 switch running software version 12.2(25)SEE4
Rancid is reporting changes to the "ntp clock-period" command:

- ntp clock-period 36029104
+ ntp clock-period 3602910

On a Cisco Nexus 3548 switch running software version 6.0(2)A1(1e) Rancid
is reporting changes to the following configuration items:

!Env: INTAKE 45 29
+ !Env: INTAKE 45 28

- !Flash: bootflash: 5356844 Apr 22 17:42:48 2014
BufferMonitor-1HourData
+ !Flash: bootflash: 5356844 Apr 22 20:42:48 2014
BufferMonitor-1HourData

Can Rancid be configured to ignore changes in these lines?

I am currently running Rancid 3.0, but had the same issue in 2.3.6 and
2.3.8.

Thanks.

--Vincent
Hughes, Doug
2014-04-23 15:05:11 UTC
Permalink
Sure, this topic is something of an FAQ.


* Edit the rancid executable (or whatever executable you happen to be using to collect the data)

* Most of the stuff for normal commands will be in the 'WriteTerm' callback (see CommandTable)

* There should already be an ntp clock-period match in there somewhere. In mine, it looks like this:

# Dog gone Cool matches to process the rest of the config

/^tftp-server flash / && next; # kill any tftp remains

/^ntp clock-period / && next; # kill ntp clock-period

/^ length / && next; # kill length on serial lines

/^ width / && next; # kill width on serial lines

* Next find the ShowEnv subroutine

o Look for 'next if' in the while (<INPUT>) loop. Add a line above or below that says: next if (/INTAKE/)

* Similarly for ShowFlash subroutine, add a next if (/bootflash/) if you don't want to see bootflash.



'next if' is the generic answer about how to eliminate things. Look in @commandtable to find the command that gets executed, that maps to a callback. Go to the callback and add a 'next if'.

From: rancid-discuss-***@shrubbery.net [mailto:rancid-discuss-***@shrubbery.net] On Behalf Of Vincent Aniello
Sent: Wednesday, April 23, 2014 10:50 AM
To: rancid-***@shrubbery.net
Subject: [rancid] Excluding config lines in Rancid

Rancid is detecting configuration changes on a few configuration items in Cisco switch configurations that are automatically updated and Rancid should exclude from it's comparisons.

On a Cisco Catalyst 3560 switch running software version 12.2(25)SEE4 Rancid is reporting changes to the "ntp clock-period" command:

- ntp clock-period 36029104
+ ntp clock-period 3602910

On a Cisco Nexus 3548 switch running software version 6.0(2)A1(1e) Rancid is reporting changes to the following configuration items:

!Env: INTAKE 45 29
+ !Env: INTAKE 45 28

- !Flash: bootflash: 5356844 Apr 22 17:42:48 2014 BufferMonitor-1HourData
+ !Flash: bootflash: 5356844 Apr 22 20:42:48 2014 BufferMonitor-1HourData

Can Rancid be configured to ignore changes in these lines?

I am currently running Rancid 3.0, but had the same issue in 2.3.6 and 2.3.8.

Thanks.

--Vincent
heasley
2014-04-24 21:13:19 UTC
Permalink
Post by Vincent Aniello
Rancid is detecting configuration changes on a few configuration items in
Cisco switch configurations that are automatically updated and Rancid
should exclude from it's comparisons.
On a Cisco Catalyst 3560 switch running software version 12.2(25)SEE4
- ntp clock-period 36029104
+ ntp clock-period 3602910
this be filtered by stock rancid 3.0. i can not imagine why it would be
missed until the device were not configured as 'cisco'.
Post by Vincent Aniello
On a Cisco Nexus 3548 switch running software version 6.0(2)A1(1e) Rancid
!Env: INTAKE 45 29
+ !Env: INTAKE 45 28
- !Flash: bootflash: 5356844 Apr 22 17:42:48 2014
BufferMonitor-1HourData
+ !Flash: bootflash: 5356844 Apr 22 20:42:48 2014
BufferMonitor-1HourData
Can Rancid be configured to ignore changes in these lines?
Index: bin/nxrancid.in
===================================================================
--- bin/nxrancid.in (revision 2816)
+++ bin/nxrancid.in (working copy)
@@ -313,6 +313,7 @@

s/ +$//; # Drop trailing ' '
next if (/Fan Zone Speed:/);
+ next if (/INTAKE/);
ProcessHistory("COMMENTS","","","!Env: $_");
}
ProcessHistory("COMMENTS","","","!\n");
@@ -436,6 +437,8 @@
return(-1) if (/command authorization failed/i);
return(1) if /(Open device \S+ failed|Error opening \S+:)/;

+ next if (/BufferMonitor-1HourData/);
+
if (/^\s*(\d+) bytes /) {
my($tmp) = int($1 / (1024 * 1024));
s/$1 bytes /$tmp MB /;

lmk if I've misplaced the INTAKE filter.
Post by Vincent Aniello
I am currently running Rancid 3.0, but had the same issue in 2.3.6 and
2.3.8.
Vincent Aniello
2014-04-25 01:42:26 UTC
Permalink
Thanks. The problem with the 3560 was that is was set to cisco-nx instead
of cisco. Once I corrected this the ntp clock-period discrepancy no
longer appeared.

On the Nexus 3548 switch the "BufferMonitor-1HourData" no longer seems to
appear after your changes, but the INTAKE config line still does:

- !Env: INTAKE 45 29
+ !Env: INTAKE 45 28

Here is a snipet from nxrancid with your change for excluding INTAKE:

s/ +$//; # Drop trailing ' '
next if (/Fan Zone Speed:/);
next if (/INTAKE/);
ProcessHistory("COMMENTS","","","!Env: $_");


Thanks again.

--Vincent



From: heasley <***@shrubbery.net>
To: Vincent Aniello <***@portware.com>
Cc: rancid-***@shrubbery.net
Date: 04/24/2014 05:41 PM
Subject: Re: [rancid] Excluding config lines in Rancid
Post by Vincent Aniello
Rancid is detecting configuration changes on a few configuration items in
Cisco switch configurations that are automatically updated and Rancid
should exclude from it's comparisons.
On a Cisco Catalyst 3560 switch running software version 12.2(25)SEE4
- ntp clock-period 36029104
+ ntp clock-period 3602910
this be filtered by stock rancid 3.0. i can not imagine why it would be
missed until the device were not configured as 'cisco'.
Post by Vincent Aniello
On a Cisco Nexus 3548 switch running software version 6.0(2)A1(1e) Rancid
!Env: INTAKE 45 29
+ !Env: INTAKE 45 28
- !Flash: bootflash: 5356844 Apr 22 17:42:48 2014
BufferMonitor-1HourData
+ !Flash: bootflash: 5356844 Apr 22 20:42:48 2014
BufferMonitor-1HourData
Can Rancid be configured to ignore changes in these lines?
Index: bin/nxrancid.in
===================================================================
--- bin/nxrancid.in (revision 2816)
+++ bin/nxrancid.in (working copy)
@@ -313,6 +313,7 @@

s/ +$//; # Drop trailing ' '
next if (/Fan Zone Speed:/);
+ next if (/INTAKE/);
ProcessHistory("COMMENTS","","","!Env: $_");
}
ProcessHistory("COMMENTS","","","!\n");
@@ -436,6 +437,8 @@
return(-1) if (/command authorization failed/i);
return(1) if /(Open device \S+ failed|Error opening
\S+:)/;

+ next if (/BufferMonitor-1HourData/);
+
if (/^\s*(\d+) bytes /) {
my($tmp) = int($1 / (1024 * 1024));
s/$1 bytes /$tmp MB /;

lmk if I've misplaced the INTAKE filter.
Post by Vincent Aniello
I am currently running Rancid 3.0, but had the same issue in 2.3.6 and
2.3.8.
Loading...