Discussion:
[rancid] comparing device running config against startup config
Ian Stong
2011-09-20 14:10:06 UTC
Permalink
We are using rancid to grab the running config and look for differences
over the previous running config. That works great and as advertised. I
was wondering what others are doing to catch the occasional issue where
someone makes a change to the running config but for whatever reason it
doesn't get saved and the device crashes - hence loosing that part of
the config.

What suggestions do you have for ensuring the running config matches the
startup config?


Thanks,

Ian
john heasley
2011-09-20 14:30:06 UTC
Permalink
Post by Ian Stong
We are using rancid to grab the running config and look for differences
over the previous running config. That works great and as advertised. I
was wondering what others are doing to catch the occasional issue where
someone makes a change to the running config but for whatever reason it
doesn't get saved and the device crashes - hence loosing that part of
the config.
What suggestions do you have for ensuring the running config matches the
startup config?
you could use a cron job to write it periodically - clogin -c 'wr mem' foo
john heasley
2011-09-20 14:41:34 UTC
Permalink
Quite true. Sometimes we want temporary changes to be in the running
config but not the startup config in case we need to back it out so
would rather have a way where rancid checks the running versus startup
and alerts for any changes (versus sending a periodic wr mem).
IMO, get out of that habit. Junos and XR essentially don't allow that.
the only case where its useful is to make a change that will be wiped on
reboot.

else, modify a copy of rancid to run show startup as a different device
type and use a second group to collect that version. and some separate
script to diff the two groups.
Ian Stong
2011-09-20 14:28:47 UTC
Permalink
Quite true. Sometimes we want temporary changes to be in the running
config but not the startup config in case we need to back it out so
would rather have a way where rancid checks the running versus startup
and alerts for any changes (versus sending a periodic wr mem).


Thanks,

Ian

-----Original Message-----
From: john heasley [mailto:***@shrubbery.net]
Sent: Tuesday, September 20, 2011 10:30 AM
To: Ian Stong
Cc: rancid-***@shrubbery.net
Subject: Re: [rancid] comparing device running config against startup
config
Post by Ian Stong
We are using rancid to grab the running config and look for
differences over the previous running config. That works great and as
advertised. I was wondering what others are doing to catch the
occasional issue where someone makes a change to the running config
but for whatever reason it doesn't get saved and the device crashes -
hence loosing that part of the config.
What suggestions do you have for ensuring the running config matches
the startup config?
you could use a cron job to write it periodically - clogin -c 'wr mem'
foo
Per-Olof Olsson
2011-09-20 18:32:06 UTC
Permalink
Post by Ian Stong
We are using rancid to grab the running config and look for differences
over the previous running config. That works great and as advertised. I
was wondering what others are doing to catch the occasional issue where
someone makes a change to the running config but for whatever reason it
doesn't get saved and the device crashes - hence loosing that part of
the config.
What suggestions do you have for ensuring the running config matches the
startup config?
Thinks there begin to be useful info for some platforms.

HP procurve have on later switches "show running-config status"
Not fully working on 2650! After reboot it always differ.
HP support have fixed this for 2610's after I bug report it.


Cisco IOS. Compare time stamp from "show running-config"
Some of the first lines.


Nexus. Look at output from "show running-config diff".
Can't test latest version if it still generate diffs for some lines.
Post by Ian Stong
Thanks,
Ian
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
/Peo
----------------------------------------------------------
Per-Olof Olsson Email: ***@chalmers.se
Chalmers tekniska högskola IT-service
Hörsalsvägen 5 412 96 Göteborg
Tel: 031/772 6738 Fax: 031/772 8680
----------------------------------------------------------
Per-Olof Olsson
2011-09-21 06:15:38 UTC
Permalink
Correct command for HP procurv is "show config status".

Have only done some test on HP but we have to many 2650's then.
No there less 2650's so I have to consider if we start using it.

stats/38-> diff -c /usr/local/rancid/bin/hrancid hrancid
*** /usr/local/rancid/bin/hrancid Wed Jan 26 11:30:26 2011
--- hrancid Wed Sep 21 08:03:21 2011
***************
*** 320,325 ****
--- 320,344 ----
return(0);
}

