Discussion:
[rancid] supressing login banner etc?
Lee
2011-11-08 22:33:37 UTC
Permalink
clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?

My work-around is something like

clogin -c "sh platform summary" sw1 sw2 sw3 sw4 ... swN |\
awk '/sh platform/ , /exit/' | tr -d "\r" > /tmp/output

Anyone know of a better method?

And am I the only one that would like an option to suppress all the
login and banner msgs? (but still see the error msgs)

Thanks,
Lee
Carlos Asensio
2011-11-10 08:13:29 UTC
Permalink
-----Mensaje original-----
De: rancid-discuss-***@shrubbery.net [mailto:rancid-discuss-***@shrubbery.net] En nombre de Lee
Enviado el: martes, 08 de noviembre de 2011 23:34
Para: rancid-***@shrubbery.net
Asunto: [rancid] supressing login banner etc?

clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?

My work-around is something like

clogin -c "sh platform summary" sw1 sw2 sw3 sw4 ... swN |\
awk '/sh platform/ , /exit/' | tr -d "\r" > /tmp/output

Anyone know of a better method?

And am I the only one that would like an option to suppress all the
login and banner msgs? (but still see the error msgs)

Thanks,
Lee
***********************

Hi Lee,

I adapted the banners to what it's expected. So no '>' nor '#' character.

Regards,
Carlos.
Lee
2011-11-10 11:33:21 UTC
Permalink
Post by Carlos Asensio
-----Mensaje original-----
Enviado el: martes, 08 de noviembre de 2011 23:34
Asunto: [rancid] supressing login banner etc?
clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?
My work-around is something like
clogin -c "sh platform summary" sw1 sw2 sw3 sw4 ... swN |\
awk '/sh platform/ , /exit/' | tr -d "\r" > /tmp/output
Anyone know of a better method?
And am I the only one that would like an option to suppress all the
login and banner msgs? (but still see the error msgs)
Thanks,
Lee
***********************
Hi Lee,
I adapted the banners to what it's expected. So no '>' nor '#' character.
I remember :) You had the rancid [early version] works, current
rancid can't login problem.

This is a separate issue - I'm looking for an rsh replacement &
"clogin -c cmd" is almost there.
clogin -c cmd | awk '/cmd/ , /exit/'
does what I want but I tend to not get the "awk /cmd/" part right on
the first try & was wondering if there's an easier / less error-prone
way to get the same effect.

Thanks,
Lee
Carlos Asensio
2011-11-10 11:51:41 UTC
Permalink
Post by Carlos Asensio
-----Mensaje original-----
Enviado el: martes, 08 de noviembre de 2011 23:34
Asunto: [rancid] supressing login banner etc?
clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?
My work-around is something like
clogin -c "sh platform summary" sw1 sw2 sw3 sw4 ... swN |\
awk '/sh platform/ , /exit/' | tr -d "\r" > /tmp/output
Anyone know of a better method?
And am I the only one that would like an option to suppress all the
login and banner msgs? (but still see the error msgs)
Thanks,
Lee
***********************
Hi Lee,
I adapted the banners to what it's expected. So no '>' nor '#' character.
I remember :) You had the rancid [early version] works, current
rancid can't login problem.

This is a separate issue - I'm looking for an rsh replacement &
"clogin -c cmd" is almost there.
clogin -c cmd | awk '/cmd/ , /exit/'
does what I want but I tend to not get the "awk /cmd/" part right on
the first try & was wondering if there's an easier / less error-prone
way to get the same effect.

Thanks,
Lee

****************
Hi Lee,

Sorry but, as you may noticed, I misunderstood the problem.

I don't know how to help you with that issue, so best of luck :)!

Regards,
Carlos.

Alex DEKKER
2011-11-10 10:24:13 UTC
Permalink
Post by Lee
clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?
You could put some unique character/string in the banner and MOTD and
grep them out while using clogin interactively. Of course you then
wouldn't see that part of the config, as it would need to be a part of
the config!

alexd
Lee
2011-11-10 11:10:49 UTC
Permalink
Post by Alex DEKKER
Post by Lee
clogin -c "cmd" dev1 dev2 ... devN is a really nice way to collect
the output from a bunch of devices. My problem with it is that I get
all the login and motd banner cruft. Has anyone come up with an
elegant way to strip out all the junk so you get just the command and
command output?
You could put some unique character/string in the banner and MOTD and
grep them out while using clogin interactively. Of course you then
wouldn't see that part of the config, as it would need to be a part of
the config!
Right. But that still leaves the device name, spawn ssh ..., prompt
for the password, prompt for the enable password, etc. What I'm
trying to get is the same output as from 'rsh device cmd' except that
it also shows the command.

Thanks,
Lee
Loading...