Cameron Laird's personal notes on system administration
Table of contents
Jon Udell wrote
Automation and remote access are the
keys to effective system management. Unix shines
in both departments.
He's right, of course. There are two points to make about this:
- apparently this is a matter of opinion. I've encountered
experienced system administrators who come to the office
to solve all problems, and who don't script. I don't
understand it, and I've never seen what I consider adequate
performance from such people, but they're out there, and
perhaps there's something to learn from them;
- where does this leave Windows, Windows95,
WindowsNT, ...? Pretty darn low, in my
estimation--no big change there.
SAGE
code of ethics
My current big-favorite printed text for system-administration
matters is Nemeth et al.'s
Unix
System Administration Handbook. A number of friends and
acquaintances prefer
Essential
System Administration.
Every issue I've seen of
System Administration
magazine has valuable articles.
A wealth of material is available on-line, including
Celeste Stokely's
Unix
Sysadm Resources, and
Frank Fiamingo's excellent
Introduction
to UNIX System Administration, and more tangentially, his
Introduction
to Unix.
Our WebAdmin
column for WebServer
Online covers topics of interest
to system administrators, as do several of our
other
articles.
Network
management is often a big part of system administration.
HP-UX FAQ
Don Libes wrote the definitive late-twentieth century guide to
naming
hosts.
Online Single
Unix reference
Kenton Lee on X
things.
People often ask for archives of already-generated
binaries.
One happy trend is that vendors are making their manuals URLable.
SGI
(alternatively,
here)
and now Sun
and SCO
(including ODT3, OpenServer and UnixWare)
have been the leaders in this, and DEC has plans for the same.
I've got two Ethernet-equipped Unix boxes, and I want them to play
together (via FTP or telnet or such) nicely: what do I do?
Let one be 10.0.0.1, the other 10.0.0.2, suppose the cards are
called "ed", and command
ifconfig ed0 inet 10.0.0.1 netmask 255.255.255.0 up
and
ifconfig ed0 inet 10.0.0.2 netmask 255.255.255.0 up
respectively, to the two of them. For greater convenience,
season /etc/hosts to taste. If necessary,
route add default 10.0.0.2
route add default 10.0.0.1
Sendpage;
tpage, ixobeeper, and the alpha-pager expect script that's part of the
expect contribution. There's an immense market of products to work with
pagers, and I don't begin to keep up with it.
Tuning for performance is a biiiiig topic. Here are sensible
guidelines that I know:
- Keep the run queue below the number of CPUs;
- Keep average CPU utilization below 70% (90%, for some
engineering work);
- Avoid swapping;
- 100 memory utilization is OK;
- Keep disk utilization below 50%. Many, many games can
be played with filesystem lay-out;
Queuing costs. [Recommend ora's System Performance Tuning]
How can I tell how much memory is available on a particular
Unix host? There's no standard answer, as near as I can
tell. Sometimes /dev/kmem is intelligible.
Other keywords which sometimes give useful
results:
- /usr/etc/devinfo
- There are a few systems where something like "wc -c < /dev/mem"
gives the result you'd want.
- /etc/dmesg | grep Physical: | awk '{printf "%.00fMb",
> $2/1024}'). FreeBSD uses /sbin/dmesg.
- getsysinfo(2), with most Unixes from DEC
- hinv, under IRIX
- lscfg, under AIX
- memconfig
- memsize
- "grep physical /var/adm/messages | tail -1"
- monitor
- nlist (clumsy)
- pagesize
- proctool
is apparently available only for Solaris
- prtconf (part of a Solaris installation)
- pstat, as in
/* memcheck.c */
#include <sys/pstat.h>
main()
{
struct pst_static buf;
pstat(PSTAT_STATIC, &buf, sizeof(buf), 0, 0);
printf("Physical RAM = %ldMB\n", buf.physical_memory/256);
}
- pstat_getstatic(1), under HP-UX. Here's an example of its
use, donated by Ian Springer, who verified its correct operation
on systems with over 2 Gb:
/* mem.c - To compile: cc +DAportable -o mem mem.c */
#include <errno.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/pstat.h>
#define BYTES_PER_MB 1048576
main()
{
struct pst_static pst;
union pstun pu;
pu.pst_static = &pst;
if ( pstat( PSTAT_STATIC, pu,
(size_t)sizeof(pst), (size_t)0, 0 ) != -1 ) {
printf( "Physical RAM = %ld MB\n",
(long)( (double)pst.physical_memory * pst.page_size /
BYTES_PER_MB ) );
exit( 0 );
} else {
perror("pstat_getstatic");
exit( errno );
}
}
There are also calculations involving
physmem
and dmesg
I'll explain here some day. An HP-UX
FAQ has
more
on this subject.
- "swapon -s | grep configured"
- sysconf(_SC_PHYS_PAGES)
- sysinfo; also
Magnicomp's sysinfo
- sysctl hw.physmem, under FreeBSD
- Does HP-UX have a sysdiag?
- syslog, for example /var/adm/syslog/syslog.log, often shows it
- table(2)
- top
(also available at a
Northwestern
mirror)
- uerf -R -s 300 | grep memory
- uerf -c oper
- vmstat -T [vmstat [vmstat -P on OSF1]
is widely available, but not all Unixes
recognize -T]
- wsinfo
logdaemon
sudo
hostid is hosted at
squirrel.com,
wimsey.com, and
netcom.com
swatch
is a Perl
script which monitors log files. Its range of action
includes e-mail,
paging, and
SNMP traps.
Cameron
Laird's notes on
system administration/claird@phaseit.net