#!/sbin/sh # # @(#) $ Revision: A.01.02 $ $ Author: Robert Sakic $ $ Date: April 1999 $ # ############################################################################### # # N I C K E L # # Network related Information Collector, Keeper and Elaborator # ############################################################################### # # # DESCRIPTION: yet another script to collect data, will display the # collected data as html. # ############################################################################### # # Copyright 1996 - 1999 Robert Sakic, HP # ALL RIGHTS RESERVED. # # Permission granted to use this script so long as the copyright above # is maintained, and credit is given for any use of the script. # ############################################################################### # # !!!! Legal Stuff !!!!! # ############################################################################### # # Copyright (C) 1996,1997,1998,1999 Hewlett-Packard Company # # The enclosed software and documention includes copyrighted works of # Hewlett-Packard Co. For as long as you comply with the following # limitations, you are hereby authorized to (i) use, reproduce, and # modify the software and documentation, and to (ii) distribute the # software and documentation, including modifications, for # non-commercial purposes only. # # 1. The enclosed software and documentation is made available at no # charge in order to advance the general development of support of # networking products. # # 2. You may not delete any copyright notices contained in the # software or documentation. All hard copies, and copies in # source code or object code form, of the software or # documentation (including modifications) must contain at least # one of the copyright notices. # # 3. The enclosed software and documentation has not been subjected # to testing and quality control and is not a Hewlett-Packard Co. # product. At a future time, Hewlett-Packard Co. may or may not # offer a version of the software and documentation as a product. # # 4. THE SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS". # HEWLETT-PACKARD COMPANY DOES NOT WARRANT THAT THE USE, # REPRODUCTION, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR # DOCUMENTATION WILL NOT INFRINGE A THIRD PARTY'S INTELLECTUAL # PROPERTY RIGHTS. HP DOES NOT WARRANT THAT THE SOFTWARE OR # DOCUMENTATION IS ERROR FREE. HP DISCLAIMS ALL WARRANTIES, # EXPRESS AND IMPLIED, WITH REGARD TO THE SOFTWARE AND THE # DOCUMENTATION. HP SPECIFICALLY DISCLAIMS ALL WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # # 5. HEWLETT-PACKARD COMPANY WILL NOT IN ANY EVENT BE LIABLE FOR ANY # DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES # (INCLUDING LOST PROFITS) RELATED TO ANY USE, REPRODUCTION, # MODIFICATION, OR DISTRIBUTION OF THE SOFTWARE OR DOCUMENTATION. # ############################################################################### # Colors used in the script, change them for your needs FCOL=RED # Font Color for emphasized Text FCOL2=BLUE # Heading Font Color BGCOL=WHITE # Page Background Color HCOL=D1D1D1 # Heading Background Color ############################################################################### # # No need for changes below this line. # ############################################################################### BASE=`basename $0` HOST=`hostname` OUT_DIR=/tmp/$BASE.$HOST PATH=/usr/sbin:/usr/bin:/usr/contrib/bin:$PATH ORB_SBIN=/opt/orbplus/sbin ORB_LBIN=/opt/orbplus/lbin SBIN=/sbin UBIN=/usr/bin USBIN=/usr/sbin OS=$(uname -r | awk -F. '{print $2}') OsRel=`uname -r | awk -F. '{print $2"."$3}'` function _usage { print $* print "\nUsage: $0 [ -m <email addr> | -o <out dir> | -p <alt path> | -n | -? ]\n\nOptions:\n\t-m <email address>\tEmail the shar archive to <email address>\n\t-o <output directory>\tWhere to direct the output\n\t-p <alternate path>\tWhere to put the directory instead of /tmp\n\t-n\tDon't create shar archive\n\t-?\tshow this Help Menu\n You must be root to run this. This Script will collect System relevant data and save it either in a shar archive in the current directory (no options) or in a directory named /tmp/$BASE.hostname (e.g. /tmp/$BASE.$HOST) for the -n option. The -p option changes the directory name to $BASE.$HOST in the directory given by the path specified in the argument. Unless you've redirected your output with the -o option, you'll find a file called index.html in the /tmp/$BASE.$HOST directory, open it with your favourite Web browser to see the output of the script." exit 1 } function _init { _need_root _need_os SHAR=YES EMAIL=NO while getopts :nm:p:o: opt do case $opt in n) SHAR=NO ;; m) EMAIL=YES EMAILADDR=$OPTARG ;; o) OUT_DIR=$OPTARG ;; p) OUT_DIR=$OPTARG/$BASE.$HOST ;; :) _usage "The -m, -o and -p options require an argument."; ;; ?) if [ $OPTARG != "?" ] ; then _usage "invalid option $OPTARG" else _usage fi ;; esac done if [[ $SHAR = "NO" && $EMAIL = "YES" ]]; then _usage "\tYou must generate a shar archive to use the -m option" "\n\tRemove the -n from the command line"; fi _common } function _need_root { if [[ `id -u` != "0" ]] then echo "\nERROR: Your User ID appears to be: `id -u`\n" echo "Sorry, but you must have root privileges to run this script.\n" exit 1 fi } function _need_os { if [[ $OS != "10" && $OS != "11" ]] then echo "\nERROR: This Script supports only HP-UX 10 or HP-UX 11" exit 1 fi } function _make_directory { clear if [[ -d $OUT_DIR ]]; then echo "###\n###\tRemoving results left over from a previous run in" echo "###\t\t$OUT_DIR" echo "###" rm -rf $OUT_DIR fi mkdir $OUT_DIR LOGFILE=$OUT_DIR/nickel.log } ### HTML functions start here ### function _heading { echo "<P><P>\n<CENTER><TABLE WIDTH="100%"> <TR><TD align=center bgcolor=$HCOL><B> <FONT FACE="Helvetica, Arial" SIZE=+2 COLOR=$FCOL2>$1 $2 $3 $4 $5</FONT>\n</TABLE></CENTER><P>" } function _footer { echo "</PRE>\n</BODY></HTML>" } function _item { echo "<BR><B><FONT COLOR=$FCOL>$1 $2 $3 $4 $5 $6</FONT></B>" } function _title { echo "<HTML><HEAD><TITLE>`basename $1` $2 $3 $4 $5</TITLE></HEAD> <BODY BGCOLOR=$BGCOL>" _heading `basename $1` $2 $3 $4 $5 echo "\n<PRE>" } ############################################################################## # # START RG # Start of functions added by Roger Goff, HP, 12/98 for providing # additional information in the index.html file # ############################################################################## ### ### _mhz: report the machine MHz value ### function _mhz { echo `echo itick_per_tick/D | adb -k /stand/vmunix /dev/kmem \ | grep "000" | awk '{print $2/10000 " MHz" }' ` } ### ### WHICH_PARAM: pick the appropriate kernel parameters to query ### function WHICH_PARAM { if [[ $OsRel = "10.01" ]] then KernelSoftPage="__maxphysmem" SoftPgUnits="bytes" KernelRam=mem_ptr MbConversion=1048576 # For converting Physical Mem to MB elif [[ $OsRel = "10.10" || $OsRel = "10.20" ]] then KernelSoftPage="__maxphyspages" SoftPgUnits="4K" KernelRam=mem_ptr MbConversion=1048576 # For converting Physical Mem to MB elif [[ $OsRel = 11.+([0-9]) ]] then KernelSoftPage="__maxphyspages" KernelRam="memory_installed_in_machine" SoftPgUnits="4K" MbConversion=256 # For converting Physical Mem to MB fi } ### ### GET_REAL_MEMORY: Find out how much PHYSICAL memory ### is in the system (regardless of what the soft ### page parameter is) ### function GET_REAL_MEMORY { Kernel=/stand/vmunix PhysicalMemory=`print "$KernelRam/U" | adb -k $Kernel /dev/kmem | \ grep $KernelRam | awk '{ if (NF == 2) { print $2 }}'` # For HP-UX 10.X, the amount of memory is reported in bytes. # For HP-UX 11.X, the amount of memory is reported in 4K pages. eval `print | \ awk '{ printf "PhysicalMemory=%d\n", Val / Conversion; }' Val=$PhysicalMemory, Conversion=$MbConversion ` # Check to see if we got a non-null, numeric answer if [[ ! -z $PhysicalMemory ]] && [[ $PhysicalMemory = +([0-9]) ]] then if (( $PhysicalMemory )) then echo "\n\t$PhysicalMemory MB" fi fi } ### ### GET_SOFT_PAGES: Get soft page parameter ### function GET_SOFT_PAGES { Kernel=/stand/vmunix SoftPgs=`print ${KernelSoftPage}?D | adb $Kernel - | \ grep $KernelSoftPage | awk '{ if (NF == 2) {print $2}}'` # Check to see if we got a non-null, numeric answer if [[ ! -z $SoftPgs ]] && [[ $SoftPgs = +([0-9]) ]] then if (( SoftPgs )) then if [[ $SoftPgUnits = 4K ]] then (( SoftPgs /= 256 )) else (( SoftPgs /= 1024 )) fi # Only print out soft pages if memory has been soft-paged down. echo "\tKernel has been soft paged down to $SoftPgs MB" fi fi } ### ### _ram: get system ram amount ### function _ram { WHICH_PARAM GET_REAL_MEMORY GET_SOFT_PAGES } ### ### OS_VERSION: determine version of the operating system, and ### use this information to set a shell variable, ### OsVersion, which can then be used to determine ### the appropriate action to take. ### function OS_VERSION { if [[ $OsRel = 10.+([0-9]) ]] then OsVersion=10 NUMBEROFBITS="32-bit" else OsVersion=11 NUMBEROFBITS=`getconf KERNEL_BITS`-bit fi } ### ### GET_CPU_INFO ### function GET_CPU_INFO { # First get the CPU version (i.e., PA1.1, PA2.0, etc.) Version=$(print ${HWRevParameter}/X | adb -k $Kernel /dev/kmem \ | sed -e "s/$HWRevParameter: //" -e "/$HWRevParameter:$/d" \ | awk '{print $2}') Revision=$(print ${RevParameter}/X | adb -k $Kernel /dev/kmem \ | sed -e "s/${RevParameter}: //" -e "/${RevParameter}:$/d"\ | awk '{print $2}') } ### ### _cpuversion ### function _cpuversion { HWRevParameter=cpu_version RevParameter=cpu_revision_number Kernel=/stand/vmunix GET_CPU_INFO if [[ $Version = 214 ]] # If the processor is a PA2.0, then Version=PA-RISC2.0 else Version=$(grep 0x$Version /usr/include/sys/unistd.h | awk '{print $7}') fi echo "${Version}" } ### ### _revision ### function _cpurevision { HWRevParameter=cpu_version RevParameter=cpu_revision_number Kernel=/stand/vmunix GET_CPU_INFO if [[ $Version = 214 ]] # If the processor is a PA2.0, then Major=${Revision%%0*} Minor=${Revision#*0} Revision=v${Major}.${Minor} else Revision=shit${Revision#@([0-9]|[A-F])@([0-9]|[A-F])@([0-9]|[A-F])@([0-9]|[A-F])@([0-9]|[A-F])@([0-9]|[A-F])@([0-9]|[A-F])} if [[ Revision = 7 ]] then Revision=v2.2 elif [[ Revision = 8 ]] then Revision=v2.3 elif [[ Revision = 9 ]] then Revision=v2.4 elif [[ Revision = A ]] then Revision=v2.5 elif [[ Revision = B ]] then Revision=v2.6 else Revision="Unknown Rev." fi fi echo "${Revision}" } ### ### _graphicsdev ### function _graphicsdev { set -A GRAPHDEV `grep -i -e '^\/' -e '^Screen' /usr/lib/X11/X0screens` (( ${#GRAPHDEV[*]} > 1 )) && GRAPHDEV=${GRAPHDEV[1]} } ############################################################################## # # END RG # End of functions added by Roger Goff 12/98 for providing additional # information in the index.html file # ############################################################################## function _index_html { OS_VERSION echo "<HTML><HEAD><TITLE>System Information for $HOST</TITLE></HEAD> <BODY BGCOLOR=$BGCOL>\n<CENTER><TABLE WIDTH="100%">\n <TR><TD align=center bgcolor=$HCOL><B> <FONT FACE="Helvetica, Arial" SIZE=+2 COLOR=$FCOL2> System Information</FONT><FONT SIZE=+2> for <FONT COLOR=$FCOL2>$HOST</FONT><BR> `date`</B></FONT></TD></TR> <TR><TD align=right><FONT FACE="Helvetica, Arial" SIZE=-1><B> `grep Revision: $0 | grep -v awk | awk '{print $5}'` </B></FONT></TD></TR> </TABLE></CENTER> <P>\n<TABLE><TR> <TD><B><FONT COLOR=$FCOL>OS:</FONT></B>" "`uname -r`", "`echo $NUMBEROFBITS`" " <TD><B><FONT COLOR=$FCOL>HW:</FONT></B>" "`model -D` <TD><B><FONT COLOR=$FCOL>RAM:</FONT></B>" "`_ram` </TR><TR>\n<TD><B><FONT COLOR=$FCOL>Uptime:</FONT></B> `uptime|awk '{print $3,$4,$5}'` hours <TD><B><FONT COLOR=$FCOL>CPU:</FONT></B> " "`_mhz`", " `_cpuversion`", " `_cpurevision`</TD><TD></TD> </TR></TABLE> <P><A HREF="software.html">installed software</A> `_create_link $UBIN/bdf` `_create_link $USBIN/dmesg` `_create_link /usr/bin/cat /etc/fstab` `_create_link2 $UBIN/graphinfo $GRAPHDEV` `_create_link $UBIN/ipcs -bcop` `_create_link $UBIN/locale` `_create_link /etc/mount -p` `_create_link $UBIN/ps -ef` `_rclog` <A HREF="sendmail.html">sendmail</A> `_create_link $USBIN/showmount -a 2> $LOGFILE` `_shutdownlog` `_create_link /etc/swapinfo` `_create_link $USBIN/sysdef` <A HREF="syslog.html">syslog</A> <A HREF="hfsinfo.html">tunefs -v</A> `_create_link $USBIN/vgdisplay -v` `_create_link $UBIN/what /stand/vmunix` `_heading Hardware / Diagnostic` `_create_link $USBIN/ioscan -fn` `_create_link $UBIN/strings /etc/lvmtab` `_diskinfo` `_diag_proc` `_cstm $USBIN/cstm` `_heading Network` \n<B><FONT COLOR=$FCOL>lanscan:</FONT></B> <PRE>`lanscan`</PRE><BR> <A HREF="network.html">Network Information</A><P>" } function _create_link { if [ -x $1 ]; then if [ -f $1 ]; then NAME=`basename $1` echo "<A HREF=\"$NAME.html\">$NAME $2</A> " _common_function $1 $2 > $OUT_DIR/$NAME.html fi fi } function _create_link2 { if [ -x $1 ]; then if [[ -f $1 && "`$1`" != "" ]]; then NAME=`basename $1` echo "<A HREF=\"$NAME.html\">$NAME $2</A> " _common_function $1 $2 > $OUT_DIR/$NAME.html fi fi } function _common_function { if [ -f $1 ]; then _title $1 $2 _item `basename $1` $2 echo "\n" $1 $2 _footer fi } function _copy_file { if [ -f $1 ] ; then cp $1 $OUT_DIR/$2 fi } function _cp_all_files { BASE_all=`basename $1` if [ $2 != "0" ]; then echo "<A HREF=\"$BASE_all\">$1</A>" fi cp -R $1 $OUT_DIR } function _cat_file { if [ -f $1 ]; then echo "<P>`_item $1`\n <PRE>\n`cat $1`\n</PRE>\n" fi } function _common { echo "NICKEL StartUp" _make_directory echo "\n\tcollecting system information..." _index_html > $OUT_DIR/index.html _hfsinfo > $OUT_DIR/hfsinfo.html echo "\n\tchecking installed software..." _installed_software > $OUT_DIR/software.html _sendmail > $OUT_DIR/sendmail.html echo "\n\tlooking at logfiles..." _syslog > $OUT_DIR/syslog.html echo "\n\tcollecting network information..." _laninfo > $OUT_DIR/network.html echo "\n\tchecking for optional software..." # check if System OpenView infected, i.e. TMN, NNM, ITO if [ -f /opt/OV/bin/ov.envvars.sh ]; then . /opt/OV/bin/ov.envvars.sh _ovstatus > $OUT_DIR/ovstatus.html if [ -f $OV_CONF/local_p_addr ]; then echo "\t\t * OpenView TMN" export PATH=$PATH:/opt/OV/bin _tmnindex >> $OUT_DIR/index.html _tmn > $OUT_DIR/tmn.html _nnm > $OUT_DIR/nnm.html elif [ -f $OV_BIN/ovw ]; then export PATH=$PATH:/opt/OV/bin echo "\t\t * OpenView Network Node Manager" _nnmindex >> $OUT_DIR/index.html _nnm > $OUT_DIR/nnm.html fi if [ -f $OV_BIN/OpC/opc ]; then export PATH=$PATH:/opt/OV/bin echo "\t\t * OpenView ITO" _itoindex >> $OUT_DIR/index.html _ito > $OUT_DIR/ito.html fi if [ -f $OV_NODELOCK/nodelock ]; then _licensing > $OUT_DIR/ifor.html fi fi _openmail # OpenMailing? _omniback # OmniBack? _sg # Service Guard involved? _orbplus # any ORB around? _isdn # ISDN ready? _x25 # X.25 somewhere ? _sna # SNA ? _y2k # Year 2000 Check ! echo "<FONT SIZE=-1 color=$FCOL2>`what $0`</font> </FONT></BODY></HTML>" >> $OUT_DIR/index.html if [ ${SHAR} = YES ]; then echo "\n\n" shar -CZtusemc $OUT_DIR > $BASE.$HOST.shar rm -rf $OUT_DIR echo "\n\tCreated shar file: $BASE.$HOST.shar" if [ ${EMAIL} = YES ]; then /usr/bin/mailx -s "Nickel tool output for $HOST" $EMAILADDR < $BASE.$HOST.shar fi fi } function _inetd { _title inetd echo "</PRE><table cellpadding=9><tr> <td><A HREF=\"#_iconf\">inetd.conf</A></td> <td><A HREF=\"#_isec\">inetd.sec</A></td> </table><HR><PRE>\n<A NAME=\"_iconf\">" _cat_file /etc/inetd.conf echo "\n<HR>\n<A NAME=\"_isec\">" _cat_file /var/adm/inetd.sec _footer } function _rclog { FILE=rclog.html echo "<A HREF=\"$FILE\">rc.log</A> " echo "`_title /etc/rc.log` `_cat_file /etc/rc.log` `_footer`" > $OUT_DIR/$FILE } function _shutdownlog { FILE=shutdown.html echo "<A HREF=\"$FILE\">shutdownlog</A> " echo "`_title /var/adm/shutdownlog` `_cat_file /var/adm/shutdownlog` `_footer`" > $OUT_DIR/$FILE } function _cstm { if [ -f $1 ]; then if [ "`swlist -l product|grep \"^ PHSS_14407\"`" ]; then echo "PHSS_14407 installed!" else FILE1=cstm.html FILE2=cstm_cpu.html echo "<A HREF=\"$FILE1\">Diagnostics</A> <A HREF=\"$FILE2\">CPU Diagnostics</A> " echo "Map\nSelAll\nInformation ; wait InfoLog\nDone\nExit\nOK" >$OUT_DIR/cstm_i echo "`_title DIAGNOSTICS``$USBIN/cstm -f $OUT_DIR/cstm_i` `_footer`" > $OUT_DIR/$FILE1 echo "SelClass type \"Processor\" qualifier \"CPU\" hwpath \"\" Information ; wait\nInfoLog\nDone\nExit\nOK" >$OUT_DIR/cstm_c echo "`_title CPU DIAGNOSTICS` `$USBIN/cstm -f $OUT_DIR/cstm_c` `_footer`" > $OUT_DIR/$FILE2 rm $OUT_DIR/cstm_c $OUT_DIR/cstm_i fi fi } function _diskinfo { echo "<A HREF=diskinfo.html>Diskinfo</A> " echo "`_title Diskinfo``_item diskinfo -v`" >$OUT_DIR/diskinfo.html for i in `ls /dev/rdsk/c*` do diskinfo -v $i 2> $LOGFILE echo "\n" >> $OUT_DIR/diskinfo.html done >> $OUT_DIR/diskinfo.html echo "`_footer`" >> $OUT_DIR/diskinfo.html } function _diag_proc { FILE=diagproc.html echo "<A HREF=\"$FILE\">Diag SW/Proc's</A> " echo "`_title Diag related SW/Processes``_item SW`">$OUT_DIR/$FILE echo "`swlist -l product | grep -i -e upp -e red -e iag`\n\n \n`_item Processes`\n`ps -ef | grep -i -e mon -e log | grep -v rlog` `_footer`" >> $OUT_DIR/$FILE } function _services { _title /etc/services _cat_file /etc/services _footer } function _laninfo { _title Network Information echo "\t`_netstat`\t`_gated`\t`_name_resolution`\n `_cp_all_files /etc/rc.config.d 1`\t`_create_link /usr/sbin/arp -a`\t\t`_services>$OUT_DIR/services.html`<A HREF=services.html>/etc/services</A>\n\t" _inetd > $OUT_DIR/inetd.html echo "\t<A HREF=inetd.html>inetd.sec/conf</A>\n<HR> `_item lanscan`\n\n`lanscan`<HR> `_item ioscan -fnC lan`\n`ioscan -fnC lan`<HR> `_item ifconfig/ping/linkloop/nslookup for every LANIC`\n</PRE>\n" for LANIC in `lanscan -i|awk '{print $1}'|grep -v atm|grep -v cip|grep -v el10` do export MACADDR=`lanscan|grep $LANIC | awk '{print $2}'` if [[ $OS = "10" ]]; then export MACTYPE=`lanscan|grep $LANIC | awk '{print $8}'` export LINKLOOPIF=$LANIC else export MACTYPE=`lanscan|grep $LANIC | awk '{print $7}'` export LINKLOOPIF=`lanscan -ip|grep $LANIC | awk '{print $NF}'` fi export NMID=`lanscan|grep " $LANIC "| awk '{print $7}'` STATUS=0 if [ "`lanscan | awk '/'$LANIC'/ && !/awk/ {print $6}'`" != "DOWN" ]; then if [ `ifconfig $LANIC|awk '/inet/ && !/awk/ {print $2}'` ]; then STATUS=1 IPADDR=`ifconfig $LANIC|awk '/inet/ && !/awk/ {print $2}'` export IFNAME=`nslookup $IPADDR | awk '/Name:/ && !/awk/ {print $2}'` export IFSHORT=`echo $IFNAME|cut -d . -f1` fi fi echo "<TABLE BORDER>\n<TR>\n<TH><B><FONT COLOR=$FCOL>$LANIC</FONT>:</B> </TR>\n<TR> <TD VALIGN=CENTER ALIGN=CENTER><B>ifconfig:</B> <TD VALIGN=BOTTOM ALIGN=LEFT> <PRE>`ifconfig $LANIC|sed 's/</\</'|sed 's/>/\>/`</PRE> </TR> `_linkloop $NMID $MACADDR $LINKLOOPIF` `_lanadmin $NMID $LANIC` `_ping $IPADDR` `_nslookup $IPADDR` `_nslookup $IFSHORT` </TABLE>\n<P>" done echo "</BODY></HTML>" } function _linkloop { if [[ $MACTYPE != "X25" && $MACTYPE != "FDDI" ]]; then export INSTANCE=$3 if [[ $OS = "10" ]]; then export INSTANCE=$1 fi echo "<TR VALIGN=CENTER ALIGN=CENTER> <TD><B>linkloop:</B> <TD VALIGN=BOTTOM ALIGN=LEFT><PRE>`linkloop -i$INSTANCE $2`</PRE> </TR>" fi } function _gated { echo "<A HREF="gated.html">gated information</A> " echo "`_title gated`\n<P>`what /usr/sbin/gated`<P><HR><P> `_cat_file /etc/gated.conf`" > $OUT_DIR/gated.html } function _lanadmin { if [[ $MACTYPE != "X25" ]]; then export INSTANCE=$2 if [[ $OS = "10" ]]; then export INSTANCE=$1 fi echo "<TR VALIGN=CENTER ALIGN=CENTER> <TD><B>lanadmin:</B> <TD VALIGN=BOTTOM ALIGN=LEFT><PRE>`lanadmin -m $INSTANCE`\n`lanadmin -s $INSTANCE`\n`lanadmin -x $INSTANCE 2> $LOGFILE`</PRE> </TR>" fi } function _ping { if [[ "$1" != "" && "$STATUS" -eq "1" ]]; then echo "<TR VALIGN=CENTER ALIGN=CENTER> <TD><B>ping:</B> <TD VALIGN=BOTTOM ALIGN=LEFT><PRE>`ping $1 -n 3`</PRE> </TR>" fi } function _nslookup { if [[ "$1" != "" && "$STATUS" -eq "1" ]]; then echo "<TR VALIGN=CENTER ALIGN=CENTER> <TD><B>nslookup<BR>$1</B> <TD VALIGN=BOTTOM ALIGN=LEFT><PRE>`nslookup $1`</PRE> </TR>" fi } function _name_resolution { echo "<A HREF="nameres.html">name resolution information</A> " _title Name Resolution >> $OUT_DIR/nameres.html if [ -f /etc/resolv.conf ] ; then echo "`_item resolv.conf`\n`cat /etc/resolv.conf`<P>" \ >> $OUT_DIR/nameres.html fi if [ -f /etc/nsswitch.conf ] ; then echo "<HR>\n`_item nsswitch.conf`\n`cat /etc/nsswitch.conf`" \ >> $OUT_DIR/nameres.html else echo "`_item no nsswitch.conf`\n" >> $OUT_DIR/nameres.html fi echo "\n</BODY></HTML>" >> $OUT_DIR/nameres.html } function _netstat { echo "<A HREF=\"netstat.html\">netstat information</A>" echo "\n`_title netstat`</PRE><table cellpadding=9> <tr><td><A HREF=\"#_nrn\">netstat -rn</A></td>"> $OUT_DIR/netstat.html if [ $OS != 11 ]; then echo "<td><A HREF=\"#_nm\">netstat -m</A></td>">> $OUT_DIR/netstat.html fi echo "<td><A HREF=\"#_ns\">netstat -s</A></td> <td><A HREF=\"#_an\">netstat -an</A></td></table> <HR>\n<A NAME=\"_nrn\">`_item netstat -rn` <PRE>`netstat -rn`</PRE><HR>" >> $OUT_DIR/netstat.html if [ $OS != 11 ]; then echo "<A NAME=\"_nm\"> `_item netstat -m` <PRE>`netstat -m` </PRE><HR>" >> $OUT_DIR/netstat.html fi echo "<A NAME=\"_ns\">`_item netstat -s` <PRE>`netstat -s` </PRE><HR> <A NAME=\"_an\"> `_item netstat -an` <PRE>`netstat -an`</PRE><HR> \n</BODY></HTML>" >> $OUT_DIR/netstat.html } function _installed_software { _title Installed Software echo "</PRE><table cellpadding=9><tr> <td><A HREF=\"#_bund\">swlist -l bundle</A></td> <td><A HREF=\"#_prod\">swlist -l product</A></td> <td><A HREF=\"#_stat\">swlist -l fileset -a state</A></td> </table> <HR><PRE>\n<A NAME=\"_bund\">" _item swlist -l bundle swlist -l bundle echo "<HR>\n<A NAME=\"_prod\">" _item swlist -l product swlist -l product echo "<HR>\n<A NAME=\"_stat\">" _item swlist -l fileset -a state swlist -l fileset -a state _footer } function _sendmail { _title SendMail Information mkdir $OUT_DIR/sendmail.conf echo "`what /usr/sbin/sendmail|grep -i version`\n\n<HR>\n" echo "<P><A HREF="nameres.html">Name Services</A> " cp /etc/mail/* $OUT_DIR/sendmail.conf echo "<A HREF="sendmail.conf">Config files</A> " _footer } function _hfsinfo { _title HFS File System Information /etc/mount -p | grep " hfs " | awk '{print $1}{system("tunefs -v " $1)}' _footer } function _orb_command { _item $1 $2 $1 $2 echo "\n" } function _orbadmin { _title orb_admin _orb_command $ORB_SBIN/orb_admin pr_inc _orb_command $ORB_SBIN/orb_admin pr_ir _orb_command $ORB_SBIN/orb_admin pr_trader _orb_command $ORB_SBIN/orb_admin list_iref _orb_command $ORB_SBIN/orb_admin list_iref _footer } function _orbplus { # ORB installed? (there must be a better way to determine # the existence of an installed ORB) if [ -f /opt/orbplus/lbin/obj_locator ]; then echo "`_heading ORB Plus`\n <A HREF="orbplus.html">ORB Info</A> " >> $OUT_DIR/index.html echo "`_title ORB Plus`\n<A HREF="orb.conf">Configuration files</A>\n<A HREF="orbadmin.html">orbadmin</A>`mkdir $OUT_DIR/orb.conf` `cp /etc/opt/orbplus/* $OUT_DIR/orb.conf` `_orbadmin > $OUT_DIR/orbadmin.html` `_orb_command $ORB_LBIN/naming_server ls_servers` </PRE>\n</BODY></HTML> `_footer`" > $OUT_DIR/orbplus.html echo "\t\t * ORB Plus" fi } function _syslog { _title syslog.log head -n 201 /var/adm/syslog/syslog.log _footer } function _isdn { if [ -f /opt/ISDN_SCSI/bin/isdninfo ]; then FILE=$OUT_DIR/isdn.html echo "\t\t * ISDN" _heading ISDN >> $OUT_DIR/index.html echo "<A HREF="isdn.html">more info</A> " >> $OUT_DIR/index.html _title ISDN > $FILE /opt/ISDN_SCSI/bin/isdninfo >> $FILE echo "</PRE>\n</BODY></HTML>" >> $FILE fi } function _openmail { if [ -f /opt/openmail/diag/omenquire ]; then FILE1=$OUT_DIR/om_basic.html FILE2=$OUT_DIR/om_unix.html echo "\t\t * OpenMail" _heading OpenMail >> $OUT_DIR/index.html echo "<A HREF=om_basic.html>omenquire basic</A> <A HREF=om_unix.html>omenquire unix</A> " >> $OUT_DIR/index.html _title OpenMail - omenquire basic > $FILE1 _title OpenMail - omenquire unix > $FILE2 mv /var/opt/openmail/tmp/enquire_out /var/opt/openmail/tmp/enquire.old /opt/openmail/diag/omenquire basic _cat_file /var/opt/openmail/tmp/enquire_out >> $FILE1 _footer >> $FILE1 rm /var/opt/openmail/tmp/enquire_out /opt/openmail/diag/omenquire unix _cat_file /var/opt/openmail/tmp/enquire_out >> $FILE2 _footer >> $FILE2 mv /var/opt/openmail/tmp/enquire.old /var/opt/openmail/tmp/enquire_out fi } function _omniback { if [ -f /etc/opt/omni/cell/cell_server ]; then FILE1=$OUT_DIR/omni_cell_info.html FILE2=$OUT_DIR/omni_db_info.html echo "\t\t * OmniBack" _heading OmniBack >> $OUT_DIR/index.html echo "Cell Server: <FONT COLOR=$FCOL>`cat /etc/opt/omni/cell/cell_server` </FONT>" >> $OUT_DIR/index.html if [ -f /etc/opt/omni/cell/cell_info ]; then echo "<A HREF=omni_cell_info.html>Cell Info</A> " >> $OUT_DIR/index.html fi if [ -f /opt/omni/sbin/omnidbutil ]; then echo "<A HREF=omni_db_info.html>DataBase Info</A> " >> $OUT_DIR/index.html echo " " >> $OUT_DIR/index.html echo "`_title Cell Info` `_cat_file /etc/opt/omni/cell/cell_info` `_footer`" > $FILE1 echo "`_title Database Information` \n`/opt/omni/sbin/omnidbutil -info` `_footer`" > $FILE2 fi fi } function _y2k { echo "\t\t * Year 2000 Check\n" FILE=$OUT_DIR/index.html if [ -f /usr/contrib/bin/y2koscheck ]; then echo "`_heading Year 2000`\n<PRE> `/usr/contrib/bin/y2koscheck -v` </PRE>\n<HR>\n" >> $FILE else echo "`_heading Year 2000` <center><font color=$FCOL size=+1>WARNING!</font><P> <font color=$FCOL2>y2koscheck</font> utility not found!</center><P>\n Please apply Patch PHCO_17806 (HP-UX 10.X); PHCO_17807 (HP-UX 11.X) or any subsequent Patch to enable this System for a Year 2000 Check. <P>\nYou'll find this Patch (and others) @ the <A HREF=\"http://us-support.external.hp.com\"> Americas and Asia-Pacific Electronic Support Center</A> or the <A HREF=\"http://europe-support.external.hp.com\"> European Electronic Support Center</A></PRE>\n<HR>\n" >> $FILE fi } function _x25 { if [ -f /usr/sbin/x25stat ]; then FILE=$OUT_DIR/x25.html echo "\t\t * X.25" _heading X.25 >> $OUT_DIR/index.html echo "<A HREF="x25.html">x25stat</A> " >> $OUT_DIR/index.html _title X.25 > $FILE for DEVICE_FILE in `ls /dev/x25_* /dev/zx25*` do _item $DEVICE_FILE /usr/sbin/x25stat -c -d $DEVICE_FILE echo "\n\n" done >> $FILE echo "</PRE>\n</BODY></HTML>" >> $FILE fi } ### Network Node Manager Stuff ### function _nnm { _title NNM Information echo "`_item NNM Version`\t`_nnmversion` `_item Objects in Database``$OV_BIN/ovmapcount -u| awk '/in object database/ && !/awk/ {print $1}'` <P><B><A HREF="nnm.conf">Config files</A>\t<A HREF="lrf.conf">Local Registration Files</A>\t<A HREF="ov.log">OV_LOG</A>\t<A HREF="ovpriv.log">OV_PRIV_LOG</A></B> \n<A HREF="ovstatus.html">ovstatus</A> <A HREF="ovmap.html">Map's</A> <A HREF="ovtopo.html">topology</A> \n`_cp_all_files $OV_LOG 0` `mv $OUT_DIR/log $OUT_DIR/ov.log` \n`_cp_all_files $OV_PRIV_LOG 0` `mv $OUT_DIR/log $OUT_DIR/ovpriv.log` `_item OV related Software installed:` \n`swlist -l product|grep OV|grep -v PHSS|sort`\n `_item OV related Patches installed:` \n`swlist -l product|grep OV|grep PHSS|sort`\n `_snmp` `_ovobjprint` \n</BODY></HTML>" _ovtopo > $OUT_DIR/ovtopo.html _mapinfo > $OUT_DIR/ovmap.html _nnm_conf_files } function _ito { _title OpenView ITO Information echo "`_item OpenView ITO Version`\t`_itoversion` `_item Objects in Database``$OV_BIN/ovmapcount -u| awk '/in object database/ && !/awk/ {print $1}'` <P><B><A HREF="nnm.conf">Config files</A>\t<A HREF="lrf.conf">Local Registration Files</A>\t<A HREF="ov.log">OV_LOG</A>\t<A HREF="ovpriv.log">OV_PRIV_LOG</A></B> \n<A HREF="ovstatus.html">ovstatus</A> <A HREF="ovmap.html">Map's</A> <A HREF="ovtopo.html">topology</A> `_item OpenView ITO related Software installed:` \n`swlist -l product|grep -E 'ITO|OPC'|grep -v PHSS|sort`\n `_item OpenView ITO related Patches installed:` \n`swlist -l product|grep -E 'ITO|OPC'|grep PHSS|sort`\n `_itostatus` `_snmp` `_ovobjprint` \n</BODY></HTML>" _ito_conf_files } function _itostatus { echo "`_item OpenView ITO Status:`\n <PRE>\n`_item opcsv -status`\n\n`$OV_BIN/OpC/opcsv -status`</PRE> <PRE>\n`_item opcagt -status`\n\n`$OV_BIN/OpC/opcagt -status`</PRE>" } function _nnmindex { _heading OpenView NNM _item NNM Version: _nnmversion echo "<P><A HREF="nnm.html">NNM Information</A> " } function _itoindex { _heading OpenView ITO _item OpenView ITO Version: _itoversion echo "<P><A HREF="ito.html">OpenView ITO Information</A> " } function _licensing { echo " <A HREF="ifor.html">License</A> " >> \ $OUT_DIR/index.html _title Licensing \"Fun\" echo "\tPlease make sure that PHSS_8508 is installed, and, if you don't rely on floating licenses, consider switching to a nodelock'd license type, as this appears to be more robust.<P> Starting with rev. 5.01 OpenView Network Node Manager will be delivered with a nodelock license as the default license, for almost all other products there's a chance to convert the floating license into a nodelocked license. The following products are currently eligible for converting: IT/A, IT/O, Omnistorage, NNM 4.x, DM 4.2, OPI 4.2/5.x, TMN 5.x, NetMetrix Load Monitor/NFS/Protocol Analayzer/Internetwork Monitor/Reporter/IRM.<P> Contact your local Response Center for further details.<P><P>" _cat_file $OV_NODELOCK/nodelock _cat_file $OV_CONF/nnmlicense|grep -v "^#" I4LS_BIN=/opt/ifor/ls/os/hpux/bin echo "`_item what $I4LS_BIN/i4admin:`\n<PRE> `what $I4LS_BIN/i4admin` \n\n`_item $I4LS_BIN/i4target -v:` `$I4LS_BIN/i4target -v` \n\n`_item i4tv:` \n`$I4LS_BIN/i4tv` \n\n`_item i4lbfind:` \n`$I4LS_BIN/i4lbfind 2> $LOGFILE` \n\n`_item cat /etc/rc.config.d/iforls:` `cat /etc/rc.config.d/iforls|grep -v ^#` \n`_item cat /etc/rc.config.d/ncs:` \n`cat /etc/rc.config.d/ncs|grep -v ^#`" _footer } function _tmnindex { _heading OpenView _item TMN Version: _nnmversion echo "<P><A HREF="tmn.html">TMN Information</A> <A HREF="nnm.html">NNM Information</A> " } function _nnm_conf_files { _copy_file $OV_CONF/ovwdb.auth nnm.conf _copy_file $OV_CONF/ovw.auth nnm.conf _copy_file $OV_CONF/oid_to_type nnm.conf _copy_file $OV_CONF/polling nnm.conf _copy_file $OV_CONF/ovsnmp.conf nnm.conf _copy_file $OV_CONF/snmpCol.conf nnm.conf _copy_file $OV_CONF/oid_to_sym/nnm.conf _copy_file $OV_CONF/C/oid_to_sym nnm.conf _copy_file $OV_CONF/C/filters nnm.conf if [ -f $OV_CONF/ovsuf ] ; then grep '^0:' $OV_CONF/ovsuf > $OUT_DIR/nnm.conf/ovsuf.out fi cp $OV_LRF/*.lrf $OUT_DIR/lrf.conf } function _ito_conf_files { _copy_file $OV_BIN/OpC/install/opcsvinfo nnm.conf _copy_file $OV_BIN/OpC/install/opcinfo nnm.conf _copy_file /var/opt/OV/conf/OpC/nodeinfo nnm.conf _copy_file $OV_CONF/OpC/mgmt_sv/opc.hosts nnm.conf _copy_file $OV_CONF/ovdbconf nnm.conf _copy_file /var/opt/OV/tmp/OpC/trace nnm.conf/ito.trace _copy_file /var/opt/OV/share/tmp/OpC/mgmt_sv/trace nnm.conf/ito.trace.mgmt } function _nnmversion { mkdir -p $OUT_DIR/nnm.conf mkdir -p $OUT_DIR/lrf.conf if [ -f $OV_BIN/ovnnmversion ]; then $OV_BIN/ovnnmversion; elif [ -f $OV_BIN/ovw ]; then what $OV_BIN/ovw | grep "HP OpenView" else # this shouldn't happen, neverever echo "no NNM installed, but ov.envvars.sh exists, <B>why</B>?"; fi } function _itoversion { if [ -f $OV_BIN/OpC/opc ]; then what $OV_BIN/OpC/opc | grep "HP OpenView" else # this shouldn't happen echo "no OpenView ITO installed"; fi } function _snmp { echo "<PRE>\n`_item xnmsnmpconf -opt`\n`xnmsnmpconf -opt`</PRE>" if [ -f $OV_LOG/snmpCol.trace ]; then mv $OV_LOG/snmpCol.trace $OV_LOG/snmpCol.trace.old > /dev/null 2>&1 fi snmpCollect -S > /dev/null 2>&1 cp $OV_LOG/snmpCol.trace $OUT_DIR/nnm.conf } function _ovobjprint { _item ovobjprint -S echo "<PRE>\n`$OV_BIN/ovobjprint -S`\n</PRE>" } function _ovtopo { echo "`_title Topology`\n<PRE> \n`_item ovtopodump -l -v`\n\n`$OV_BIN/ovtopodump -l -v`\n \n`_item xnmtopoconf -print`\n\n`$OV_BIN/xnmtopoconf -print`\n</PRE>\n" } function _mapinfo { echo "`_title Map Information`\n<PRE>\n `_item ovwls -a -G`\n`ovwls -a -G`\n `_item ovmapdump -l -v`\n`ovmapdump -l -v`\n</PRE>\n" } ### OV Telecom Stuff ### function _tmn { _title TMN Information echo "`_item TMN Version:``_nnmversion` <P> <A HREF="lrf.conf">Local Registration Files</A> <A HREF="ov.log">Log files</A> <A HREF="ovstatus.html">ovstatus</A> <A HREF="osiconfcheck.html">osiconfcheck -bd</A> <A HREF="ovsuf.html">ovsuf</A> <A HREF="odbc.html">odbc.ini</A> <A HREF="ovors.html">ovors</A><P> `_cat_file $OV_CONF/local_p_addr` `_item what pmd`\n<PRE>\n`what $OV_BIN/pmd`\n</PRE> `_item ovconftest`\n<PRE>`ovconftest` <P> \n</BODY></HTML>" _ovors > $OUT_DIR/ovors.html _osiconfcheck > $OUT_DIR/osiconfcheck.html _ovsuf > $OUT_DIR/ovsuf.html _odbc > $OUT_DIR/odbc.html } function _odbc { _title odbc.ini _cat_file /.odbc.ini } function _ovsuf { _title ovsuf _cat_file $OV_CONF/ovsuf } function _osiconfcheck { _title osiconfchk -bd _item osiconfchk -bd osiconfchk -bd _item otsstat otsstat } function _ovstatus { _title ovstatus _item ovstatus $OV_BIN/ovstatus } function _ovors { echo "`_title ovors`\n`_cat_file $OV_CONF/ovors` `_item ovorsutil -s`\n<PRE>\n`ovorsutil -s`\n</PRE>\n `_item ovorsutil -h`\n<PRE>\n`ovorsutil -h`\n</PRE>\n" } ### SNA ### function _sna { SNA_BIN=/opt/sna/bin if [ -f $SNA_BIN/snapsysinfo ]; then VER=`what /stand/vmunix|grep SNA|awk '{print $3}'|sort -u` echo "\t\t * SNA" mkdir $OUT_DIR/SNA FILE=$OUT_DIR/SNA/index.html _heading SNA >> $OUT_DIR/index.html echo "Version: $VER, <A HREF="SNA/index.html">more Info</A> ">> $OUT_DIR/index.html echo "`_title SNA`\n`what /stand/vmunix|grep -i sna`<P> \n<A HREF="snapsysinfo.html">snapsysinfo</A><P> \n<A HREF="snaerr.html">Error and Audit files collected</A><P> \n<A HREF="snapconfig.html">snapconfig</A>\n" > $FILE _snapsysinfo > $OUT_DIR/SNA/snapsysinfo.html _snapconfig > $OUT_DIR/SNA/snapconfig.html _snaerr > $OUT_DIR/SNA/snaerr.html echo "\n\n</PRE>\n</BODY></HTML>" >> $FILE fi } function _snapsysinfo { _title snapsysinfo $SNA_BIN/snapsysinfo } function _snaerr { _title SNAerrors _item /var/opt/sna/sna.aud cat /var/opt/sna/sna.aud _item /var/opt/sna/sna.err cat /var/opt/sna/sna.err _footer } function _snapconfig { _title snapconfig if [ -f $SNA_BIN/snaptextcfg ]; then $SNA_BIN/snaptextcfg else cat /etc/opt/sna/sna_node.cfg echo "<P>`_item sna_domn.cfg`<P>" cat /etc/opt/sna/sna_domn.cfg fi _footer } function _sg { if [ -f /usr/sbin/cmviewcl ]; then echo "\t\t * Service Guard" mkdir $OUT_DIR/SG FILE=$OUT_DIR/SG/index.html _heading ServiceGuard >> $OUT_DIR/index.html echo "Version: `swlist -l product|grep \"^ ServiceGuard\"|awk '{print $2}'`, <A HREF="SG/index.html">more Information</A> " >> $OUT_DIR/index.html echo "`_title ServiceGuard`\n`what /stand/vmunix|grep -i service`<P> \n<A HREF="sgnetstat.html">netstat information</A> <A HREF="sgservices.html">SG Entries in /etc/services</A><P> \n<b>cm commands</b>:<P> \n<A HREF="cmviewcl.html">cmviewcl</A> <A HREF="cmgetconf.html">cmgetconf</A> <A HREF="cmscancl.html">cmscancl</A>\n\n\n<P>\n\n\n`_item /etc/rc.config.d/cmcluster` \n`cat /etc/rc.config.d/cmcluster``_footer`" > $FILE echo "`_title Netstat Information` `_item netstat -a | grep hacl``_item netstat -a` \n`netstat -a | grep hacl`" > $OUT_DIR/SG/sgnetstat.html if [ $OS -eq 10 ]; then echo "`_item netstat -AAA` \n`netstat -AAA`" >> $OUT_DIR/SG/sgnetstat.html fi echo "`_title hacl entries in /etc/services` `_item grep hacl /etc/services` \n`grep hacl /etc/services`" > $OUT_DIR/SG/sgservices.html echo "`_title cmviewcl` `_item cmviewcl` \n`cmviewcl -v`" > $OUT_DIR/SG/cmviewcl.html echo "`_title cmgetconf` `_item cmgetconf` \n`cmgetconf -v`"> $OUT_DIR/SG/cmgetconf.html echo "`_title cmscancl` `_item cmscancl`\n\n \n`cmscancl`\n\n\n`_cat_file /tmp/scancl.out"> $OUT_DIR/SG/cmscancl.html fi } ### END OF SNA STUFF ### _init $* echo '\007\c'