HP-UX 主機巡檢-nickel 指令碼命令細細讀--系統資訊
nickel指令碼請見附件:
一、系統資訊:
用與收集系統所有軟硬體資訊:
1、系統資訊 system information
使用命令: /usr/contrib/bin/machinfo
說明:這個是nickel生成的index.html檔案首頁的內容,包括了CPU、記憶體、Firmware、Platform、OS、資訊
2、啟動時間 uptime
使用命令: uptime
說明:機器啟動到現在的天數
3、環境變數
使用命令: env
4、檔案系統和磁碟資訊
1)顯示啟動盤上的LIF資訊:
使用命令: lifls -il /dev/rdsk/c0t6d0s2
命令顯示:
lifls -il /dev/rdsk/c0t6d0s2
volume ISL10 data size 7984 directory size 8 06/10/27 14:23:07
filename type start size implement created
===============================================================
ISL -12800 584 242 0 06/10/27 14:23:07
AUTO -12289 832 1 0 06/10/27 14:23:07
HPUX -12928 840 1024 0 06/10/27 14:23:07
PAD -12290 1864 1468 0 06/10/27 14:23:07
LABEL BIN 3336 8 0 09/11/05 22:41:22
HP-UX系統啟動過程:
hpux的啟動過程概況如下:
pdc(Processor-dependent-code,在rom中,完成硬體自檢
| 讀取stable storge中的資訊,如autosearch,
| primarypath等等,然後呼叫isl
isl (Initial system loader,在boot盤的lif區域。lif
| 區域主要有四個檔案,分別是sl,hpux,AUTO,LABEL
| 在#下,可以使用lifls命令察看,同時可以使用
| lifcp 察看AUTO的內容。
| isl的主要任務是執行lif區域的hpux,同時也可
| 以改變stable storge中的部分資訊,如
| primarypath,autoboot等等
hpux 引導os,主要是讀取/stand/vmunix檔案,同時把
| 控制權交給核心,
|
init 從這裡開始,就是軟體之間的啟動了
說明:顯示LIF捲上的檔案資訊 ,相關LIF的文章,請看:
2)顯示系統lvm資訊:
使用命令:vgdisplay -v ; strings /etc/lvmtab
3)顯示啟動卷資訊:
使用命令:lvlnboot -v
4)系統mount情況 :
使用命令:cat /etc/fstab ; mount -p
5)分割槽可用空間:
使用命令: bdf -i
6)NFS mount :
使用命令: showmount -a
7)SWAP 資訊:
使用命令: swapinfo -tam
5、系統軟體及補丁安裝情況:
使用命令:swlist -l bundle ; swlist -l product ; swlist -l product | grep PH ; swlist -l fileset -a state -a patch_state
6、啟動盤裝置path 資訊:
使用命令:setboot
7、計劃任務情況:
使用命令: crontab -l
8、磁碟IO 情況:
使用命令:iostat -t 5 2
9、IPC 情況:
使用命令:ipcs -bcop
10、核心載入的裝置驅動
使用命令:lsdev
11、nfs情況
使用命令:nfsstate
12、程序情況:
使用命令:ps -ef
13、系統負載情況:
使用命令:sar -A 5 2
14、系統重啟日誌:
使用命令: cat /var/adm/shutdownlog
15、系統核心引數情況:
使用命令:cat /stand/system; kctune ; kcusage; sysdef
16、系統日誌:
使用命令:cat /var/adm/syslog/syslog.log ; cat /var/adm/syslog/OLDsyslog.log
17、top資訊
使用命令: top -d5
18、vmstat 資訊:
使用命令:vmstat -dS 5 2
19、核心具體資訊:
使用命令:what /stand/vmunix
#!/sbin/sh
#
# #### $ Revision: A.01.12b15 $ $ Author: Robert Sakic $ $ Date: December 2002 $
# @(#) $ Rev: A.01.12b15-001 $ $ Modified by: Liew Teck Yuen ([email protected]) $
# Modified Rev : A.01.12b15-001
# Modified By : Liew Teck Yuen ([email protected],[email protected])
# Last Modified : 06 Jun 2006
#
###############################################################################
#
# 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 - 2002 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.
#
###############################################################################
# Below are some options you might want to modify.
# Colors used in the script, change them for your needs
FCOL=RED # Font Color for emphasized Text
FCOL2=BLUE # Heading Font Color
FCOL3=GREEN # Secondary Heading Font Color
BGCOL=WHITE # Page Background Color
HCOL=D1D1D1 # Heading Background Color
# Options for the vmstat command
VM_INT=5 # vmstat Interval
VM_COUNT=1 # vmstat Count
# Options for the iostat command
IO_INT=5 # iostat Interval
IO_COUNT=1 # iostat Count
# Options for the system activity reporter command
SAR_t=5 # sar seconds
SAR_n=1 # sar Intervals
###############################################################################
#
# No need for user changes below this line.
#
###############################################################################
### Start: Added by [email protected]
PWD1=`pwd`
if [[ $PWD1 = "/" ]]
then
PWD1=""
fi
TMP_DIR=/tmp
OUT_DIR=$TMP_DIR/$BASE.$HOST
### End: Added by [email protected]
BASE=`basename $0`
HOST=`hostname`
MYTTY=`who am i | awk '{print $2}'`
### Start: Remarked by [email protected]
### OUT_DIR=/tmp/$BASE.$HOST
### End: Remarked by [email protected]
### Start: Added by [email protected]
PWD=`pwd`
TMP_DIR=/tmp
OUT_DIR=$TMP_DIR/$BASE.$HOST
### End: Added by [email protected]
PATH=/usr/sbin:/usr/bin:/usr/contrib/bin:$PATH
ORB_SBIN=/opt/orbplus/sbin
ORB_LBIN=/opt/orbplus/lbin
OCMP_OUT=/tmp/$BASE.$HOST/OCMP/
OOB=/opt/OCMP/bin
EOO=/etc/opt/OCMP
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:\n$0 [ -m <email address> | -o <output directory> | -n | -? ]\n\nOptions:\n\t-m <email address>\tEmail the archive to <email address>\n\t-o <output directory>\tWhere to direct the output\n\t-n\t\t\tDon't create archive\n\t-?\t\t\tshow this Help
Menu\n
This Script will collect System relevant data and save it either in a
archive or in a directory named nickel.hostname (e.g. nickel.$HOST).
Unless you've redirected your output with the -o option, you'll find a file\ncalled index.html in the /tmp/nickel.$HOST directory, open it with your\nfavourite Web browser to see the output of the script.\n\nnickel revision: `what $0|awk '{print $3}'`"
exit 1
}
function _init {
_not_running
_need_root
_need_os
SHAR=YES
EMAIL=NO
while getopts :nm:o: opt
do
case $opt in
n) SHAR=NO
;;
m) EMAIL=YES
EMAILADDR=$OPTARG
;;
o) OUT_DIR=$OPTARG
;;
:) _usage "The -m and -o 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 an archive to use the -m option" "\n\tRemove the -n from the command line";
fi
_common
}
function _not_running {
RUNNING=$(ps -ef|grep "$0"|grep -v grep|grep -v $$|grep -v man)
if [[ "$RUNNING" != "" ]]
then
PID=$(echo ${RUNNING} | awk {"print \$2;exit"})
echo "\nERROR: The tool is already running under pid: ${PID}\n"
echo "You must wait until it completes.\n"
exit 1
fi
}
function _need_root {
if [[ `id -u` != "0" ]]
then
echo "\nERROR: Your User ID appears to be: `id -u` (Loginname: $LOGNAME)\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
if [[ -f $BASE.$HOST.tar.gz ]]; then
echo "###\n###\tRemoving an older tar.gz file"
echo "###\t\t$OUT_DIR/../$BASE.$HOST.tar.gz"
echo "###"
rm -f $OUT_DIR/../$BASE.$HOST.tar.gz
fi
clear
### Start: Remarked by [email protected]
### echo "nickel revision: `what $0|awk '{print $3}'`
### \n\n\tNote, the Output will go to the following Directory: $OUT_DIR
### \n\tPoint your favourite Web browser to that directory and"
### echo "\topen the file index.html to see the results."
### End: Remarked by [email protected]
### Start: Added by [email protected]
echo "Nickel Revision: `grep Rev: $0|grep -v awk|awk '{print $5}'`"
echo "\n\tNote, the Temporary Output will go to the following Directory:
$OUT_DIR
\n\tPoint your favourite Web browser to that directory and
open the file index.html to see the results.
\n\tFinal Archived File:
$PWD1/$BASE.$HOST.tar.gz"
### End: Added by [email protected]
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 $7</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>"
}
function _title2 {
echo "<HTML><HEAD><TITLE>`basename $1` $2 $3 $4 $5</TITLE></HEAD>
<BODY BGCOLOR=$BGCOL>"
_heading2 `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 {
whence sar > /dev/null && (( ncpu = `sar -M 1 1 | wc -l` - 5 ))|| ncpu=0
[[ "$ncpu" -gt 1 ]] && echo "$ncpu x \c"
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}"
}
##############################################################################
#
# END RG
# End of functions added by Roger Goff 12/98 for providing additional
# information in the index.html file
#
##############################################################################
function _index_html {
NICKEL_UPTIME=`uptime|awk '{print $3,$4,$5}'|sed s/,$//|cut -d ' ' -f3`
if [ `echo $NICKEL_UPTIME | grep :` ]; then
NICKEL_TIME_FORMAT="Hour(s)"
else
NICKEL_TIME_FORMAT="Minute(s)"
fi
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>
Nickel Rev: `grep Rev: $0 | grep -v awk | awk '{print $5}'`
</B></FONT></TD></TR>
</TABLE></CENTER>
<P>\n<TABLE><TR>"
if [[ -f /usr/contrib//bin/machinfo ]]; then
echo "<TD COLSPAN=3><B><FONT COLOR=$FCOL>
Machine Information:</FONT></B><PRE>`machinfo`</PRE></TD></TR>
<TR>\n<TD><B><FONT COLOR=$FCOL>Uptime:</FONT></B>
`uptime|awk '{print $3,$4,$5}'|sed s/,$//` $NICKEL_TIME_FORMAT</TD>
<TD> </TD><TD> </TD>"; else
echo "<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}'|sed s/,$//` $NICKEL_TIME_FORMAT
<TD><B><FONT COLOR=$FCOL>CPU:</FONT></B> " "`_mhz`", "
`_cpuversion`", "
`_cpurevision`</TD><TD></TD>"; fi
echo "</TR></TABLE><P></P>
<TABLE SIZE=100%><TR>
<TD><A HREF="environment.html">Environment</A> </TD>
<TD><A HREF="fs-disk.html">Filesystem/Disk Info</A> </TD>
<TD><A HREF="software.html">Installed Software</A>
<A HREF="software_logfiles.html">(logfiles)</A> </TD>
</TR></TABLE><BR>
`_create_link $USBIN/setboot`
`_create_link $UBIN/crontab -l`
`_create_link $USBIN/dmesg`
`_graphinfo`
`_create_link $UBIN/iostat -t $IO_INT $IO_COUNT`
`_create_link $UBIN/ipcs -bcop`
<A HREF="java.html">Java</A>
`_create_link3 $USBIN/kmadmin -k`
`_create_link3 $USBIN/kmadmin -S`
`_create_link4 $USBIN/kmadmin -s`
`_create_link $UBIN/locale`
`_create_link $USBIN/lsdev`
`_collect_file mail.log /var/adm/syslog/mail.log`
`_create_link $UBIN/nfsstat`
`_create_link $UBIN/ps -ef`
`_create_link $UBIN/sar -A $SAR_t $SAR_n`
<A HREF="sendmail.html">sendmail</A>
`_collect_file shutdownlog /var/adm/shutdownlog`
`_stand_system`"
if [[ -f $USBIN/kctune ]]; then
echo "`_create_link $USBIN/kctune`"; else
echo "`_create_link $USBIN/kmtune`"; fi
echo "`_collect_file makrec.log1 /var/opt/ignite/logs/makrec.log1`
`_collect_file recovery.log /var/opt/ignite/recovery/latest/recovery.log`
`_create_link $USBIN/sysdef`
`_collect_file syslog /var/adm/syslog/syslog.log`
`_collect_file OLDsyslog /var/adm/syslog/OLDsyslog.log`
`_create_link $UBIN/top -d1`
`_title top > $OUT_DIR/top.html`
`$UBIN/top -d1 -n200 -f $OUT_DIR/top.html`
`_footer >> $OUT_DIR/top.html`
`_create_link $UBIN/vmstat -dS $VM_INT $VM_COUNT`
`_create_link $UBIN/what /stand/vmunix`
`_heading Hardware / Diagnostic`
`_create_link $USBIN/ioscan -fn`
`_tombstones`
`_diskinfo`
`_diag_proc`
`_cstm $USBIN/cstm`
`_collect_file event.log /var/opt/resmon/log/event.log`
`_heading OS`
`_collect_file auto_master /etc/auto_master`
`_collect_file auto_parms /etc/auto_parms.log`
`_collect_file cmcluster.conf /etc/cmcluster.conf`
`_collect_file exports /etc/exports`
`_collect_file hosts /etc/hosts`
`_collect_file hosts.equiv /etc/hosts.equiv`
`_collect_file rhosts /.rhosts`
`_collect_file inittab /etc/inittab`
`_collect_file ntp.conf /etc/ntp.conf`
`_collect_file rc.log /etc/rc.log`
`_collect_file rc.log.old /etc/rc.log.old`
`_collect_file securetty /etc/securetty`
`_collect_file syslog.conf /etc/syslog.conf`
`_collect_file TIMEZONE /etc/TIMEZONE`
`_heading Network`
\n<B><FONT COLOR=$FCOL>lanscan:</FONT></B>
<PRE>`lanscan`</PRE><BR>
<A HREF="network.html">Network Information</A><P><BR>"
}
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 $3 $4 $5 > $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 _create_link3 {
if [ -x $1 ]; then
if [ -f $1 ]; then
NAME=`basename $1`
echo "<A HREF=\"$NAME$2.html\">$NAME $2</A> "
_common_function $1 $2 $3 $4 $5 > $OUT_DIR/$NAME$2.html
fi
fi
}
function _create_link4 {
if [ -x $1 ]; then
if [ -f $1 ]; then
NAME=`basename $1`
echo "<A HREF=\"${NAME}_$2.html\">$NAME $2</A> "
_common_function $1 $2 $3 $4 $5 > $OUT_DIR/${NAME}_$2.html
fi
fi
}
function _common_function {
if [ -f $1 ]; then
_title $1 $2 $3 $4 $5
_item `basename $1` $2 $3 $4 $5
echo "\n"
$1 $2 $3 $4 $5
_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\tVerifying Filesystem/Disk Information..."
_fsdisk > $OUT_DIR/fs-disk.html
echo "\n\tChecking Installed Software..."
_installed_software > $OUT_DIR/software.html
_software_logfiles > $OUT_DIR/software_logfiles.html
_sendmail > $OUT_DIR/sendmail.html
echo "\n\tCollecting Network Information..."
_laninfo > $OUT_DIR/network.html 2>&1
_environment > $OUT_DIR/environment.html
echo "\n\tChecking Java..."
_java > $OUT_DIR/java.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
echo "\n\tChecking for SuperDome, OpenCall, OpenMail, OmniBack,\n\t\t\tMC/SG, ORB, ISDN, X25, SNA..."
_parstatus # check if system has npars, show some information...
_vparstatus # check if system has vpars...
_openCall # OpenCall SS7, IN, MultiService?
_openmail # OpenMailing?
_omniback # OmniBack?
_sg # Service Guard involved?
_orbplus # any ORB around?
_isdn # ISDN ready?
_x25 # X.25 somewhere ?
_sna # SNA ?
_fibre_channel # FC Adapter
# _y2k # Year 2000 Check ! - obsolete per default as of nov 2002
echo "<BR> <BR><HR><FONT SIZE=-1 color=$FCOL2>`what $0`</font>
</FONT></BODY></HTML>" >> $OUT_DIR/index.html
if [ ${SHAR} = YES ]; then
echo "\n\n"
### Start: Remarked by [email protected]
### tar cvf ${BASE}.${HOST}.tar ${OUT_DIR}
### End: Remarked by [email protected]
### Start: Added by [email protected]
cd $TMP_DIR
rm -f ${BASE}.${HOST}.tar
tar cvf ${PWD1}/${BASE}.${HOST}.tar ${BASE}.${HOST}
cd $PWD1
rm -f ${BASE}.${HOST}.tar.gz
### End: Added by [email protected]
gzip -9 ${BASE}.${HOST}.tar
#rm -rf $OUT_DIR
### Start: Remarked by [email protected]
## echo "\n\tCreated archive file: $BASE.$HOST.tar.gz"
### End: Remarked by [email protected]
### Start: Added by [email protected]
echo "\n\tCreated Archive File:\n\t$PWD1/$BASE.$HOST.tar.gz"
### End: Added by [email protected]
if [ ${EMAIL} = YES ]; then
uuencode ${BASE}.$HOST.tar.gz ${BASE}.$HOST.tar.gz|\
/usr/bin/mailx -s "nickel tool output for $HOST" $EMAILADDR
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 _netfmt {
FILE=$OUT_DIR/netfmt.html
echo "<A HREF=netfmt.html>netfmt</A>"
### Start: Added by [email protected]
if [ -f /var/adm/nettl.LOG00 ] ; then
echo "`_title netfmt -f /var/adm/nettl.LOG00`" >> $FILE
echo "`_item /usr/sbin/netfmt -f /var/adm/nettl.LOG00`">> $FILE
echo "`/usr/sbin/netfmt -f /var/adm/nettl.LOG00`<P>" >> $FILE
else
echo "`_title netfmt -f /var/adm/nettl.LOG00`" >> $FILE
echo " /var/adm/nettl.LOG00 not found." >> $FILE
fi
### End: Added by [email protected]
if [ -f /var/adm/nettl.LOG000 ] ; then
echo "`_title netfmt -f /var/adm/nettl.LOG000`" >> $FILE
echo "`_item /usr/sbin/netfmt -f /var/adm/nettl.LOG000`">> $FILE
echo "`/usr/sbin/netfmt -f /var/adm/nettl.LOG000`<P>" >> $FILE
else
echo "`_title netfmt -f /var/adm/nettl.LOG000`" >> $FILE
echo " /var/adm/nettl.LOG000 not found." >> $FILE
fi
_footer >> $FILE
}
function _stand_system {
FILE=stand_system.html
echo "<A HREF=\"$FILE\">/stand/system</A> "
echo "`_title /stand/system`
`_cat_file /stand/system`
`_footer`" > $OUT_DIR/$FILE
}
function _collect_file {
if [ -f $2 ]; then
FILE=$1.html
echo "<A HREF=\"$FILE\">$1</A> "
echo "`_title $2`
`_cat_file $2`
`_footer`" > $OUT_DIR/$FILE
fi
}
function _cstm {
if [ -f $1 ]; then
if [ "`swlist -l product|grep \"^ PHSS_14407\"`" ]; then
echo "PHSS_14407 installed!"; else
FILE1=cstm.html
echo "<A HREF=\"$FILE1\">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
if [[ $OsRel = "10.01" || $OsRel = "10.10" || \
$OsRel = "10.20" || $OsRel = "11.00" || \
$OsRel = "11.11" ]]; then
FILE2=cstm_cpu.html
echo "<A HREF=\"$FILE2\">CPU Diagnostics</A> "
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; fi
rm $OUT_DIR/cstm_i
fi
fi
}
function _diskinfo {
FILE=$OUT_DIR/diskinfo.html
echo "<A HREF=diskinfo.html>Diskinfo</A> "
echo "`_title Diskinfo``_item diskinfo -v`" > $FILE
for i in `ls /dev/rdsk/c*`
do
diskinfo -v $i 2> $LOGFILE
echo "\n" >> $FILE
done >> $FILE
echo "`_footer`" >> $FILE
}
function _lifinfo {
FILE=$OUT_DIR/lifinfo.html
echo "<A HREF=lifinfo.html>LIF info</A> "
echo "`_title LIF directory contents`" > $FILE
echo "Information on root, boot, swap, and dump logical volumes:\n" >> $FILE
echo "\n`lvlnboot -v`\n\n" >> $FILE
for i in `ls /dev/rdsk/c*`
do
echo "lifls -il $i" >> $FILE
### Start: Remarked by [email protected]
### lifls -il $i >> $FILE
### End: Remarked by [email protected]
### Start: Added by [email protected]
lifls -il $i >> $FILE 2>&1
### End: Added by [email protected]
echo "\n" >> $FILE
done >> $FILE
echo "`_footer`" >> $FILE
}
function _tombstones {
if [ -f /var/tombstones/ts99 ]; then
FILE=$OUT_DIR/tombstones.html
echo "<A HREF=tombstones.html>tombstones</A> "
echo "`_title tombstones`" >$FILE
echo "`_cat_file /var/tombstones/ts99`\n`_footer`" >> $FILE
fi
}
function _graphinfo {
if [ -c /dev/crt ]; then
FILE=$OUT_DIR/graphinfo.html
echo "<A HREF=graphinfo.html>graphinfo</A> "
echo "`_title graphinfo` Available Graphic devices:<BR>" > $FILE
# create links at top of page
for i in `ls /dev/crt*`
do
echo "<A HREF=#__$i>$i</A>" >> $FILE
done >> $FILE
# execute graphinfo for each device file found
echo "<P></P>\n<P></P>" >> $FILE
for i in `ls /dev/crt*`
do
echo "<A NAME="__$i"></A>`_item graphinfo $i`"
graphinfo $i 2>> $FILE
echo "\n" >> $FILE
done >> $FILE
echo "`_footer`" >> $FILE
fi
}
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>\t\t`_netfmt`<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 _environment {
_title Environment Variables
env
_footer
}
function _installed_software {
if [ $OS -eq 11 ]; then
SWSTRING="swlist -l fileset -a state -a patch_state -a show_superseded_patches=true"
SWSTRHTML="<td><A HREF=\"#_stat\">swlist -l fileset -a state -a patch_state"
else
SWSTRING="swlist -l fileset -a state"
SWSTRHTML="<td><A HREF=\"#_stat\">swlist -l fileset -a state"
fi
_title Installed Software
echo "Total Number of Patches installed: `swlist -l product|grep ' PH'|wc -l`
</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=\"#_patch\">swlist -l product | grep PH</A></td>
$SWSTRHTML
</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=\"_patch\">"
_item swlist -l product | grep PH
swlist -l product | grep PH
echo "<HR>\n<A NAME=\"_stat\">"
_item $SWSTRING
$SWSTRING
_footer
}
function _software_logfiles {
_title SDUX Logfiles
echo "
<A HREF=\"#_swagent\">/var/adm/sw/swagent.log</A><BR>
<A HREF=\"#_swagentd\">/var/adm/sw/swagentd.log</A><BR>
<A HREF=\"#_swconfig\">/var/adm/sw/swconfig.log</A><BR>
<A HREF=\"#_swinstall\">/var/adm/sw/swinstall.log</A><BR>
<A HREF=\"#_swmodify\">/var/adm/sw/swmodify.log</A><BR>
<A HREF=\"#_swremove\">/var/adm/sw/swremove.log</A><P>
<HR><PRE>\n<A NAME=\"_swagent\">"
_cat_file /var/adm/sw/swagent.log
echo "<HR>\n<A NAME=\"_swagentd\">"
_cat_file /var/adm/sw/swagentd.log
echo "<HR>\n<A NAME=\"_swconfig\">"
_cat_file /var/adm/sw/swconfig.log
echo "<HR>\n<A NAME=\"_swinstall\">"
_cat_file /var/adm/sw/swinstall.log
echo "<HR>\n<A NAME=\"_swmodify\">"
_cat_file /var/adm/sw/swmodify.log
echo "<HR>\n<A NAME=\"_swremove\">"
_cat_file /var/adm/sw/swremove.log
}
function _fsdisk {
_title Filesystem and Harddisk Information
echo "LIF Information: `_lifinfo`
\n<A HREF=\"lvminfo.html\">Logical Volume Manager Information</A>"
_lvminfo > $OUT_DIR/lvminfo.html
echo "\nMountable file-system entries: `_create_link /usr/bin/cat /etc/fstab`
\nNumber of free disk blocks: `_create_link $UBIN/bdf`
\nmounted file systems: `_create_link /etc/mount -p`
\nClients that have remotely mounted a filesystem: `_create_link $USBIN/showmount -a 2> $LOGFILE`
\nSystem paging space information: `_create_link $USBIN/swapinfo -tam`
\nDisplay current values contained in the primary super-block: <A HREF="hfsinfo.html">tunefs -v</A>
\n`_create_link $UBIN/strings /etc/lvmtab`<BR></BR>"
_footer
}
function _lvminfo {
_title LVM Information
echo "General Information about LVM: `_create_link $USBIN/vgdisplay -v`, `_create_link $USBIN/lvlnboot -v`
<UL>
<LI>Number of available Logical Volumes: <B>`vgdisplay -v|awk '/LV Name/'|wc -l`</B></LI>
</LI><LI>Names of available Logical Volumes:<BR>"
mkdir -p $OUT_DIR/lvmdirectory/dev/dsk
for r in `vgdisplay |awk '/VG Name/ && !/awk/ {print $3}'`
do
mkdir -p $OUT_DIR/lvmdirectory/$r
done
for i in `vgdisplay -v |awk '/LV Name/ && !/awk/ {print $3}'`
do
echo "<A HREF=\"lvmdirectory$i.html\">$i</A> "
done
for k in `vgdisplay -v |awk '/LV Name/ && !/awk/ {print $3}'`
do
echo "</PRE>\n`_title Processing Logical Volume $i`
\n<font color=red>fstyp -v $k</font>" > $OUT_DIR/lvmdirectory$k.html
### Start: Remarked by [email protected]
### fstyp -v $k >> $OUT_DIR/lvmdirectory$k.html
### End: Remarked by [email protected]
### Start: Added by [email protected]
fstyp -v $k >> $OUT_DIR/lvmdirectory$k.html 2>&1
### End: Added by [email protected]
done
echo "</LI>
<LI>Number of available Volume Groups: <B>`vgdisplay|awk '/VG Name/'|wc -l`</B>
</LI><LI>Names of available Volume Groups:<BR>"
for i in `vgdisplay |awk '/VG Name/ && !/awk/ {print $3}'`
do
echo "<A HREF=\"lvmdirectory$i.html\">$i</A> "
done
echo "</LI></UL>"
for i in `vgdisplay |awk '/VG Name/ && !/awk/ {print $3}'`
do
echo "</PRE>\n`_title Processing Volume Group $i`
\n<font color=red>vgdisplay -v $i</font><PRE>"> $OUT_DIR/lvmdirectory$i.html
vgdisplay -v $i >> $OUT_DIR/lvmdirectory$i.html
echo "\n<PRE>\n<H3>Processing Logical Volumes of Volume Group $i</H3>" >> $OUT_DIR/lvmdirectory$i.html
for j in `vgdisplay -v $i