From: Peter Mayne <peter.mayne@cao.mts.dec.com>
Subject: Re: getting Systemconfig
Date: 1996/05/20 [thread overview]
Message-ID: <319F9C54.CB9@cao.mts.dec.com> (raw)
In-Reply-To: 1996May13.074014.24639@gia.ch
Lukas Huesler wrote:
>
> Hello
>
> I am looking for a tool that generates a report about the actual
> Hardware/System-konfiguration of my AlphaServer's (and even ULTRIX-
> Sytems ?) .
>
> Does anybody now about such a software ?
Try this: it produces HTML. Customise it to your heart's content.
(There's a couple of wrapped lines. The term "an exercise for the reader" comes to mind. 8-)
#!/bin/ksh
#
#+
# Use -help for documentation.
#
# HISTORY
#
# 11-Oct-1995 PJDM
# Creation.
#
# 13-Oct-1995 PJDM
# Tarted up a great deal, ideas from Tony Pitt.
#
# PJDM, Digital Equipment Corporation
#-
Usage()
{
cat << EOF
This script provides a Digital UNIX system with the capacity to be
"self-documenting". When executed, the script produces an HTML document
on standard output. The document describes major and interesting
aspects of the system, such as the uerf boot record (for hardware and
software information), the installed licences, fstab, etc.
Various ksh procedures are provided to ease the inclusion of HTML markers.
EOF
}
Title()
# title
{
echo
echo "<title>$1</title>"
echo
}
Header()
# header level, title
{
echo
if [ $# -eq 3 ]; then
echo "<a name=\"$3\">"
echo "<h$1><a href=\"#_contents\"><b>$secnum</b></a> $2</h$1>"
else
echo "<h$1>$2</h$1>"
fi
}
Pre()
# begin/end
{
case $1 in
begin) echo "<pre>";;
end) echo "</pre>";;
esac
}
Cat()
# filename, stripflag
#+
# cat a file, optionally stripping comment lines (beginning with # and ;)
# and translating HTML special characters.
{
(if [ "$2" = "-" ]; then
grep -v '^#' $1|grep -v '^;'
else
cat $1
fi)|sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
}
Type()
# title, filename...
{
Header 2 "$1"
shift
for Type_1 in $*; do
Header 3 "<tt>$Type_1</tt>"
if [ -f $Type_1 ]; then
Pre begin
Cat $Type_1 -
Pre end
else
echo "<i>File not available.</i>"
fi
done
}
Para()
# text
{
echo "<p>$1"
echo "</p>"
}
Explain()
# filename, explanation
{
Header 3 "<tt>$1</tt>"
if [ -f $1 ]; then
Para "$2"
Pre begin
Cat $1 -
Pre end
else
echo "<i>File not available.</i>"
fi
}
Section()
# tag
{
case $1 in
advfsdmns) echo "Advanced File System (AdvFS) domains";;
crontab) echo "Crontabs";;
df) echo "Mounted Filesystems and Disk Space";;
files) echo "UNIX Internet Configuration Files";;
firewall) echo "Firewall Configuration";;
fstab) echo "Filesystems";;
lmf) echo "Installed LMF licenses";;
lp) echo "Installed Layered Products";;
mail) echo "Mail Configuration";;
named) echo "Domain Name Server and host files";;
ntp) echo "NTP Configuration";;
rc) echo "System Configuration";;
route) echo "Routing Tables";;
startup) echo "System Startup";;
sysdisk) echo "Disklabel of system disk";;
syslog) echo "System Logging Daemon Configuration";;
uerf) echo "System Boot Record";;
uname) echo "System Version";;
users) echo "System Users";;
*) echo '**** UNKNOWN ****';;
esac
}
PATH=/sbin:/usr/sbin:/usr/bin
export PATH
if [ "$1" = "-" ]; then
Header 2 "`Section $2`" $2
case $2 in
advfsdmns)
if [ -d /etc/fdmns ]; then
Para "Information about each AdvFS domain on the system is shown
here."
Pre begin
for i in /etc/fdmns/*; do
fdmn=`basename $i`
showfdmn $fdmn
done
Pre end
else
Para "AdvFS is not in use on this system."
fi
;;
crontab)
Para "
The <tt>cron(8)</tt> daemon runs shell commands
at specified dates and times. Commands that
are to run according to a regular or periodic
schedule are found within the <tt>crontab</tt>
files.
"
Para "The following users' crontab files contain important system tasks."
for i in root adm news; do
if [ -r /var/spool/cron/crontabs/$i ]; then
Header 3 "<tt>$i</tt>"
Pre begin
Cat /var/spool/cron/crontabs/$i -
Pre end
fi
done
;;
df)
Para "
The <tt>df -k</tt> command shows the currently
mounted filesystems, and the disk usage in each
of those filesystems.
"
Pre begin
df -k
Pre end
;;
files)
Explain /etc/services "
The <tt>services(4)</tt> file associates
Internet service names and aliases with the
port number and protocol used by the service.
"
Explain /etc/inetd.conf "
The <tt>inetd(8)</tt> daemon reads this file
for information on how to handle Internet
service requests.
"
;;
firewall)
not_firewall="true";
if [ -d /usr/dfws/ ]; then
Type "Firewall Configuration" /usr/dfws/firewall.conf
Type "Firewall Proxies Configuration" /usr/dfws/config/*
not_firewall="false"
fi
if [ -f /etc/screend.conf ]; then
Type "screend Configuration" /etc/screend.conf
note_firewall="false"
fi
if [ "$not_firewall" = "true" ]; then
Para "This system is not part of a firewall."
fi
;;
fstab)
Explain /etc/fstab "
The <tt>fstab(4)</tt> file contains descriptive
information about the known file systems and
the disk partitions used for swapping (and
dumping). The file systems in <tt>fstab</tt>
are automatically mounted when the system
boots.
"
;;
lmf)
Para "The following products are registered on this system."
Pre begin
lmf list
Pre end
;;
lp)
Para "The following layered products are installed on this system."
Pre begin
setld -i
Pre end
;;
mail)
Explain /var/adm/sendmail/sendmail.cf "
The <tt>sendmail.cf(4)</tt> file contains
configuration information for the
<tt>sendmail(8)</tt> daemon.
"
Explain /var/adm/sendmail/aliases "
The <tt>aliases(4)</tt> file contains mail
aliases.
"
;;
named)
Explain /etc/hosts "
The <tt>hosts(4)</tt> file contains
information regarding the known hosts on the
network.
"
Explain /etc/resolv.conf "
This file defines the DNS nameserver that the
system uses to resolve Internet names such as
<tt>`hostname`</tt>.
"
Explain /etc/svc.conf "
The <tt>svc.conf(4)</tt> file defines how
various system databases are accessed.
"
Type "Domain Name Service files" /etc/namedb/named.boot /etc/namedb/hosts.db
/etc/namedb/hosts.rev /etc/namedb/name.local /etc/namedb/named.ca
;;
ntp)
Explain /etc/ntp.conf "
The <tt>xntpd(8)</tt> daemon reads this file to
configure time synchronisation bewteen
specified systems.
"
;;
rc)
Explain /etc/rc.config "
The <tt>rc.config</tt> file contains parameters
that the system startup scripts use to boot the
system.
"
;;
route)
Explain /etc/routes "
The <tt>routes(4)</tt> file contains the static
TCP/IP routes that are defined when the network
starts. Routes are defined using
<tt>route(8)</tt>.
"
Header 3 "Active routing table"
Para "
The active routing table displays the TCP/IP
routes that are currently being used by the
system. The routes in use should be the same as
those defined by <tt>/etc/routes</tt>.
"
Pre begin
netstat -rn
Pre end
;;
startup)
Explain /etc/inittab "
The <tt>inittab(4)</tt> file provides the
<tt>init(8)</tt> program with instructions for
creating and running initialization processes.
The init program reads the inittab file each
time init is invoked (in particular, when the
system is booted). The file typically contains
instructions for the default initialization,
the creation and control of processes at each
run level, and the getty command, which
controls the activation of terminal lines.
"
Header 3 "Startup scripts in <tt>/sbin/rc3.d</tt>"
Para "
The following scripts are run by
<tt>init(8)</tt> when the system boots.
"
Pre begin
ls /sbin/rc3.d/S*
Pre end
;;
sysdisk)
dev=`awk '$2=="/"' /etc/fstab|awk '{print $1}'`
case $dev in
/dev/*)
rdev=`echo $dev|awk -F/ '{print $3}'`
rdev=/dev/r$rdev
;;
*#*)
rdev=`echo $dev|awk -F# '{print $1}'`
rdev=/dev/r`ls /etc/fdmns/$rdev`
;;
esac
Pre begin
disklabel $rdev
Pre end
;;
syslog)
Explain /etc/syslog.conf "
The <tt>syslog.conf</tt> file contains entries
that specify the facility (the part of the
system that generated the error), the error
message severity level, and the destination to
which the <tt>syslogd(8)</tt> daemon sends the
messages.
"
;;
uerf)
Para "
The uerf command produces a record of system
events. These events include event messages
relating to the system hardware and the
software kernel as well as information about
system status, startup, and diagnostics.
"
Para "
Displayed here is the most recent boot record
for the system, which describes the installed
hardware and the operating system version.
"
Pre begin
uerf -R -r 300|awk 'BEGIN {v=0}/^\*\*\*\*/{v++}/EVENT
CLASS/{v++}{if(v==2)print}'
Pre end
;;
uname)
Para "The operating system name and version:"
Pre begin
uname -a
Pre end
;;
users)
Type "Standard users" /etc/passwd
Header 3 "C2 users in <tt>/tcb/files/auth</tt>"
Pre begin
find /tcb/files/auth -print|awk -F/ '{print $6}'|grep -v '^$'|grep -v '^\.'
Pre end
Explain /etc/group "
The <tt>group(4)</tt> file contains the list of
groups and their members.
"
;;
*)
;;
esac
elif [ "$1" = "-help" ]; then
Usage
else
#+
# Generate the HTML document describing this system.
#-
list='uname uerf rc startup lp lmf fstab df advfsdmns sysdisk files named route
syslog mail users crontab ntp firewall'
Title "System Census for `hostname`"
echo "<body>"
Header 1 "System Census for `hostname`"
Header 2 "`date`"
#+
# First, generate the table of contents.
#-
Header 2 "<a name=\"_contents\">Table of Contents</a>"
echo "<ol>"
for section in $list; do
echo "<li><a href=\"#$section\">`Section $section`</a>"
done
echo "</ol>"
#+
# Now, generate the contents.
#-
secnum=1
export secnum
for section in $list; do
$0 - $section
secnum=`expr $secnum + 1`
done
echo "<hr>"
echo "<address>Generated by $0 on `date`.</address>"
echo "<address>Original author: Peter Mayne, Digital Equipment Corporation</address>"
echo "</body>"
fi
--
PJDM
Digital Equipment Corporation (Australia), Canberra, ACT
--------------------------------------------------------------------------------
These are my opinions, and have nothing to do with Digital.
I design Internet Service Providers. It's a job.
prev parent reply other threads:[~1996-05-20 4:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-13 4:00 getting Systemconfig Lukas Huesler
1996-05-18 4:00 ` Warren Oldroyd
1996-05-20 4:00 ` Peter Mayne [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox