From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,2bfc0681df5c9b6b X-Google-Attributes: gid1164f8,public From: Peter Mayne Subject: Re: getting Systemconfig Date: 1996/05/20 Message-ID: <319F9C54.CB9@cao.mts.dec.com> X-Deja-AN: 155651749 references: <1996May13.074014.24639@gia.ch> content-type: text/plain; charset=us-ascii organization: Digital Equipment Corporation (Australia) mime-version: 1.0 newsgroups: comp.sys.dec x-mailer: Mozilla 2.01I (WinNT; I) 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 "$1" echo } Header() # header level, title { echo if [ $# -eq 3 ]; then echo "" echo "$secnum $2" else echo "$2" fi } Pre() # begin/end { case $1 in begin) echo "
";;
	end)	echo "
";; 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/$Type_1" if [ -f $Type_1 ]; then Pre begin Cat $Type_1 - Pre end else echo "File not available." fi done } Para() # text { echo "

$1" echo "

" } Explain() # filename, explanation { Header 3 "$1" if [ -f $1 ]; then Para "$2" Pre begin Cat $1 - Pre end else echo "File not available." 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 cron(8) 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 crontab 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 "$i" Pre begin Cat /var/spool/cron/crontabs/$i - Pre end fi done ;; df) Para " The df -k 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 services(4) file associates Internet service names and aliases with the port number and protocol used by the service. " Explain /etc/inetd.conf " The inetd(8) 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 fstab(4) file contains descriptive information about the known file systems and the disk partitions used for swapping (and dumping). The file systems in fstab 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 sendmail.cf(4) file contains configuration information for the sendmail(8) daemon. " Explain /var/adm/sendmail/aliases " The aliases(4) file contains mail aliases. " ;; named) Explain /etc/hosts " The hosts(4) 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 `hostname`. " Explain /etc/svc.conf " The svc.conf(4) 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 xntpd(8) daemon reads this file to configure time synchronisation bewteen specified systems. " ;; rc) Explain /etc/rc.config " The rc.config file contains parameters that the system startup scripts use to boot the system. " ;; route) Explain /etc/routes " The routes(4) file contains the static TCP/IP routes that are defined when the network starts. Routes are defined using route(8). " 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 /etc/routes. " Pre begin netstat -rn Pre end ;; startup) Explain /etc/inittab " The inittab(4) file provides the init(8) 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 /sbin/rc3.d" Para " The following scripts are run by init(8) 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 syslog.conf 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 syslogd(8) 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 /tcb/files/auth" Pre begin find /tcb/files/auth -print|awk -F/ '{print $6}'|grep -v '^$'|grep -v '^\.' Pre end Explain /etc/group " The group(4) 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 "" Header 1 "System Census for `hostname`" Header 2 "`date`" #+ # First, generate the table of contents. #- Header 2 "Table of Contents" echo "
    " for section in $list; do echo "
  1. `Section $section`" done echo "
" #+ # Now, generate the contents. #- secnum=1 export secnum for section in $list; do $0 - $section secnum=`expr $secnum + 1` done echo "
" echo "
Generated by $0 on `date`.
" echo "
Original author: Peter Mayne, Digital Equipment Corporation
" echo "" 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.