[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need "console switch" - any ideas?




We have a lot of Sun boxes here that bring up the requirement that if
the console server should happen to catch on fire, be infested with
rabid lemmings, or simply go down it cannot cause all the systems
attached to it to fail.

To combat this we bought 1 Aurora LMS1000 SBus expander and 3 Aurora
1600SE 16-port expanders and hooked them up to an old Sparc 5.  This
gives us 48 tty's to hook a system's console into.  When the drivers
for these are installed they will catch the "break" signal that is
normally sent out to all the ttys.

Not wanting to spend the $8K or so to buy the "officially supported"
console management software, I took a look at both Purdue's console
server and Doug Hughes' code.

 	ftp://ftp.physics.purdue.edu/pub/pundits/README.html
	http://www.eng.auburn.edu/users/doug/console.html

Both were interesting, both had major drawbacks.  For Doug's it was
the inability to have everything setup automatically during a reboot
(/etc/init.d type script), for Purdue's I really wanted the
file-transfer capabilities of tip(1) in case something goes
drastically wrong and files need to be transferred over the serial
cable.  Hmmmm...

I borrowed some code and wrote my own console management software.

During boot, each console is started like this:

  cat /etc/remote | {
    while read line
    do
      hostconsole=`echo $line | grep console`
      if [ -n "$hostconsole" ]; then
        host=`echo ${hostconsole} | awk -F. '{print $1}'`
        echo "Starting console server for $host..."
        pty -i console.d $host < /dev/null 2>&1 | cat -v >> \
		/var/adm/log/consolelogs/$host.console &
        sleep 1
      fi
    done
  }

An example entry from /etc/remote is this:

arrakeen.console:\
        :dv=/dev/term/8:br#9600:el=^C^S^Q^U^D:ie=%$:oe=^D:

pty is from Stevens, "Advanced Programming in the Unix Environment",
Addison Wesley.  console.d starts up screen(1) and tip(1) for each
host like so:

	host="$1.console"
	screen -h 10 -S $host -t $host tip $host

To interface with all the systems consoles, you use a script called
'console'.  Here's the output of `console -h`:

Usage:  console [-a host] [-r host] [-s] [-l] [-v] [-h] 
  -a attach to host
  -l list managed consoles
  -v print version
  -r remove lock for host
  -s print directions on how to spy on somebody
     already attached to a system's console.

You'll notice the "-s" option prints directions on how to spy on
somebody already attached.  This is done via ttywatcher(1).  
Additionally ttywatcher will allow you to "share" the same tty via
STREAMS interface so that two sysadmins can debug a 3 AM brush fire
together.

	ftp://coast.cs.purdue.edu/pub/tools/unix/ttywatcher/

While at first this may seem complicated, it's quite simple.  Best of
all, everyone knows how RS-232 works, and tip makes a beautiful
interface to that.  You always know what is going on at each point of
the connection.

--Greg

conserver	/etc/init.d script that uses /etc/remote
		for config and calles console.d
console.d	starts up screen and tip for each console
screen		everyone's favorite program
tip		swiss knife of serial port utilities
console		easy CLUI to everything, including help
pty		standard pseudo-terminal program
ttywatcher	STREAMS implementation for spying on terminals

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Greg Baker, CTS Systems, x:59720 greg.baker@amd.com
BOFH: Evil dogs hypnotized the night shift
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=