Discussion:
[rancid] Help with suppressing part of the show run output
Tom Simpson
2013-02-14 14:18:25 UTC
Permalink
How do I go about suppressing part of the show run output from Cisco devices? The first two lines every time. We have added a command recently to the config on several switches that when you use any show command, it adds the output from "show ip os summary" to the first of the output. Since this changes every time you run any command it shows up as a diff in RANCID every time.

I am assuming that this would be a regex, but I don't know where to begin adding it inside the rancid script, what would be the best section to put this in? Should it be possible to strip the first few lines off of the configuration output? Or would ignoring these lines be easier?


The config line that we added is: exec prompt timestamp
and it gets added to the vty config section

A couple of examples of the output that is added to the show run or any other show command is the following:

Load for five secs: 5%/0%; one minute: 6%; five minutes: 5%
Time source is NTP, 09:02:17.501 EDT Thu Feb 14 2013


Load for five secs: 5%/0%; one minute: 5%; five minutes: 5%
Time source is NTP, 09:06:14.333 EDT Thu Feb 14 2013


Since this happens after the command is input it can't be added as part of the prompt; so I guess I am stuck with either stripping it out of the config prior to parsing it, or just simply have rancid ignore it when it does run the diff...


Thanks,

Tom Simpson
LAN/WAN Engineer
Forcht Group of Kentucky
859.259.9700 x538

"We all knew there was just one way to improve our odds for survival: train, train, train. Sometimes, if your training is properly intense it will kill you. More often -- much, much more often -- it will save your life." - Richard Marcinko, former US Navy SEAL Team Commander


CONFIDENTIALITY NOTICE:
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

Forcht Group IT, 2400 South Main Street, Corbin, Ky.
heasley
2013-02-14 19:00:20 UTC
Permalink
Thu, Feb 14, 2013 at 09:18:25AM -0500, Tom Simpson:
> How do I go about suppressing part of the show run output from Cisco devices? The first two lines every time. We have added a command recently to the config on several switches that when you use any show command, it adds the output from "show ip os summary" to the first of the output. Since this changes every time you run any command it shows up as a diff in RANCID every time.
>
> I am assuming that this would be a regex, but I don't know where to begin adding it inside the rancid script, what would be the best section to put this in? Should it be possible to strip the first few lines off of the configuration output? Or would ignoring these lines be easier?
>
>
> The config line that we added is: exec prompt timestamp
> and it gets added to the vty config section

well, remove that config. if you want to know the time or load avg, enter
the command to see it when you want to see it. or use tacacs to apply an
autocmd for users that want that junk. else you have to filter it in each
rancid function or add the command to disable it.

> A couple of examples of the output that is added to the show run or any other show command is the following:
>
> Load for five secs: 5%/0%; one minute: 6%; five minutes: 5%
> Time source is NTP, 09:02:17.501 EDT Thu Feb 14 2013
>
>
> Load for five secs: 5%/0%; one minute: 5%; five minutes: 5%
> Time source is NTP, 09:06:14.333 EDT Thu Feb 14 2013
>
>
> Since this happens after the command is input it can't be added as part of the prompt; so I guess I am stuck with either stripping it out of the config prior to parsing it, or just simply have rancid ignore it when it does run the diff...
>
>
> Thanks,
>
> Tom Simpson
> LAN/WAN Engineer
> Forcht Group of Kentucky
> 859.259.9700 x538
>
> "We all knew there was just one way to improve our odds for survival: train, train, train. Sometimes, if your training is properly intense it will kill you. More often -- much, much more often -- it will save your life." - Richard Marcinko, former US Navy SEAL Team Commander
>
>
> CONFIDENTIALITY NOTICE:
> This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.
>
> Forcht Group IT, 2400 South Main Street, Corbin, Ky.
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-***@shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Brian Talley
2013-02-14 18:26:57 UTC
Permalink
Add the following lines to the "while(<INPUT>)" block of every subroutine
that calls a 'show' command (see @commandtable array) in the rancid file:
/Load for five secs/ && next;
/Time source is NTP/ && next;

e.g.:
# This routine processes a "write term"
sub WriteTerm {
...
while (<INPUT>) {
...
/Load for five secs/ && next;
/Time source is NTP/ && next;
...
}
...
}

BT


On Thu, Feb 14, 2013 at 7:18 AM, Tom Simpson <***@forchtgroup.com>wrote:

