Discussion:
[rancid] Custom devices and ttys
Mark Loveley
2007-10-09 13:09:31 UTC
Permalink
Hi

I'm trying to customize a rancid plugin to work with an Ellacoya e30
which has a very cisco like interface.
clogin works fine from the command line by bails out when run from cron.
David Luyer
2007-10-09 17:37:39 UTC
Permalink
Rather than messing with $LINES and $COLUMNS which are shell convenience
variables, you might have more luck along the lines of:

spawn telnetscript.sh $router

and then in telnetscript.sh

#!/bin/sh
stty rows 1024
stty cols 1024
exec telnet $*

I don't have the device in question to test, so, good luck! :)

David.
Post by Mark Loveley
Hi
I'm trying to customize a rancid plugin to work with an Ellacoya e30
which has a very cisco like interface.
clogin works fine from the command line by bails out when run from cron.
Mark Loveley
2007-10-10 10:41:40 UTC
Permalink
Post by David Luyer
Rather than messing with $LINES and $COLUMNS which are shell
convenience
#!/bin/sh
stty rows 1024
stty cols 1024
exec telnet $*
Already been down this path. Unfortunately cron has no controlling
pty and so the script errors with a stty error.

couldn't write file "/dev/tty": no such device or address
while executing
"exec /bin/stty cols 140 >/dev/tty"
invoked from within
"stty cols 140"

I tried this by using the stty command within the expect script, as
expect sees stty as a valid option. from the man page:-
stty args
changes terminal modes similarly to the external stty
command.

Thanks
--
| Mark Loveley Broadband Solutions for
| Network Engineer home and business
| PlusNet PLC @www.plus.net
| Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY
| Registered in England no: 3279013
+ ------------ PlusNet - The smarter way to broadband ----------------+
David Luyer
2007-10-10 16:52:38 UTC
Permalink
Post by Mark Loveley
Post by David Luyer
Rather than messing with $LINES and $COLUMNS which are shell
convenience
#!/bin/sh
stty rows 1024
stty cols 1024
exec telnet $*
Already been down this path. Unfortunately cron has no controlling
pty and so the script errors with a stty error.
couldn't write file "/dev/tty": no such device or address
while executing
"exec /bin/stty cols 140 >/dev/tty"
invoked from within
"stty cols 140"
I tried this by using the stty command within the expect script, as
expect sees stty as a valid option. from the man page:-
stty args
changes terminal modes similarly to the external stty
command.
The approach you tried failed because there is no tty at this point.
However if you try the exact approach above (wrapping telnet and using
spawn to call the wrapper) there is a tty. That's exactly what expect
does (creates a tty).

David.
Mark Loveley
2007-10-11 09:30:31 UTC
Permalink
Post by David Luyer
The approach you tried failed because there is no tty at this point.
However if you try the exact approach above (wrapping telnet and using
spawn to call the wrapper) there is a tty. That's exactly what expect
does (creates a tty).
Suddenly the light dawns and I see what you are saying. That works
fine for me.
I'll tidy up my scripts and if anyone is interested send them in.

Thanks for your help.
--
| Mark Loveley Broadband Solutions for
| Network Engineer home and business
| PlusNet PLC @www.plus.net
| Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY
| Registered in England no: 3279013
+ ------------ PlusNet - The smarter way to broadband ----------------+
john heasley
2007-10-09 17:40:54 UTC
Permalink
Post by Mark Loveley
Hi
I'm trying to customize a rancid plugin to work with an Ellacoya e30
which has a very cisco like interface.
clogin works fine from the command line by bails out when run from cron.
Mark Meijerink
2007-10-10 08:52:40 UTC
Permalink
Hi there,

I there a how-to guide or something alike to add a new vendor type to rancid? Which steps are neccesary to add a new vendor and which files do I have to edit. Thanks in advance.

Regards,
Mark
Mark Loveley
2007-10-10 11:22:41 UTC
Permalink
This post might be inappropriate. Click to display it.
john heasley
2007-10-10 17:09:16 UTC
Permalink
Post by Mark Loveley
I think you've identified the problem correctly, the screen height
of zero
affecting a broken pager. Normally rancid sets the TERM to
"network" in
rancid.conf, which implies a height of 0. AND, clogin sends the
command
'term length 0' to disable the pager. Assuming your device does not
recognize the 'term length' command, try setting TERM to something
which
normally has a fixed height, such as vt100.
Unfortunately I had already tried vt100 as a TERM type. My issue is
that when launched from cron it doesn't even get to disabling the pager.
from the command line It reads the banner, matches the login prompt
"Login:", sends my username, matches the password prompt "Password:"
and sends my password, and gets logged in.
from cron it matches the login prompt, but the device never prints
the password prompt, just a "Press any key to continue (Q to quit)",
if thats matched it sends "any key" and gets the same prompt back.
So when connecting via cron I never get the chance to disable the
pager (btw on this system the command needed is "no more" which is
why I created a custom login script called e30login).
Another possibility is to use hlogin, which has become somewhat the
home
of the bastard children, with the addition of a stty command to
hard-code
the height to something greater than 0. Note that hlogin also
tries to
disable the pager with HP's 'no page' command.
hlogin seems to spawn hpuifilter which I assume only strips nasty
control characters.
Using this from the command line I've no yet managed to get it to login.
tried hlogin or hpuifilter? try hlogin, which allocates a pty for
telnet/ssh.
Post by Mark Loveley
How do you suggest using stty to set the height? See my previous
email for examples for failures using that from cron.
As david luyer said, spawn should allocate a pty for you, which should
give you a controlling terminal. so, I think that

