Discussion:
[rancid] Limit commands run for GSR
Alan McKinnon
2013-06-17 19:21:55 UTC
Permalink
Hi,

Our provider edge runs on GSR 12's and they carry a hefty config. NetOps
complain that rancid noticeably spikes the cpu load [1] when it runs
these 4 (essentially the same) commands.

{'more system:running-config' => 'WriteTerm'}, # ASA/PIX
{ running-config view full'=> 'WriteTerm'}, # workaround for
{'show running-config' => 'WriteTerm'},
{'write term' => 'WriteTerm'},

I got it under control easily by forking rancid to a gsrrancid script
and removing the bits I don't want from @commandtable.

I'd rather not do it this way, I'd like to have this in the rancid
parser. But I can't figure a way to modify @commandtable at runtime
based on chassis/OS type.

Ideas?


[1] It's a legit complaint, not a fiction of a NetOps engineer's
imagination. On every other chassis I can ignore the effects rancid
causes, but not these ones. We do things with the 12k most folks think
should not be possible :-)
--
Alan McKinnon
***@gmail.com
Peter Jackson
2013-06-18 01:42:59 UTC
Permalink
Check out some of the other command sections that are skipped for certain
'types'. Figure out the type that rancid sets for the GSRs and use the
line below (formatted for the correct type) in the command sections you
don't want to run for them.

I assume the following would skip 12006, 12010, 12404, 12410, etc.:

return(1) if ($type !~ /^12[40]/);
Post by Alan McKinnon
Hi,
Our provider edge runs on GSR 12's and they carry a hefty config. NetOps
complain that rancid noticeably spikes the cpu load [1] when it runs
these 4 (essentially the same) commands.
{'more system:running-config' => 'WriteTerm'}, # ASA/PIX
{ running-config view full'=> 'WriteTerm'}, # workaround for
{'show running-config' => 'WriteTerm'},
{'write term' => 'WriteTerm'},
I got it under control easily by forking rancid to a gsrrancid script
I'd rather not do it this way, I'd like to have this in the rancid
based on chassis/OS type.
Ideas?
[1] It's a legit complaint, not a fiction of a NetOps engineer's
imagination. On every other chassis I can ignore the effects rancid
causes, but not these ones. We do things with the 12k most folks think
should not be possible :-)
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Alan McKinnon
2013-06-20 07:28:20 UTC
Permalink
Post by Peter Jackson
Check out some of the other command sections that are skipped for
certain 'types'. Figure out the type that rancid sets for the GSRs and
use the line below (formatted for the correct type) in the command
sections you don't want to run for them.
return(1) if ($type !~ /^12[40]/);
I think I missed replying to this one, sorry about that.

I don't think that approach will work for me - I don't need to prevent
rancid parsing the output, I need some commands to not be run on the
device at all.

That means I'd have to modify @commandtable based on chassis type so
that clogin doesn't issue certain commands. But I don't know the chassis
type until clogin has already run and minimally ShowVersion has already
been parsed. By then it's too late.

3.0alpha looks like it might be moving in a direction that solves my
problem quite nicely
Post by Peter Jackson
Hi,
Our provider edge runs on GSR 12's and they carry a hefty config. NetOps
complain that rancid noticeably spikes the cpu load [1] when it runs
these 4 (essentially the same) commands.
{'more system:running-config' => 'WriteTerm'}, # ASA/PIX
{ running-config view full'=> 'WriteTerm'}, # workaround for
{'show running-config' => 'WriteTerm'},
{'write term' => 'WriteTerm'},
I got it under control easily by forking rancid to a gsrrancid script
I'd rather not do it this way, I'd like to have this in the rancid
based on chassis/OS type.
Ideas?
[1] It's a legit complaint, not a fiction of a NetOps engineer's
imagination. On every other chassis I can ignore the effects rancid
causes, but not these ones. We do things with the 12k most folks think
should not be possible :-)
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
Alan McKinnon
***@gmail.com
Peter Jackson
2013-06-20 14:36:02 UTC
Permalink
Yeah, sorry Alan I wasn't thinking.

I like the looks of 3.0 also but here is workaround for 2.3 that should
work for you if the hostnames of your GSRs are unique - able to be matched
by a regular expression. I think the only way to do this is with the
hostname since no other information is passed to rancid. If you can't
match your GSR hostnames by regexp, you could enter them all together.

--- rancid.20130620 2013-06-20 09:53:03.344845839 -0400
+++ rancid 2013-06-20 10:00:50.874896393 -0400
@@ -2333,6 +2333,18 @@
{'write term' => 'WriteTerm'},
);

+my @commandtable2;
+if ( $host =~ /gsr/ ){ #replace 'gsr' with GSR hostname regexp
+ foreach my $command ( @commandtable ) {
+ foreach my $key ( keys %$command ) {
+ unless ( $key =~ /running-config/ ){ #replace 'running-config'
with a pipe-separated list of commands/command regexps to NOT run
+ push ( @commandtable2 ,( { $key => $command->{$key} } ));
+ }
+ }
+ }
+ @commandtable = @commandtable2;
+}
+
# Use an array to preserve the order of the commands and a hash for mapping
# commands to the subroutine and track commands that have been completed.
@commands = map(keys(%$_), @commandtable);
Post by Alan McKinnon
Post by Peter Jackson
Check out some of the other command sections that are skipped for
certain 'types'. Figure out the type that rancid sets for the GSRs and
use the line below (formatted for the correct type) in the command
sections you don't want to run for them.
return(1) if ($type !~ /^12[40]/);
I think I missed replying to this one, sorry about that.
I don't think that approach will work for me - I don't need to prevent
rancid parsing the output, I need some commands to not be run on the
device at all.
that clogin doesn't issue certain commands. But I don't know the chassis
type until clogin has already run and minimally ShowVersion has already
been parsed. By then it's too late.
3.0alpha looks like it might be moving in a direction that solves my
problem quite nicely
Post by Peter Jackson
Hi,
Our provider edge runs on GSR 12's and they carry a hefty config.
NetOps
Post by Peter Jackson
complain that rancid noticeably spikes the cpu load [1] when it runs
these 4 (essentially the same) commands.
{'more system:running-config' => 'WriteTerm'}, # ASA/PIX
{ running-config view full'=> 'WriteTerm'}, # workaround for
{'show running-config' => 'WriteTerm'},
{'write term' => 'WriteTerm'},
I got it under control easily by forking rancid to a gsrrancid script
I'd rather not do it this way, I'd like to have this in the rancid
based on chassis/OS type.
Ideas?
[1] It's a legit complaint, not a fiction of a NetOps engineer's
imagination. On every other chassis I can ignore the effects rancid
causes, but not these ones. We do things with the 12k most folks
think
Post by Peter Jackson
should not be possible :-)
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...