+ # This routine parses "show config status"
+ sub ShowConfigStatus {
+ print STDERR " In ShowConfigStatus: $_" if ($debug);
+
+ while (<INPUT>) {
+ tr/\015//d;
+ last if (/^$prompt/);
+ next if (/^(\s*|\s*$cmd\s*)$/);
+ return(-1) if (/command authorization failed/i);
+ return(1) if /^(Invalid|Ambiguous) input:/i;
+ next if (/^Running configuration is same as the startup configuration.\s*$/);
+
+ $now = localtime;
+ ProcessHistory("COMMENTS","keysort","H0",";$now $_");
+
+ }
+ return(0);
+ }
+

# This routine processes a "write term"
sub WriteTerm {
***************
*** 515,520 ****
--- 534,540 ----
{'show stack' => 'ShowStack'},
{'show tech transceivers' => 'ShowTransceivers'},
{'show config files' => 'ShowConfigFiles'},
+ {'show config status' => 'ShowConfigStatus'},
{'write term' => 'WriteTerm'}
);
# Use an array to preserve the order of the commands and a hash for mapping
---end of diff-----------------------


If you don't like "spaming mode" just comment "$now = localtime;" line.



/Peo
----------------------------------------------------------
Per-Olof Olsson Email: ***@chalmers.se
Chalmers tekniska högskola IT-service
Hörsalsvägen 5 412 96 Göteborg
Tel: 031/772 6738 Fax: 031/772 8660
----------------------------------------------------------
Post by Per-Olof Olsson
Post by Ian Stong
We are using rancid to grab the running config and look for differences
over the previous running config. That works great and as advertised. I
was wondering what others are doing to catch the occasional issue where
someone makes a change to the running config but for whatever reason it
doesn't get saved and the device crashes - hence loosing that part of
the config.
What suggestions do you have for ensuring the running config matches the
startup config?
Thinks there begin to be useful info for some platforms.
HP procurve have on later switches "show running-config status"
Not fully working on 2650! After reboot it always differ.
HP support have fixed this for 2610's after I bug report it.
Cisco IOS. Compare time stamp from "show running-config"
Some of the first lines.
Nexus. Look at output from "show running-config diff".
Can't test latest version if it still generate diffs for some lines.
Post by Ian Stong
Thanks,
Ian
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
/Peo
----------------------------------------------------------
Chalmers tekniska högskola IT-service
Hörsalsvägen 5 412 96 Göteborg
Tel: 031/772 6738 Fax: 031/772 8680
----------------------------------------------------------
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Per-Olof Olsson
2011-10-08 07:29:00 UTC
Permalink
This post might be inappropriate. Click to display it.
Lee
2011-10-16 16:57:20 UTC
Permalink
Post by Ian Stong
We are using rancid to grab the running config and look for differences
over the previous running config. That works great and as advertised. I
was wondering what others are doing to catch the occasional issue where
someone makes a change to the running config but for whatever reason it
doesn't get saved and the device crashes - hence loosing that part of
the config.
What suggestions do you have for ensuring the running config matches the
startup config?
If you have SNMP enabled on your devices:

cat ${DEVLIST} | while read DEV trash
do

chgTime=`snmpget -Le -OqUtv $DEV
CISCO-CONFIG-MAN-MIB::ccmHistoryRunningLastChanged.0 `
savTime=`snmpget -Le -OqUtv $DEV
CISCO-CONFIG-MAN-MIB::ccmHistoryStartupLastChanged.0 `

if [ $savTime -lt $chgTime ]; then
printf "%-14s config needs to be saved %s %s\n" $DEV $chgTime $savTime
fi

done


Then you can use CISCO-CONFIG-COPY-MIB to do the equivalent of 'copy
run start' or generate & run a 'clogin -c "copy run start" router1 ...
routerN' shell script

Regards,
Lee

Continue reading on narkive:
Loading...