stty whatever > spawn_out(slave,name)

will affect the slave (telnet/ssh) side of the pty
Mark Jones
2007-10-10 20:26:30 UTC
Permalink
I have rancid polling all my routers once every hour. There is one device
that I would prefer to not poll that often. is there an easy way to do that?
Jon Lewis
2007-10-10 20:32:24 UTC
Permalink
Post by Mark Jones
I have rancid polling all my routers once every hour. There is one device
that I would prefer to not poll that often. is there an easy way to do that?
You could put it in its own group, and then explicitly do-diffs for each
group hourly, except for that one.

----------------------------------------------------------------------
Jon Lewis | I route
Senior Network Engineer | therefore you are
Atlantic Net |
_________ http://www.lewis.org/~jlewis/pgp for PGP public key_________
Saku Ytti
2007-10-11 05:44:27 UTC
Permalink
Post by Mark Jones
I have rancid polling all my routers once every hour. There is one device
that I would prefer to not poll that often. is there an easy way to do that?
What I do, to accomplish same:
0 0,6,12,18 * * * nice -n19 rancid-run
00 23 * * sat nice -n19 rancid-run CPE
--
++ytti
Saku Ytti
2007-10-11 05:46:49 UTC
Permalink
Post by Saku Ytti
Post by Mark Jones
I have rancid polling all my routers once every hour. There is one device
that I would prefer to not poll that often. is there an easy way to do that?
0 0,6,12,18 * * * nice -n19 rancid-run
00 23 * * sat nice -n19 rancid-run CPE
Forgot to mention, that you should also remove 'CPE' from $LIST_OF_GROUPS
in rancid.conf.
--
++ytti
Allen Tsang
2007-10-11 12:16:22 UTC
Permalink
For those that didn't understand the explanation (I found it a little
too terse and lacking), the idea to to separate your routers and devices
into groups based on your polling interval.

So for example, you have four groups: general, testing, monitor_weekly
and monitor_daily, such that general is updated every 15 minutes, a
testing group is never updated automatically (for testing all those
fancy netscaler hacks you've picked up on this mailing-list ;p),
monitor_weekly gets polled once every Saturday at 2am and monitor_daily
is polled every day at 4am.

You would set up three crontab entries (you don't need testing, because
well, it's only for testing, right?):

*/15 * * * * rancid-run general
0 4 * * * rancid-run monitor_daily
0 2 * * sat rancid-run monitor_weekly

You would never want to run rancid-run, since that would cycle through
the whole list of groups defined in your rancid.conf.

Note that now you would have to set up mail aliases for all these new
groups, if you want to still receive notifications from them. This is
the one major minus about partitioning all your stuff into separate
groups; if your infrastructure's mail configuration is ... complicated
... like mine is, it's a real PITA.

This is the sort of stuff that belongs on the wiki, which I may get
around to doing this weekend (I just had a pretty bad on-call week;
sysadmining is hard :/ )

- allen tsang
Post by Saku Ytti
Post by Saku Ytti
Post by Mark Jones
I have rancid polling all my routers once every hour. There is one device
that I would prefer to not poll that often. is there an easy way to do that?
0 0,6,12,18 * * * nice -n19 rancid-run
00 23 * * sat nice -n19 rancid-run CPE
Forgot to mention, that you should also remove 'CPE' from $LIST_OF_GROUPS
in rancid.conf.
Lance
2007-10-10 16:21:32 UTC
Permalink
Mark,

Off the top of my head without looking in places.

rancid-fe
create a new rancid file for the vendor (this file should call the login
file)
create a new login file for the new vendor

That is my two cents.
-------- Original Message --------
Date: Wed, October 10, 2007 1:52 am
Hi there,
I there a how-to guide or something alike to add a new vendor type to rancid? Which steps are neccesary to add a new vendor and which files do I have to edit. Thanks in advance.
Regards,
Mark
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...