> How do I go about suppressing part of the show run output from Cisco
> devices? The first two lines every time. We have added a command recently
> to the config on several switches that when you use any show command, it
> adds the output from "show ip os summary" to the first of the output. Since
> this changes every time you run any command it shows up as a diff in RANCID
> every time.
>
> I am assuming that this would be a regex, but I don't know where to begin
> adding it inside the rancid script, what would be the best section to put
> this in? Should it be possible to strip the first few lines off of the
> configuration output? Or would ignoring these lines be easier?
>
>
> The config line that we added is: exec prompt timestamp
> and it gets added to the vty config section
>
> A couple of examples of the output that is added to the show run or any
> other show command is the following:
>
> Load for five secs: 5%/0%; one minute: 6%; five minutes: 5%
> Time source is NTP, 09:02:17.501 EDT Thu Feb 14 2013
>
>
> Load for five secs: 5%/0%; one minute: 5%; five minutes: 5%
> Time source is NTP, 09:06:14.333 EDT Thu Feb 14 2013
>
>
> Since this happens after the command is input it can't be added as part of
> the prompt; so I guess I am stuck with either stripping it out of the
> config prior to parsing it, or just simply have rancid ignore it when it
> does run the diff...
>
>
> Thanks,
>
> Tom Simpson
> LAN/WAN Engineer
> Forcht Group of Kentucky
> 859.259.9700 x538
>
> "We all knew there was just one way to improve our odds for survival:
> train, train, train. Sometimes, if your training is properly intense it
> will kill you. More often -- much, much more often -- it will save your
> life." - Richard Marcinko, former US Navy SEAL Team Commander
>
>
> CONFIDENTIALITY NOTICE:
> This message contains confidential information and is intended only for
> the individual named. If you are not the named addressee you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately by e-mail if you have received this e-mail by mistake and
> delete this e-mail from your system. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
> The sender therefore does not accept liability for any errors or omissions
> in the contents of this message, which arise as a result of e-mail
> transmission. If verification is required please request a hard-copy
> version.
>
> Forcht Group IT, 2400 South Main Street, Corbin, Ky.
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-***@shrubbery.net
> http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
>



--
Brian Talley
***@gmail.com
Lempka, Jason
2013-02-14 20:38:53 UTC
Permalink
> I am assuming that this would be a regex, but I don't know where to begin
> adding it inside the rancid script, what would be the best section to put
> this in? Should it be possible to strip the first few lines off of the
> configuration output? Or would ignoring these lines be easier?
>
>
> The config line that we added is: exec prompt timestamp
> and it gets added to the vty config section

I disabled that prompt upon login via clogin. Here's a diff:

=========
--- bin/clogin 2012-11-29 08:12:39.688077830 -0500
+++ clogin 2012-11-29 08:08:44.387041585 -0500
@@ -918,6 +918,9 @@
send "terminal length 0\r"
expect -re $prompt {}
send "terminal width 132\r"
+ expect -re $prompt {}
+ send "terminal no exec prompt timestamp\r"
+ #expect -re $prompt {}
}
expect -re $prompt {}
} else {
=========

Had I been aware of an autocmd via tacacs as heasley points out in another message, I would have asked them to remove the vty command and shoved it into their tacacs profile.

Thanks!

Jason
Tom Simpson
2013-02-14 20:40:31 UTC
Permalink
Yeah, if TACACS was an option, I would as well. Plus I can't get it removed right now, since someone else has been convinced we "need that information" every time we run any show commands....

I am trying to get TACACS implemented sometime this year, but it is low on my todo list, since the authentication we are currently using works...




Thanks,

Tom Simpson
LAN/WAN Engineer
Forcht Group of Kentucky
859.259.9700 x538

"We all knew there was just one way to improve our odds for survival: train, train, train. Sometimes, if your training is properly intense it will kill you. More often -- much, much more often -- it will save your life." - Richard Marcinko, former US Navy SEAL Team Commander

________________________________________
From: Lempka, Jason [***@pbvllc.com]
Sent: Thursday, February 14, 2013 3:38 PM
To: Tom Simpson
Cc: rancid-***@shrubbery.net
Subject: RE: Help with suppressing part of the show run output

> I am assuming that this would be a regex, but I don't know where to begin
> adding it inside the rancid script, what would be the best section to put
> this in? Should it be possible to strip the first few lines off of the
> configuration output? Or would ignoring these lines be easier?
>
>
> The config line that we added is: exec prompt timestamp
> and it gets added to the vty config section

I disabled that prompt upon login via clogin. Here's a diff:

=========
--- bin/clogin 2012-11-29 08:12:39.688077830 -0500
+++ clogin 2012-11-29 08:08:44.387041585 -0500
@@ -918,6 +918,9 @@
send "terminal length 0\r"
expect -re $prompt {}
send "terminal width 132\r"
+ expect -re $prompt {}
+ send "terminal no exec prompt timestamp\r"
+ #expect -re $prompt {}
}
expect -re $prompt {}
} else {
=========

Had I been aware of an autocmd via tacacs as heasley points out in another message, I would have asked them to remove the vty command and shoved it into their tacacs profile.

Thanks!

Jason

CONFIDENTIALITY NOTICE:
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

Forcht Group IT, 2400 South Main Street, Corbin, Ky.
Loading...