5 # Author: Scott Truesdale
6 # Organization: Hewlett-Packard Account Support Organization
7 # America's Engineering Services Team
9 # NOTE: This script is a contributed utility. No official support for it
10 # will be provided by Hewlett-Packard. Any requests for bug fixes
11 # or enhancements will be handled by the author, time permitting.
13 # Version: 1.00 08/01/96
14 # Changes: 1.01 08/05/96 added functions to handle each module
15 # 1.02 \ cleaned up various
16 # 1.03 / output screens
17 # 1.04 08/20/96 added filesystem check using lvol
18 # 1.05 08/25/96 added savecore flag and space check
19 # 1.06 09/03/96 changed filesystem check to use mnttab
20 # 1.07 09/03/96 fixed filesystem check when bdf is 2 lines
21 # 1.08 10/10/96 general cleanup, added more dump checking
22 # 1.09 10/10/96 added use of pager variable for output
23 # 1.10 10/23/96 fixed dump checking section (I hope)
24 # added 10.10 compression calculation (-s)
25 # 1.11 10/30/96 fixed display of number of stale extents (-l)
26 # added comments to help document functions.
27 # 1.12 10/31/96 added -N option to disable paging option.
28 # 1.13 11/06/96 added cpu speed display (in MHz). (-s)
29 # 1.14 11/08/96 removed tabs and added comments.
30 # 1.15 11/11/96 added check for non HP-UX systems.
31 # 1.16 11/20/96 expanded mapping to include number of
32 # extents and mirrors. (-m)
33 # 1.17 11/21/96 added kernel size display (-k)
34 # added check for non-LVM disks (-p)
35 # 1.18 11/26/96 added license, machine id (-s)
36 # added domain name (-k)
37 # fixed batch to include header information
38 # added check for vgcfg files > 1 year old. (-v)
39 # added kernel size to memory dump calculations
40 # 1.19 12/03/96 fixed error if no CD mounted in CD-ROM drive
41 # changed help (-h) to use man page
42 # 1.20 12/12/96 added physical disk mapping option (-M)
44 # added dbc_max_pct kernel parm
45 # 1.21 12/17/96 added physical disk mapping for 9.x
46 # 1.22 01/07/97 fixed bug in path display for cdroms
47 # 1.23 02/04/97 added last patch date display
48 # 1.24 02/10/97 fixed bug in physical check for cdrom
50 # 1.25 02/12/97 fixed display of dump on default for 9.x
51 # 1.26 02/28/97 added display of default router
52 # 1.27 03/10/97 added display of MAC address
53 # 1.28 03/18/97 added display of alternate links
54 # added bootable check to Physical info
55 # 1.29 04/15/97 added check for dynamic buffer caching
56 # added nflocks kernel parm
57 # added check for async disk write
58 # added check for savecore compression in
59 # /etc/rc.config.d/savecore
60 # fixed exit code for warnings
61 # added auto boot string output
62 # 1.30 04/22/97 cleaned up swap and dump disk display
63 # added check for cdfs to % full warning
64 # fixed dbc and its warning for only 10.x
65 # added ability to specify savecore
66 # compression factor as variable
67 # 1.31 04/22/97 fixed bug in calculating savecore capacity
68 # 1.32 04/22/97 added display of boot disks
69 # 1.33 07/08/97 fixed pre 10.20 warning for not
70 # enough savecore space
71 # 1.34 07/19/97 added dns server display
72 # changed netmask to decimal.dot format
73 # 1.35 07/29/97 added use of model command to detect new
75 # added following from Mike Ryan:
76 # fixed display of multiple MAC addresses
77 # patch for pvdisplay difference in 10.20
78 # fix VG display when PVG-strict policies used
80 # 1.36 07/31/97 fixed bug in alternate PV link detection
81 # 1.37 08/01/97 added super page check
82 # removed dynamic buffer warning
83 # improved debug message handling
84 # changed debug messages to tee to file
85 # 1.38 08/17/97 added check for number of volume groups equal
87 # started adding HTML hooks (-H option)
88 # added HTML headers to each section
89 # added HTML links to each section
90 # added HTML info to man page
91 # 1.39 08/20/97 added check for existing logfiles
92 # ask user if we should delete batch logfile
93 # automatically delete HTML logfile
94 # changed temp file names to sysinfo.$$.
95 # 1.40 08/26/97 changed physical disk section to not query
97 # 1.41 08/28/97 added kernel parms section extracted using
99 # 1.42 09/19/97 changed network to use lanscan due to
100 # problems with multiple I/F cards.
101 # 1.43 10/21/97 added hw path to network card info.
102 # added fstype display to filesystem info.
103 # fixed display of cdfs space usage.
104 # fixed man page that incorrectly stated free
105 # space threshold was 10% instead of 5%.
106 # 1.44 04/09/98 major enhancements
107 # added ioscan listing.
108 # added software listing (10.x only)
109 # added listing of striped discs.
110 # launched io, kernel and lvm scans
111 # as background jobs to speed things up.
112 # 1.45 04/17/98 fixed bug that caused dbc parms not to
114 # 1.46 04/30/98 changed swap disk header to swap data
115 # added fs swaptype to total swap display
116 # 1.47 05/03/98 added warning about static buffer cache
117 # numbers reported from kernel.
118 # 1.48 05/20/98 added variable for logfile directory.
119 # removed user query if removing existing logfile.
120 # reworked logical volume section into two parts.
121 # 1.49 07/01/98 first set of changes to work on 11.x
122 # savecore now called savecrash
123 # changed BOOTABLE to check for >= 10
124 # physmem now called phys_mem_pages
125 # 1.49a added host name to WARNING messages
126 # added TOP link to html output
127 # 1.49b 07/16/98 fixed problems for 9.x induced by background
128 # scans of sam, swap and ioscan
129 # samscan, ioscan, swapmem
130 # removed samscan (getkinfo) from 9.x
131 # changed to force getkinfo to rescan (-b)
132 # 1.49c 07/23/98 more ioscan changes for 9.x
133 # 1.49d 07/27/98 major kernel changes
134 # 1.49e 08/01/98 fixed problem with filesystem display
135 # if size greater than 65 GB.
136 # 1.49f 08/03/98 added separate 9.x kernel function
137 # including many more kernel metrics
138 # moved kernel size to system section
139 # rewrote header section for HTML
140 # added batch print for software section
141 # changed lanscan -i for 9.x
142 # 1.49g 08/05/98 lots
143 # 1.50 08/06/98 fixed kernel parms on 10.x & 11.x
144 # 1.51 08/27/98 fixed savecore free space calculation when
145 # using non-standard lvol name
146 # added cstm extract of cpu & memory info
147 # 1.52 10/14/98 fixed adb on 11.0 with 64 bit kernel
148 # added display of 32 or 64 bit kernel on 11.0
149 # 1.53 10/16/98 added processor info from stm
150 # removed old SAM kernel code
151 # 1.54 10/20/98 increased field for PDC to 12 chars
152 # 1.55 10/20/98 fixed ifconfig problem with grep
153 # 1.56 10/20/98 added No such file or directory check to diskinfo
154 # changed rphysvol to use ioscan rather than
156 # increased display of hwpath for EMC drives
157 # 1.57 10/22/98 fixed bug in getting rdsk name
158 # 1.58 10/27/98 added bad block relocation to logical display
159 # added warning for EMC disks with LVM bad
160 # block relocation enabled
161 # 1.59 11/3/98 added check for iodevice w/o phyvol
163 # 1.70 04/12/99 added check for unsupported cstm versions
165 # 1.71 04/12/99 Numerous changes by Greg Sterling
166 # Code handles CRASHCONF utility
167 # Allows for dump devices in V11.x.
168 # Dump devices can be disk drives in addition
169 # to logical volumes.
170 # Allow for Fibrechannel devices to be
171 # accurately parsed in the Phys Device section.
172 # Updated the wait for ioscan to complete.
173 # The prior time was 15 seconds, this is not
174 # enough for a large system with many devices.
175 # I increased the wait to 125 seconds.
176 # Fixed the "Last Patch" section to work with
177 # a standard swinstall type system.
178 # Added security check. Checks file permissions
179 # on some critical files and dirs, and checks
181 # Check system log files (i.e. syslog.log,
182 # mail.log, btmp, and wtmp). These files are
183 # known to get large very quickly.
184 # Changes the Date stamp on output files
185 # to include a four digit year for Y2K reasons.
186 # Check the sendmail queue for old (older than
187 # 2 days) or large qty of entries.
188 # Added code to check/output information
189 # related to system diags (if its installed).
190 # This included diags and predictive.
191 # This option only applies to V10.x and up.
192 # Fixed a few bugs in the code which limited
193 # output to 10.10 or 10.20 systems. I had
194 # to change some of the IF statements.
195 # For V10.x systems and higher I added the
196 # /var/adm/sw/*.log files to the logfile
198 # 1.72 04/25/99 fixed bug in crashconf size calculation
199 # added ip name to ip addr in networking
200 # moved 32/64 bit to follow OS version
201 # added check for non-configured software
202 # i.e. transient, corrupt, available
204 # added listing of boot paths under bootable disks
205 # 1.73 05/14/99 fixed cstm hang problem - finally!
206 # vers 12 reversed the meanings of the
207 # SaveAs and Print commands for Infolog
208 # 1.74 05/25/99 improved formatting of cstm output
209 # 1.75 06/02/99 fixed bug when cstm_tot_phys = N/A
210 # added path to crashconf executable (/sbin/)
211 # fixed bug when Online dir has .2 suffix
212 # 1.76 07/12/99 several performance changes thanks to J. Semroc
213 # changed filesystem section
214 # added vxfs fragmentation; removed inodes
215 # added check if Vxfs version < 3 on > 10.10
216 # replaced cstm memory output
217 # added umask of 077 for security purposes
218 # 1.77 08/03/99 fixed Ignite version check for older versions
219 # removed cd-rom size from total p_size
220 # 1.78 09/07/99 added PA RISC chip and version
221 # removed cstm upper version check
222 # 1.78a 9/14/99 removed DVD size from total p_size
223 # increased sum lines for CAPACITY
224 # increased display size of product (model)
225 # 1.78b 9/18/99 Incorporated numerous changes by Jerry Schwartz:
226 # changed HTML output to use frames
227 # #fixed bug in physical disk enumeration
228 # fixed bug in check for /.profile
229 # made cosmetic changes to error messages
230 # ("Logfile" changed to "Important file",
231 # "doesn not" changed to "does not")
232 # 1.78c 10/2/99 Added cstm disk scan to retrieve firmware
233 # and serial number info.
234 # 1.78d 10/11/99 Updated models table
236 # 1.78f Added XP256 information
239 # 1.79f 04/18/00 Added INSTALL script
240 # Added checks for diagmond to prevent hangs
241 # Added disk array checks for FC60, AutoRaid
243 # 1.79g 04/19/00 Added return to diagmond check
244 # 1.79h 05/15/00 Added additional system models
245 # Removed get_array_data due to cstm problem
249 # I would like to acknowledge the following for assistance in
250 # developing and testing this tool.
252 # Jerry Schwartz, Jeff Semroc, Greg Sterling, Mike Ryan & Bill Taylor
253 # from the HP Account Support Organization for their help in debugging
254 # and improving the code.
256 # LVMcollect.* scripts from Peter Van Giel in the Hewlett-Packard
257 # Country Response Center Belgium.
258 # capture script from Dave Olker of the Hewlett-Packard Worldwide
259 # Technology Expert Center.
261 # Most of all I would like to thank the PRODUNIX support team
262 # at Oracle Corp. for allowing me access and time to develop
263 # and test using their systems.
269 export RESOLV_CONF=/etc/resolv.conf #
270 #script=`basename $0` #
272 typeset PAGER=${PAGER:-more} #
274 typeset -R4 lcount=0 # number of logical volumes
275 typeset -R4 pcount=0 # number of physical volumes
276 typeset -R4 vgcount=0 # number of volume groups
277 typeset -i total_stale=0 # number of stales extents
278 typeset stale=0 # flag set if stale extents found
279 typeset all_logvols # list of all logical volumes
280 typeset -L17 physvol # name of phyical volume
281 typeset -R21 rphysvold # name of raw phyical volume
282 typeset -R24 hwpathd # path information for disk
283 typeset -L8 vendor # vendor id string from disk
284 typeset EMC_found=0 # flag for EMC disks
285 typeset -R14 product # vendor model number from disk
286 typeset -R1 bootable_pv # is disk bootable?
287 typeset -R5 rev_level # firmware revision code from disk
288 #typeset -R12 kernel_size #\
290 typeset -R8 shmmni # \
291 typeset -R8 shmmax # \
292 typeset -R8 shmseg # \
293 typeset -R8 maxfiles # \
294 typeset -R8 maxfiles_lim # \
295 typeset -R8 maxuprc # \
296 typeset -R8 nproc # \
297 typeset -R8 fs_async # \
298 typeset -R8 nfile # kernel parameters
299 typeset -R8 nflocks #
300 typeset -R8 super_page_support # /
301 typeset -R8 dbc_max_pct # /
302 typeset -R8 dbc_min_pct # /
303 typeset -R8 ninode # /
306 typeset -R8 bufpages # /
307 typeset -R8 maxvgs # /
308 typeset SAVECORE # flag set if savecore is enabled
310 typeset COMPRESSION="N/A" # set if on 10.10 or later
311 typeset Compress_Option="N/A" # enabled in /etc/rc.config.d/savecore
312 typeset -R8 lv_pbuf_cnt # \
313 typeset -R8 lv_pbuf_inuse # \
314 typeset -R8 lv_pbuf_maxuse # more kernel parameters
315 typeset -R8 lv_pbuf_pending_Q # for lvm
316 typeset -R8 lv_vgs_opn # /
317 typeset -R8 lv_lvs_opn # /
318 typeset -i psize # physical disk size (in KBytes)
319 typeset -R8 psize_mb # physical disk size (in Mbytes)
320 ### Changed 6/15/99 J.Semroc - Changed to handle large systems with 1000+ LU's
321 ### typeset -R3 lu # physical disk logical unit number
322 typeset -R4 lu # physical disk logical unit number
324 typeset -L20 volgroup #
328 typeset -R9 AllocPe #
330 typeset -R8 TotalPe #
331 typeset -R11 AllocMb #
333 typeset -R8 TotalMb #
334 typeset -R8 TotalAllocMb=0 # total allocated Megabytes
335 typeset -R8 TotalFreeMb=0 # total free Megabytes
336 typeset -R8 SystemTotalMb=0 # total of all Megabytes
337 typeset -R8 MirrorMb=0 # size of mirror
338 typeset -R8 TotalMirrorMb=0 # total size of mirrors
339 typeset -R8 OtherMb=0 #
340 typeset -R11 total_p_mb=0 # total physical Megabytes
341 typeset -R8 total_l_mb=0 # total logical Megabytes
342 typeset -R8 unused_cap=0 #
343 typeset -L4 fs_type #
344 typeset -R4 vxfs_frag #
345 typeset -i no_lost=0 # flag if lost+found/.fsadm not found
347 typeset -L40 logvold #
349 typeset -L16 statusout # status of extents (e.g. stale)
350 typeset -R6 LVSize # size of logical volume
351 typeset -R7 LogicalExtents #
352 typeset -R8 StaleExtents #
354 typeset -R8 MirrorCopies # number of mirrors
355 typeset -R8 Consistency # mirror consistency strategy
356 typeset -i REAL_MEM # memory size (in pages)
357 typeset -i memory # memory size (in MBytes)
358 typeset -i num_cpus # number of active CPUs
359 typeset -i StaleMB=0 # stale Megabytes
360 typeset -i TotalStaleMb=0 # total stale Megabytes
361 typeset -i cpu_speed=0 # clock speed in MHz
362 typeset exit_code=0 # exit code [ 0, 1, 2, 3 ]
363 typeset ERROR=1 # exit condition (program error)
364 typeset WARN=2 # exit condition (system warning)
365 typeset SYS_ERROR=3 # exit condition (system error)
367 typeset FULL_KERNEL=0 # \
368 typeset LITE_KERNEL=0 # \
369 typeset FILESYSTEM=0 # \
370 typeset NETWORK=0 # \
373 typeset PHYSICAL=0 # flags set at runtime via
374 typeset LOGICAL=0 # command line options
376 typeset -x HTML=0 # /
377 typeset NOPAGER=0 # /
378 typeset VOLUMES=0 # /
379 typeset CAPACITY=0 # /
383 typeset KernelSafetyFactor=2 # adds two MBytes to kernel size
384 typeset lvm_installed=0 # flag set if lvm present
385 typeset -R6 DumpDiskCapacity=0 # space to hold memory dump
386 typeset -R6 CompressedMemoryDumpSize #
387 typeset -R6 compression_factor #
388 typeset -i MemoryDumpSize # amount of memory (in MBytes)
389 typeset -i TotalMemoryDumpSize # amount of memory + kernel size
390 typeset -R6 MemoryDumpSizeOut # display version of MemoryDumpSize
391 typeset -R6 TotalMemoryDumpSizeOut # display version of TotalMemoryDumpSize
392 typeset -R6 SaveCoreAvail_Out # space to hold savecore
393 # can be compressed on 10.10 and later
395 # Variables for Chk_Logfiles section
397 LOGFILELISTV10="/var/adm/syslog/syslog.log /var/adm/syslog/mail.log \
398 /var/adm/btmp /var/adm/wtmp /var/adm/sw/swagent.log /var/adm/sw/swagentd.log \
399 /var/adm/sw/swconfig.log /var/adm/sw/swcopy.log /var/adm/sw/swinstall.log \
400 /var/adm/sw/swmodify.log /var/adm/sw/swreg.log /var/adm/sw/swremove.log"
402 LOGFILELISTV9="/usr/adm/syslog /usr/spool/mqueue/log /etc/btmp /etc/wtmp"
404 # Variables for Chk_SysAccess section
406 WORLDREADFILES="/etc/passwd /etc/group /etc/hosts /etc/services \
409 NOREADFILES=~root/.profile
411 # variables for io_scan section
414 GREP_V_ARGS="-eNO_HW"
415 typeset -x ioscan_args="-F"
416 typeset -x io_scan_out=/tmp/sysinfo.$$.io_scan.out
417 typeset -x io_scan_tmp=/tmp/sysinfo.$$.io_scan.tmp
418 typeset -x io_scan_done=/tmp/sysinfo.$$.io_scan_done
419 typeset -x io_scan_command_file=/tmp/sysinfo.$$.io_scan_command_file
421 # variables for lvm_scan section
423 typeset -x vg_list_file=/tmp/sysinfo.$$.vg.list
424 typeset -x vg_out_file=/tmp/sysinfo.$$.vg.out
425 typeset -x lvol_list_file=/tmp/sysinfo.$$.lvol.list
426 typeset -x lvol_out_file=/tmp/sysinfo.$$.lvol.out
427 typeset -x pvol_list_file=/tmp/sysinfo.$$.pvol.list
428 typeset -x pvol_out_file=/tmp/sysinfo.$$.pvol.out
429 typeset -x lvm_scan_command_file=/tmp/sysinfo.$$.lvm_scan_command_file
430 typeset -x lvm_scan_done=/tmp/sysinfo.$$.lvm_scan_done
432 # variables for sam_scan section
434 typeset -x sam_scan_command_file=/tmp/sysinfo.$$.sam_scan_command_file
435 typeset -x sam_scan_done=/tmp/sysinfo.$$.sam_scan_done
436 typeset -x sam_out_file=/tmp/sysinfo.$$.sam.out
437 #typeset -x sam_kinfo=/tmp/sysinfo.$$.kinfo
438 typeset -x sam_kinfo_new=/tmp/sysinfo.$$.kinfo_new
440 # variables for kernel section
442 typeset -x sam_kinfo=${sam_kinfo:-/tmp/sysinfo.$$.sam_kinfo}
443 typeset -x all_parms_file=/tmp/sysinfo.$$.all_parms
444 typeset -x all_classes_file=/tmp/sysinfo.$$.all_classes
446 # variables for cstm section
448 typeset -x cstm_command_file=/tmp/sysinfo.$$.cstm_command_file
449 typeset -x cstm_cpu_out=/tmp/sysinfo.$$.cstm_cpu_out
450 typeset -x cstm_cpu_out2=/tmp/sysinfo.$$.cstm_cpu_out2
451 typeset -x cstm_mem_out=/tmp/sysinfo.$$.cstm_mem_out
452 typeset -x cstm_disk_out=/tmp/sysinfo.$$.cstm_disk_out
453 typeset -x cstm_array_out=/tmp/sysinfo.$$.cstm_array_out
455 # variables for sap section
457 # translate uppercase to lowercase
458 TRUL='tr "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"'
459 typeset -x r3_dir=/var/opt/perf/datafiles/r3dsi
460 typeset -x r3_prog=${r3_dir}/r3agent
461 typeset -i num_instances=0
466 TEMPFILE=/var/sam/sam.$$
471 ################################################################################
472 # Function: DebugOn()
473 # Description: Turns debugging mode on.
480 export _DEBUG_FILE=/tmp/sysinfo_${sysname}_`date '+%Y%m%d'`_debug
481 #Debug Debug ON: info will be logged to screen and to $_DEBUG_FILE
482 print "\nDebug ON: info will be logged to $_DEBUG_FILE"
483 Debug Debug ON: info will be logged to $_DEBUG_FILE
486 ################################################################################
487 # Function: DebugOff()
488 # Description: Turns debugging mode off.
496 _DEBUG_FILE=$ROOT/debug.out
499 ###############################################################################
501 # Description: Prints debug statements to stderr when debug mode is on.
502 # Arguments: Text to echo.
507 if [ "$_DEBUG" -gt 0 ]
509 #echo "DEBUG (PID $$): $*" | tee -a $_DEBUG_FILE 1>&2
510 echo "DEBUG (PID $$): $*" >> $_DEBUG_FILE 2>&1
515 #-----------------------------------------------------------#
516 # Exit function, called by trapped signals
517 #-----------------------------------------------------------#
520 # print "Cleaning up, please wait."
521 if (($DEBUG)) && ((!(($NOPAGER)) ))
523 read answer?"Delete temp files? [Y/n]"
524 if [[ ${answer} = n ]]
526 print "O.K. Don't forget to delete /tmp/sysinfo.$$.*"
527 print "exit value = ${exit_code}"
529 print "O.K. I'm deleting temp files /tmp/sysinfo.$$.*"
530 rm -f /tmp/sysinfo.$$.* > /dev/null 2>&1
531 print "exit_code = ${exit_code}"
534 rm -f /tmp/sysinfo.$$.* > /dev/null 2>&1
538 trap _sigexit EXIT KILL HUP QUIT INT
545 ${script} ${version} by Scott Truesdale
547 Usage: ${script} [-aADfikKlLmMnpsSv] [-b|-H|-N]
550 -a displays all of the following options.
551 -A displays file access security.
552 -D checks system diagnostic information.
553 -f checks filesystems for free space.
554 -h displays detailed help message.
555 -i displays io configuration.
556 -k displays brief kernel parameters.
557 -K displays verbose kernel parameters.
558 -l displays logical volume data.
559 -L displays system logfile info.
560 -m displays logical to physical disk mapping.
561 -M displays physical to logical disk mapping.
562 -n displays network interface data.
563 -p displays physical disk data.
564 -P checks for R/3 instances.
565 -s displays the system and root disk data.
566 -S displays software listing (swlist).
567 -v displays volume group data.
569 -b send output to a logfile.
570 -H send output to a logfile in HTML format.
571 -N turn off paging in screen mode.
573 Note: disk capacity data is displayed only when using -a or -lpv.
580 export MANPATH=/usr/contrib/man:${where}:$MANPATH
581 # to debug help -d must come before -h
583 Debug " where=${where}"
584 Debug " MANPATH=${MANPATH}"
585 if [[ -f ${where}/man1m/sysinfo.1m ]] || \
586 [[ -f /usr/contrib/man/man1m/sysinfo.1m ]]
591 print "Cannot find man page for ${script}!"
592 print "Expected to find it in /usr/contrib/man/man1m/"
598 #===================================================================
600 # gets command line arguments passed in at run time
601 #===================================================================
606 #print "\n$Must specify one or more of the following:$\n"
610 while getopts :abdfhiklmnpsvADHKLMNPS arguments
631 LOGDIR=${SYSINFO_LOGDIR:-"/tmp"}
632 LOGFILE="${LOGDIR}/sysinfo_${sysname}_`date '+%Y%m%d'`"
633 Debug "Removing $LOGFILE"
634 rm -f $LOGFILE > /dev/null 2>&1
660 LOGDIR=${SYSINFO_LOGDIR:-"/tmp"}
661 LOGFILE="${LOGDIR}/sysinfo_${sysname}_`date '+%Y%m%d'`.html"
662 if [[ -f ${LOGFILE} ]]
664 rm -f $LOGFILE >> /dev/null 2>&1
665 Debug "Removing $LOGFILE"
667 LOGFILE_INDEX_REL="`basename ${LOGFILE} .html`.index.html"
668 LOGFILE_INDEX="`dirname ${LOGFILE}`/${LOGFILE_INDEX_REL}"
669 if [[ -f ${LOGFILE_INDEX} ]]
671 rm -f ${LOGFILE_INDEX} >> /dev/null 2>&1
672 Debug "Removing ${LOGFILE_INDEX}"
674 LOGFILE_MAIN_REL="`basename ${LOGFILE} .html`.main.html"
675 LOGFILE_MAIN="`dirname ${LOGFILE}`/${LOGFILE_MAIN_REL}"
676 if [[ -f ${LOGFILE_MAIN} ]]
678 rm -f ${LOGFILE_MAIN} >> /dev/null 2>&1
679 Debug "Removing ${LOGFILE_MAIN}"
700 ?) print "\nI don't understand that option\n"
704 if (($PHYSICAL)) && (($VOLUMES)) && (($LOGICAL))
708 if (($LITE_KERNEL)) && (($FULL_KERNEL))
712 if (($BATCH)) && (($DEBUG))
717 Debug "FLAGS: System=$SYSTEM Batch=$BATCH FullKernel=$FULL_KERNEL"
718 Debug "FLAGS: LiteKernel=$LITE_KERNEL Network=$NETWORK"
719 Debug "FLAGS: Volumes=$VOLUMES Capacity=$CAPACITY Logical=$LOGICAL"
720 Debug "FLAGS: Physical=$PHYSICAL LMapping=$LMAP PMapping=$PMAP"
721 Debug "FLAGS: Filesystem=$FILESYSTEM NoPager=$NOPAGER Html=$HTML"
722 Debug "FLAGS: Ioscan=$IOSCAN lvm_scan=$LVMSCAN Sam_scan=$SAMSCAN"
723 Debug "FLAGS: Swlist=$SWLIST Diagnostics=$DIAGNOSTICS"
724 Debug "FLAGS: PASS=$PASS"
727 print "\nOutput going to ${LOGFILE}"
732 #===================================================================
734 # this function displays a file to the screen. it takes one parm,
735 # the file to display. It uses the defined PAGER or more if that
736 # variable is not defined.
737 #===================================================================
738 function f_display_file
747 grep -v "#Top" $1 | grep -v "TOP</A" >> $LOGFILE_MAIN
752 else # not batch so use PAGER
756 } # end of f_display_file
759 ###############################################################################
760 # Function: check_for_sap
761 # Description: Check for any instances of R/3 by running r3agent -all.
762 # The output is scanned for the required info.
764 # The r3agentSYSTEM output is as follows:
765 # 01 "31G" "QAS" "sapgui sapd370 nr=01 name=QAS"
767 # The r3agentCONFIGURATION output is as follows:
768 # 01 "DVEBMGS01" "QAS" "sapd370" ""
770 function check_for_sap
772 print "Checking for SAP R/3 instances."
776 print "</PRE>" >> /tmp/sysinfo.$$.sap
777 print "<A name='SAP'></A>" >> /tmp/sysinfo.$$.sap
778 print "<H2>" >> /tmp/sysinfo.$$.sap
779 print "<P ALIGN=RIGHT><A HREF='#Top'>" >> /tmp/sysinfo.$$.sap
780 print "TOP</A></P>" >> /tmp/sysinfo.$$.sap
781 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.sap
782 print "SAP R/3 Info</FONT></H2>" >> /tmp/sysinfo.$$.sap
783 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.sap
785 print "" >> /tmp/sysinfo.$$.sap
786 print "SAP R/3 Information" >> /tmp/sysinfo.$$.sap
787 print "===================" >> /tmp/sysinfo.$$.sap
788 print "" >> /tmp/sysinfo.$$.sap
793 num_instances=$( cat ./r3agentSYSTEM | wc -l)
794 if ((num_instances == 0))
796 print "No R/3 instances found."
797 print "No R/3 instances found." >> /tmp/sysinfo.$$.sap
798 rm ./r3agent[A-Z]* > /dev/null 2>&1
801 print "Found ${num_instances} instances."
802 cat ./r3agentCONFIGURATION |
803 while read inst_id INSTANCE_NAME SAPSYSTEMNAME SAPDBHOST p5 p6 p7
805 INSTANCE_NAME=$(echo ${INSTANCE_NAME} | sed -e 's/\"*//g')
806 SID=$(echo ${SAPSYSTEMNAME} | sed -e 's/\"*//g')
807 SAPDBHOST=$(echo ${SAPDBHOST} | sed -e 's/\"*//g')
808 SAP_ADM="`echo $SID | $TRUL`adm"
809 startsap=$(su - ${SAP_ADM} -c "alias startsap" 2>&1 | tail -1)
810 sapstart=$(ps -ef | grep sapstart | grep -v grep | awk '{print $9}')
811 #PROFILE_DIR=$(grep "^PROFILE_DIR" ${startsap} | awk -F\" '{print $2}')
812 PROFILE_DIR=/usr/sap/${SID}/SYS/profile
813 EXE_DIR=/usr/sap/${SID}/SYS/exe/run
814 startprofile=$(grep "^START_PROFILE" ${startsap} |awk -F\" '{print $2}')
815 #SAPDBHOST=$(awk -F= '/SAPDBHOST/ {print $2}' $PROFILE_DIR/DEFAULT.PFL)
816 ${EXE_DIR}/disp+work -V > /tmp/sysinfo.$$.dispwork 2>&1
818 Debug "Saving dispwork -V output file"
819 cp /tmp/sysinfo.$$.dispwork ${r3_dir}/dispwork > /dev/null 2>&1
821 r3kernel=$(grep "kernel release" /tmp/sysinfo.$$.dispwork | \
823 r3patch=$(grep "patch level" /tmp/sysinfo.$$.dispwork | \
824 head -1 | awk '{print $3}')
825 r3db=$(grep "database kernel" /tmp/sysinfo.$$.dispwork | \
827 r3dbver=$(grep "database kernel" /tmp/sysinfo.$$.dispwork | \
829 if [[ -f ${PROFILE_DIR}/${startprofile} ]]
831 Debug "Saving profile ${PROFILE_DIR}/${startprofile}"
832 cp ${PROFILE_DIR}/${startprofile} ${r3_dir} > /dev/null 2>&1
834 if [[ $SAPDBHOST = $sysname ]]
837 startdb=${EXE_DIR}/startsb
838 ORASID="ora`echo $SID | $TRUL`"
839 ORACLE_HOME=/oracle/${SID}
840 db_profile=${ORACLE_HOME}/dbs/init${SID}.ora
841 INITORA=$ORACLE_HOME/dbs/init${SID}.ora
842 if [[ -f ${db_profile} ]]
844 Debug "Saving profile ${db_profile}"
845 cp ${db_profile} ${r3_dir} > /dev/null 2>&1
848 print " Instance ID = $inst_id" >> /tmp/sysinfo.$$.sap
849 print " Instance Name = ${INSTANCE_NAME}" >> /tmp/sysinfo.$$.sap
850 print " SAP System Name = ${SID}" >> /tmp/sysinfo.$$.sap
851 print " R/3 Kernel Vers = ${r3kernel}" >> /tmp/sysinfo.$$.sap
852 print " R/3 Patch Level = ${r3patch}" >> /tmp/sysinfo.$$.sap
853 print " R/3 DB Vendor = ${r3db}" >> /tmp/sysinfo.$$.sap
854 print " R/3 DB Version = ${r3dbver}" >> /tmp/sysinfo.$$.sap
855 print " SAP adm user = ${SAP_ADM}" >> /tmp/sysinfo.$$.sap
856 print " startsap = ${startsap}" >> /tmp/sysinfo.$$.sap
857 print " sapstart = ${sapstart}" >> /tmp/sysinfo.$$.sap
858 print " Profile Dir = ${PROFILE_DIR}" >> /tmp/sysinfo.$$.sap
859 print " startprofile = ${startprofile}" >> /tmp/sysinfo.$$.sap
860 print " SAPDBHOST = ${SAPDBHOST}" >> /tmp/sysinfo.$$.sap
861 if (($DB_on_this_sys))
863 print " DB_on_this_sys = true" >> /tmp/sysinfo.$$.sap
864 print " ORASID = ${ORASID}" >> /tmp/sysinfo.$$.sap
865 print " ORACLE_HOME = ${ORACLE_HOME}" >> /tmp/sysinfo.$$.sap
866 print " INITORA = ${INITORA}" >> /tmp/sysinfo.$$.sap
868 print " DB_on_this_sys = false" >> /tmp/sysinfo.$$.sap
870 print "" >> /tmp/sysinfo.$$.sap
874 print " r3agent not found!"
875 print " Scanning for dw.sap processes."
876 allinst=$(ps -ef | grep dw.sap | grep -v grep | awk '{print $(NF -1)}' | sort | uniq)
881 num_instances=$(echo $allinst | wc -w)
883 if ((num_instances == 0))
885 print "No R/3 instances found."
886 print "No R/3 instances found." >> /tmp/sysinfo.$$.sap
889 print "Found ${num_instances} instances."
890 for inst in ${allinst}
892 numchar=$(echo $inst | wc -c)
893 (( numchar = numchar - 1 ))
894 (( numchar1 = numchar - 1 ))
895 SID=$(echo $inst | cut -b7-9)
896 inst_id=$(echo $inst | cut -b${numchar1}-${numchar})
897 INSTANCE_NAME=$(echo $inst | cut -b11-${numchar})
898 SAP_ADM="`echo $SID | $TRUL`adm"
899 PROFILE_DIR=/usr/sap/${SID}/SYS/profile
900 startsap=$(su - ${SAP_ADM} -c "alias startsap" 2>&1 | tail -1)
901 #sapstart=$(ps -ef | grep sapstart | grep $SID |grep -v grep | awk '{print $9}')
902 sapstart=$(ls -L ${PROFILE_DIR}/START_${INSTANCE_NAME})
904 startprofile=$(grep "^START_PROFILE" ${sapstart} |awk -F\" '{print $2}')
905 EXE_DIR=/usr/sap/${SID}/SYS/exe/run
906 SAPDBHOST=$(awk -F= '/SAPDBHOST/ {print $2}' $PROFILE_DIR/DEFAULT.PFL)
907 SAPDBHOST=$(echo $SAPDBHOST | sed -e 's/\ *//g')
908 if [[ $SAPDBHOST = $sysname ]]
911 startdb=${EXE_DIR}/startsb
912 ORASID="ora`echo $SID | $TRUL`"
913 ORACLE_HOME=/oracle/${SID}
914 INITORA=$ORACLE_HOME/dbs/init${SID}.ora
915 if [[ -f ${db_profile} ]]
917 Debug "Saving profile ${db_profile}"
918 cp ${db_profile} ${r3_dir} > /dev/null 2>&1
921 ${EXE_DIR}/disp+work -V > /tmp/sysinfo.$$.dispwork 2>&1
923 Debug "Saving dispwork -V output file"
924 cp /tmp/sysinfo.$$.dispwork ${r3_dir}/dispwork > /dev/null 2>&1
926 r3kernel=$(grep "kernel release" /tmp/sysinfo.$$.dispwork | \
928 r3patch=$(grep "patch level" /tmp/sysinfo.$$.dispwork | \
929 head -1 | awk '{print $3}')
930 r3db=$(grep "database kernel" /tmp/sysinfo.$$.dispwork | \
932 r3dbver=$(grep "database kernel" /tmp/sysinfo.$$.dispwork | \
935 print " Instance ID = $inst_id" >> /tmp/sysinfo.$$.sap
936 print " Instance Name = ${INSTANCE_NAME}" >> /tmp/sysinfo.$$.sap
937 print " SAP System Name = ${SID}" >> /tmp/sysinfo.$$.sap
938 print " R/3 Kernel Vers = ${r3kernel}" >> /tmp/sysinfo.$$.sap
939 print " R/3 Patch Level = ${r3patch}" >> /tmp/sysinfo.$$.sap
940 print " R/3 DB Vendor = ${r3db}" >> /tmp/sysinfo.$$.sap
941 print " R/3 DB Version = ${r3dbver}" >> /tmp/sysinfo.$$.sap
942 print " SAP adm user = ${SAP_ADM}" >> /tmp/sysinfo.$$.sap
943 print " startsap = ${startsap}" >> /tmp/sysinfo.$$.sap
944 print " sapstart = ${sapstart}" >> /tmp/sysinfo.$$.sap
945 print " Profile Dir = ${PROFILE_DIR}" >> /tmp/sysinfo.$$.sap
946 print " startprofile = ${startprofile}" >> /tmp/sysinfo.$$.sap
947 print " SAPDBHOST = ${SAPDBHOST}" >> /tmp/sysinfo.$$.sap
948 if (($DB_on_this_sys))
950 print " DB_on_this_sys = true" >> /tmp/sysinfo.$$.sap
951 print " ORASID = ${ORASID}" >> /tmp/sysinfo.$$.sap
952 print " ORACLE_HOME = ${ORACLE_HOME}" >> /tmp/sysinfo.$$.sap
953 print " INITORA = ${INITORA}" >> /tmp/sysinfo.$$.sap
955 print " DB_on_this_sys = false" >> /tmp/sysinfo.$$.sap
957 print "" >> /tmp/sysinfo.$$.sap
964 ###############################################################################
965 # Function: chk_ignite()
966 # Description: Check if IgniteUX is installed. If so, check for the last
967 # completed make_recovery. Check if make_recovery -C has been
968 # run. If so, run check_recovery and display results.
975 Debug " Starting chk_ignite"
976 if [[ ${osmajor} < 10 ]]
978 print "IgniteUX is not supported on less that HP-UX 10.x"
979 Debug " Unsupported HP-UX version $osmajor"
982 print "Checking for IgniteUX."
983 if [ -d /opt/ignite ]
985 if [ -f /opt/ignite/Version ]
987 ignite_ver=$(cat /opt/ignite/Version)
988 print "IgniteUX is installed. Version = $ignite_ver" >> \
989 /tmp/sysinfo.$$.ignite
991 print "IgniteUX is installed. Version = N/A." \
992 >> /tmp/sysinfo.$$.ignite
994 if [ -f /var/opt/ignite/logs/makerec.log1 ]
996 last_make_recovery=$(grep Completed /var/opt/ignite/logs/makerec.log1)
997 if [ -z $last_make_recovery ]
999 print "WARNING (${sysname}): IGNITE make_recovery not run." >> \
1000 /tmp/sysinfo.$$.errwarn
1002 print "Most recent make_recovery = ${last_make_recovery}" >> \
1003 /tmp/sysinfo.$$.ignite
1006 print "WARNING (${sysname}): IGNITE make_recovery not run or logfile deleted." \
1007 >> /tmp/sysinfo.$$.errwarn
1009 if [ -f /var/opt/ignite/recovery/makerec.last ]
1011 check_recovery #> /dev/null 2>&1
1013 print "WARNING (${sysname}): IGNITE check_recovery log not found" \
1014 >> /tmp/sysinfo.$$.errwarn
1017 print "WARNING (${sysname}): IgniteUX is NOT installed." \
1018 >> /tmp/sysinfo.$$.errwarn
1020 f_display_file /tmp/sysinfo.$$.ignite
1022 ###############################################################################
1023 # Function: chk_diags()
1024 # Description: Check the system's diagnostic software configuration. Output
1025 # the predictive setting if its installed. This is important info.
1032 Debug " Starting Chk_Diags. OSMAJOR = $osmajor"
1036 print "</PRE>" >> /tmp/sysinfo.$$.diagnostics.info
1037 print "<A NAME='DIAGNOSTICS'></A>" >> \
1038 /tmp/sysinfo.$$.diagnostics.info
1040 /tmp/sysinfo.$$.diagnostics.info
1041 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> \
1042 /tmp/sysinfo.$$.diagnostics.info
1043 print "<FONT COLOR=red>" >> \
1044 /tmp/sysinfo.$$.diagnostics.info
1045 print "System Diagnostics Settings</H2>" >> \
1046 /tmp/sysinfo.$$.diagnostics.info
1047 print "</FONT><PRE><font size = '4'>" >> \
1048 /tmp/sysinfo.$$.diagnostics.info
1050 print "SYSTEM DIAGNOSTICS SETTINGS" >> \
1051 /tmp/sysinfo.$$.diagnostics.info
1052 print "==========================" >> \
1053 /tmp/sysinfo.$$.diagnostics.info
1056 print -n "checking system diagnostics "
1058 print "" >> /tmp/sysinfo.$$.diagnostics.info
1062 # Look for the OnlineDiag product file. If it exists, then the product is
1063 # installed on the system. You can use the product's INDEX file to get the
1064 # product version (this can be important info).
1067 prodfile=$(ls -d /var/adm/sw/products/OnlineDiag* 2>&1)
1068 Debug "Found OnlineDiag dir - ${prodfile}"
1069 if [ -d "$prodfile" ]
1071 print -n "Online Diagnostics are Installed: " \
1072 >> /tmp/sysinfo.$$.diagnostics.info
1073 print "Version: $(grep ^revision $prodfile/pfiles/INDEX \
1074 | awk '{print $NF}')\t\c" >> /tmp/sysinfo.$$.diagnostics.info
1075 print "Status: \c" >> /tmp/sysinfo.$$.diagnostics.info
1077 # Now use the PS command to see if diagnostics are running.
1079 ps -ef | grep -q diagmon
1082 print "Running" >> /tmp/sysinfo.$$.diagnostics.info
1084 print "Down" >> /tmp/sysinfo.$$.diagnostics.info
1086 print "" >> /tmp/sysinfo.$$.diagnostics.info
1088 # If the diagnostics software is properly installed then there should be
1089 # programs in the LIF area named ODE, MAPPER, and MAPFILE. If these values
1090 # are not present, then diags will not run from console mode.
1092 # By checking all boot disks (obtained from lvlnboot -v), we also check
1093 # any mirrored volumes. This is good because mirrored root volumes are
1096 typeset -i liferrors
1097 bootdsks=$(lvlnboot -v 2>/dev/null | grep "Boot Disk" | awk '{print $1}')
1099 print "Checking LIF Information (ODE, MAPPER and, MAPFILE)" >> \
1100 /tmp/sysinfo.$$.diagnostics.info
1103 # Now loop for each boot disk found by lvlnboot -v. This will check mirrors
1104 # as well as primary disks. All boot disks should have diags installed.
1106 for bdisk in $bootdsks
1109 lifls -l $bdisk >> /tmp/sysinfo.$$.diagnostics.lifinfo
1110 for lfdiag in ODE MAPPER MAPFILE
1112 grep -q $lfdiag /tmp/sysinfo.$$.diagnostics.lifinfo
1115 print "WARNING (${sysname}): Missing $lfdiag on ${bdisk}." \
1116 >> /tmp/sysinfo.$$.errwarn
1117 liferrors=liferrors+1
1121 # If the liferrors variable is greater than zero then this disk was missing at
1122 # least one of the required LIF files. If its equal to zero, then this disk
1123 # has all the required info.
1125 if [ $liferrors -eq 0 ]
1127 print "$bdisk\tOK" >> /tmp/sysinfo.$$.diagnostics.info
1131 print "WARNING (${sysname}): Online Diagnostics are NOT Installed." >> \
1132 /tmp/sysinfo.$$.errwarn
1133 print "Online Diagnostics are NOT Installed." >> \
1134 /tmp/sysinfo.$$.diagnostics.info
1137 # Now check the system product database to see if Predictive is installed.
1138 # If it is, then output its version info, and check to see if its running
1139 # (again using the ps command).
1142 print " " >> /tmp/sysinfo.$$.diagnostics.info
1143 prodfile=$(ls -d /var/adm/sw/products/Predictive* 2>&1)
1144 Debug "Found Predictive dir - ${prodfile}"
1145 if [ -d "$prodfile" ]
1147 print -n "Predictive is Installed: Version:" \
1148 >> /tmp/sysinfo.$$.diagnostics.info
1149 print " $(grep ^revision $prodfile/pfiles/INDEX | awk \
1150 '{print $NF}')\t\c" >> /tmp/sysinfo.$$.diagnostics.info
1151 print "Status: \c" >> /tmp/sysinfo.$$.diagnostics.info
1152 ps -ef | grep -q psmond
1155 print "Running" >> /tmp/sysinfo.$$.diagnostics.info
1157 print "Down" >> /tmp/sysinfo.$$.diagnostics.info
1160 # Predictive is installed. Run PSCONFIG to output the configuration info and
1161 # the recent log history. This is good documentation of the system, and shows
1162 # whether the system has been reporting problems to the response center.
1165 print "" >> /tmp/sysinfo.$$.diagnostics.info
1166 print "Predictive Configuration Information" >> \
1167 /tmp/sysinfo.$$.diagnostics.info
1168 if [ -x /opt/pred/bin/PSCONFIG ]
1171 /opt/pred/bin/PSCONFIG print configuration >> \
1172 /tmp/sysinfo.$$.diagnostics.info 2>/dev/null
1174 /opt/pred/bin/PSCONFIG print action >> \
1175 /tmp/sysinfo.$$.diagnostics.info 2>/dev/null
1177 print "ARNING (${sysname}): PSCONFIG is not executable" >> \
1178 /tmp/sysinfo.$$.errwarn
1181 print "Predictive is NOT Installed." >> \
1182 /tmp/sysinfo.$$.diagnostics.info
1183 print "WARNING (${sysname}): Predictive is NOT Installed." >> \
1184 /tmp/sysinfo.$$.errwarn
1188 # I did not implement any code which would work with V9.x or earlier. At this
1189 # point, most customers should be at V10.x by now. V9.x is off support life.
1192 print "This module was created for V10.x and higher. Sorry."
1197 print "" >> /tmp/sysinfo.$$.diagnostics.info
1199 f_display_file /tmp/sysinfo.$$.diagnostics.info
1204 ###############################################################################
1205 # Function: chk_sysaccess()
1206 # Description: Routine used to check some of the security characteristics of
1207 # the system. This includes checking the permissions of the
1208 # /etc/passwd, and /etc/group files as well as checking for
1209 # .rhosts and other files.
1214 Debug " Starting Chk_SysAccess. OSMAJOR = $osmajor"
1218 print "</PRE>" >> /tmp/sysinfo.$$.sysaccess.info
1219 print "<A NAME='SYSACCESS'></A>" >> /tmp/sysinfo.$$.sysaccess.info
1220 print "<H2>" >> /tmp/sysinfo.$$.sysaccess.info
1221 print "<P ALIGN=RIGHT><A HREF='#Top'>" >> /tmp/sysinfo.$$.sysaccess.info
1222 print "TOP</A></P>" >> /tmp/sysinfo.$$.sysaccess.info
1223 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.sysaccess.info
1224 print "System Security Audit</H2>" >> /tmp/sysinfo.$$.sysaccess.info
1225 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.sysaccess.info
1227 print "SYSTEM SECURITY AUDIT" >> /tmp/sysinfo.$$.sysaccess.info
1228 print "==========================" >> /tmp/sysinfo.$$.sysaccess.info
1231 last -R > /tmp/sysinfo.$$.last
1232 print -n "checking system security "
1233 print "" >> /tmp/sysinfo.$$.sysaccess.info
1235 print "File Permissions. Files which should be World and Group Read-Only." \
1236 >> /tmp/sysinfo.$$.sysaccess.info
1238 for lfile in $WORLDREADFILES
1240 Debug " chk_SysAccess. Checking $lfile."
1241 if [[ ! -a "$lfile" ]]
1243 print "ERROR ($sysname): Important file $lfile does not exist." >> \
1244 /tmp/sysinfo.$$.errwarn
1248 # Get the important file's directory information.
1250 llinfo=$(ll -d $lfile)
1252 # Now check the file's permissions
1254 echo "$llinfo" | cut -c5-10 | egrep -q "w"
1257 print "WARNING ($sysname): Important file $lfile has Group or World WRITE access. " >> /tmp/sysinfo.$$.errwarn
1260 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.info
1264 # Now check the system for files/directories which should be accessible to
1265 # root only. This code will flag files which have any access other than the
1268 print "" >> /tmp/sysinfo.$$.sysaccess.info
1269 print "File Permissions. Files which should be Accessible to Root only." >> \
1270 /tmp/sysinfo.$$.sysaccess.info
1272 for lfile in $NOREADFILES
1274 Debug " chk_SysAccess. Checking $lfile."
1275 if [[ ! -a "$lfile" ]]
1277 print "WARNING ($sysname): Important file $lfile does not exist." >> \
1278 /tmp/sysinfo.$$.errwarn
1282 # Get the Important file's directory information.
1284 llinfo=$(ll -d $lfile)
1286 # Now check the file's permissions
1288 echo "$llinfo" | cut -c5-10 | egrep -q "r|w|x"
1291 print "WARNING ($sysname): Important file $lfile has Group or World access." \
1292 >> /tmp/sysinfo.$$.errwarn
1295 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.info
1299 print "" >> /tmp/sysinfo.$$.sysaccess.info
1300 print "Check for Important Audit Files:" >> /tmp/sysinfo.$$.sysaccess.info
1302 # Now check for the wtmp and btmp files. These are important to login history.
1303 # make sure they exist, if not, then give a warning. then check their security.
1304 # The wtmp file tracks login history. The btmp file tracks invalid logons.
1306 # Also check the sulog file. This file tracks the history of SU'ing to root.
1312 SULOG="/usr/adm/sulog"
1316 WTMP="/var/adm/wtmp"
1317 BTMP="/var/adm/btmp"
1318 SULOG="/var/adm/sulog"
1322 # Check the wtmp file
1324 if [[ ! -a "$WTMP" ]]
1326 print "WARNING ($sysname): Audit File $WTMP does not exist." >> \
1327 /tmp/sysinfo.$$.errwarn
1328 print "If you create $WTMP you can track logon history." >> \
1329 /tmp/sysinfo.$$.errwarn
1330 print " " >> /tmp/sysinfo.$$.errwarn
1332 llinfo=$(ll -d $WTMP)
1334 echo "$llinfo" | cut -c8-10 | egrep -q "w"
1337 print -n "WARNING ($sysname): Audit File $WTMP has Group or " >> \
1338 /tmp/sysinfo.$$.errwarn
1339 print "World WRITE access." >> /tmp/sysinfo.$$.errwarn
1340 print " $WTMP should have at most World read access." >> \
1341 /tmp/sysinfo.$$.errwarn
1342 print " " >> /tmp/sysinfo.$$.errwarn
1344 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.info
1347 # Now check the btmp file.
1349 if [[ ! -a "$BTMP" ]]
1351 print "WARNING ($sysname): Audit File $BTMP does not exist." >> \
1352 /tmp/sysinfo.$$.errwarn
1353 print "If you create $BTMP you can track invalid logon history." >> \
1354 /tmp/sysinfo.$$.sysaccess.warn
1355 print " " >> /tmp/sysinfo.$$.sysaccess.warn
1357 llinfo=$(ll -d $BTMP)
1359 echo "$llinfo" | cut -c5-10 | egrep -q "w"
1362 print -n "WARNING ($sysname): Audit File $BTMP has Group or ">> \
1363 /tmp/sysinfo.$$.errwarn
1364 print "World WRITE access." >> /tmp/sysinfo.$$.errwarn
1365 print "$BTMP should have at most Group or World read access." >> \
1366 /tmp/sysinfo.$$.errwarn
1367 print " " >> /tmp/sysinfo.$$.errwarn
1370 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.info
1373 # Check the sulog file now.
1375 if [[ ! -a "$SULOG" ]]
1377 print "WARNING ($sysname): Audit File $SULOG does not exist." >> \
1378 /tmp/sysinfo.$$.errwarn
1379 print "If you create $SULOG you can track su logon history." >> \
1380 /tmp/sysinfo.$$.sysaccess.warn
1381 print " " >> /tmp/sysinfo.$$.sysaccess.warn
1383 llinfo=$(ll -d $SULOG)
1385 echo "$llinfo" | cut -c5-10 | egrep -q "w"
1388 print -n "WARNING ($sysname): Audit File $SULOG has Group or " >> \
1389 /tmp/sysinfo.$$.errwarn
1390 print "World WRITE access." >> /tmp/sysinfo.$$.sysaccess.warn
1391 print "$SULOG should have at most Group or World read access." >> \
1392 /tmp/sysinfo.$$.sysaccess.warn
1393 print " " >> /tmp/sysinfo.$$.sysaccess.warn
1396 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.info
1397 print " " >> /tmp/sysinfo.$$.sysaccess.info
1398 print "Five Most Recent SUlog entries:" >> /tmp/sysinfo.$$.sysaccess.info
1399 tail -5 $SULOG >> /tmp/sysinfo.$$.sysaccess.info
1402 # Check the validity of the /etc/passwd and /etc/group files by running
1403 # the pwck and grpck commands. This will help identify illegal password and
1404 # group entries. Also, check the /etc/passwd file for entries missing
1407 if [[ -x "/etc/pwck" ]]
1409 print " " >> /tmp/sysinfo.$$.sysaccess.info
1410 print "Running Passwd Check Script:" >> /tmp/sysinfo.$$.sysaccess.info
1411 /etc/pwck >> /tmp/sysinfo.$$.sysaccess.info 2>&1
1414 # Check the password file for entries w/o a password.
1416 awk -F: -v sysname=$sysname ' $2 == "" { printf("\nERROR. (%s). NULL Password found in /etc/passwd\nPassword Record = %s\n\n",sysname,$0)}' /etc/passwd >> \
1417 /tmp/sysinfo.$$.errwarn 2>&1
1419 if [[ -x "/etc/grpck" ]]
1421 print " " >> /tmp/sysinfo.$$.sysaccess.info
1422 print "Running Group Check Script:" >> /tmp/sysinfo.$$.sysaccess.info
1423 /etc/grpck >> /tmp/sysinfo.$$.sysaccess.info 2>&1
1427 # Now check for an .rhost file definition for root.
1428 # If this file exists, then print a message since this is a potential security
1431 if [[ -a "/.rhosts" ]]
1433 print "WARNING ($sysname): Root has a /.rhosts file." >> \
1434 /tmp/sysinfo.$$.errwarn
1435 print "This file allows users from other systems to logon as root w/o a password." >> /tmp/sysinfo.$$.errwarn
1436 print " " >> /tmp/sysinfo.$$.errwarn
1438 llinfo=$(ll -d /.rhosts)
1440 echo "$llinfo" | cut -c5-10 | egrep -q "r|w|x"
1443 print "WARNING ($sysname): The /.rhosts file has Group or World access." \
1444 >> /tmp/sysinfo.$$.errwarn
1445 print "If this existence if this file is required then ONLY root should have access." >> /tmp/sysinfo.$$.errwarn
1446 print " " >> /tmp/sysinfo.$$.errwarn
1449 echo "$llinfo" >> /tmp/sysinfo.$$.sysaccess.warn
1450 print "" >> /tmp/sysinfo.$$.sysaccess.warn
1451 print "Contents of /.rhosts file:" >> /tmp/sysinfo.$$.sysaccess.warn
1452 cat /.rhosts >> /tmp/sysinfo.$$.sysaccess.warn
1455 # Now check the system for modem definitions. This first pass will not include
1456 # uucp items. I'm checking for ttyd* files in the /dev directory, then I'll
1457 # campare any matches to the /etc/inittab file. This will allow me to
1458 # look for getty processes.
1460 print " " >> /tmp/sysinfo.$$.sysaccess.info
1461 print "Dialin/Modem Definitions:" >> /tmp/sysinfo.$$.sysaccess.info
1462 print " " >> /tmp/sysinfo.$$.sysaccess.info
1464 MLIST=$(ls /dev/ttyd* 2>&1)
1466 Debug " chk_SysAccess. MLIST = $MLIST"
1467 for modtty in $MLIST
1469 modttyb=$(basename $modtty)
1470 Debug " chk_SysAccess. Checking = $modtty"
1472 # Check the /etc/inittab file for the terminal entry. Exclude lines which
1473 # begin with a '#'. Include lines which contain 'getty'
1475 gettyinfo=$( grep -v '^#' /etc/inittab | grep 'getty' | grep -i $modttyb )
1476 gettystate=$( echo $gettyinfo | awk -F: '{print $3}' )
1478 Debug " chk_SysAccess. Getty Info/State = $gettyinfo $gettystate"
1481 Debug " chkSysAccess. Respawn in getty"
1482 ps -ef | grep getty | grep -q $modttyb
1485 Debug "Found Getty for $modttyb"
1486 print "Modem: $modttyb (waiting for a connection)" >> \
1487 /tmp/sysinfo.$$.sysaccess.info
1489 Debug "No Getty Found for $modttyb"
1490 if ps -t $modttyb | tail +2 | wc -l
1492 Debug "No Processes Found for $modttyb"
1493 print "Modem: $modttyb (getty missing?)" >> \
1494 /tmp/sysinfo.$$.sysaccess.info
1495 print "WARNING ($sysname): $modttyb does not have a getty or a login process" >> /tmp/sysinfo.$$.errwarn
1497 Debug "Modem in Use"
1498 print "Modem: $modttyb (currently in use)" >> \
1499 /tmp/sysinfo.$$.sysaccess.info
1503 echo $gettyinfo | awk -F: '{printf("Inittab Info: %s\n",$4)}' >> \
1504 /tmp/sysinfo.$$.sysaccess.info
1505 print " " >> /tmp/sysinfo.$$.sysaccess.info
1506 print "Five most recent Logons for $modttyb" >> \
1507 /tmp/sysinfo.$$.sysaccess.info
1508 #last -R > /tmp/sysinfo.$$.last
1509 grep -i $modttyb /tmp/sysinfo.$$.last | tail -5 >> /tmp/sysinfo.$$.sysaccess.info
1510 print " " >> /tmp/sysinfo.$$.sysaccess.info
1514 print "Modem: $modttyb (disabled in /etc/inittab)" >> \
1515 /tmp/sysinfo.$$.sysaccess.info
1524 print " " >> /tmp/sysinfo.$$.sysaccess.info
1526 f_display_file /tmp/sysinfo.$$.sysaccess.info
1527 f_display_file /tmp/sysinfo.$$.sysaccess.warn
1533 ###############################################################################
1534 # Function: chk_logfiles()
1535 # Description: Routine used to check the system logfiles. We want to make sure
1536 # that the logfiles exist, and are not greater than 2 Mbytes.
1541 Debug " Starting Chk_Logfiles. OSMAJOR = $osmajor"
1545 FLIST="$LOGFILELISTV9"
1549 FLIST="$LOGFILELISTV10"
1553 Debug " chk_logfiles. FLIST=$FLIST"
1556 print "</PRE>" >> /tmp/sysinfo.$$.logfile.info
1557 print "<A NAME='LOGFILES'></A>" >> /tmp/sysinfo.$$.logfile.info
1558 print "<H2>" >> /tmp/sysinfo.$$.logfile.info
1559 print "<P ALIGN=RIGHT><A HREF='#Top'>" >> /tmp/sysinfo.$$.logfile.info
1560 print "TOP</A></P>" >> /tmp/sysinfo.$$.logfile.info
1561 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.logfile.info
1562 print "System Logfile Information</H2>" >> /tmp/sysinfo.$$.logfile.info
1563 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.logfile.info
1565 print "SYSTEM LOGFILE INFORMATION" >> /tmp/sysinfo.$$.logfile.info
1566 print "==========================" >> /tmp/sysinfo.$$.logfile.info
1568 print -n "checking system logfiles"
1569 print "" >> /tmp/sysinfo.$$.logfile.info
1570 print "Checking System Logfiles. Validating file sizes and Permissions." >> \
1571 /tmp/sysinfo.$$.logfile.info
1575 Debug " chk_logfiles. Checking $lfile."
1576 if [[ ! -a "$lfile" ]]
1578 print "ERROR ($sysname): Logfile $lfile does not exist." >> \
1579 /tmp/sysinfo.$$.errwarn
1583 # Get the logfile's directory information. Then check its size.
1585 llinfo=$(ll -d $lfile)
1587 psize=$( echo $llinfo | awk '{print $5}' )
1588 if (( $psize >= 2097152 ))
1590 print "WARNING ($sysname): Logfile $lfile is greater than 2 Mbytes." \
1591 >> /tmp/sysinfo.$$.errwarn
1595 # Now check the file's permissions
1597 echo "$llinfo" | cut -c5-10 | egrep -q "w"
1600 print "WARNING ($sysname): Logfile $lfile has Group or World WRITE access. " >> /tmp/sysinfo.$$.errwarn
1603 echo "$llinfo" >> /tmp/sysinfo.$$.logfile.info
1607 print " " >> /tmp/sysinfo.$$.logfile.info
1609 # Now check the system's crash directory for crash files. If these files exist
1610 # there could be space problems later.
1614 if [[ -a "/etc/rc.config.d/savecrash" ]]
1616 . /etc/rc.config.d/savecrash
1617 if [ ! -z "$CRASHDIR" ]
1621 LOGCRASH="/var/adm/crash"
1624 LOGCRASH="/var/adm/crash"
1627 CRASHFILES=$(ll $LOGCRASH | tail +2)
1628 if [ -z "$CRASHFILES" ]
1630 print "There are NO Crash Dumps in $LOGCRASH." >> \
1631 /tmp/sysinfo.$$.logfile.info
1633 print " " >> /tmp/sysinfo.$$.logfile.warn
1634 print "WARNING ($sysname): There are files in the Crash Dump directory $LOGCRASH." >> /tmp/sysinfo.$$.errwarn
1635 echo "$CRASHFILES" >> /tmp/sysinfo.$$.errwarn
1643 # Now output the contents of the DMESG command. This can provide useful
1644 # info regarding recent events on the system.
1646 print " " >> /tmp/sysinfo.$$.logfile.info
1647 print "Ouput of System DMESG Info:" >> /tmp/sysinfo.$$.logfile.info
1648 print "___________________________" >> /tmp/sysinfo.$$.logfile.info
1650 dmesg >> /tmp/sysinfo.$$.logfile.info 2>&1
1652 print " " >> /tmp/sysinfo.$$.logfile.info
1653 print "End of DMESG Output" >> /tmp/sysinfo.$$.logfile.info
1654 print "___________________________" >> /tmp/sysinfo.$$.logfile.info
1655 print " " >> /tmp/sysinfo.$$.logfile.info
1657 # Now check the Sendmail Queue for a large number of entries, or entries
1658 # which are older than two days. Finding entries in the queue could represent
1661 print " " >> /tmp/sysinfo.$$.logfile.info
1662 print "Checking Sendmail Queue: \c" >> /tmp/sysinfo.$$.logfile.info
1664 # Before changing to the Sendmail Queue directory, save our current directory
1665 # value so we can change back to it when we're finished.
1670 mailqdir=/usr/spool/mqueue
1675 mailqdir=/var/spool/mqueue
1680 # Go to the Sendmail Queue directory and scan it for entries. Iff some are
1681 # found then check to see if any are older than 2 days.
1684 llinfo=$(ll 2>&1 | tail +2)
1686 if [[ -z "$llinfo" ]]
1688 print "Sendmail Queue is Empty." >> /tmp/sysinfo.$$.logfile.info
1690 print "Sendmail Queue has $(ls | wc -w | awk '{print $1}') entries." >> \
1691 /tmp/sysinfo.$$.logfile.info
1692 ll 2>&1 | tail +2 >> /tmp/sysinfo.$$.logfile.info
1694 # Use the find command to list entries older than 2 days
1696 findinfo=$(find . -mtime +2 -exec ll -d {} \;)
1697 if [[ ! -z "$findinfo" ]]
1699 print " " >> /tmp/sysinfo.$$.logfile.warn
1700 print "Sendmail Queue has Entries Older than 2 days." >> \
1701 /tmp/sysinfo.$$.logfile.warn
1702 find . -mtime +2 -exec ll -d {} \; >> /tmp/sysinfo.$$.logfile.warn
1703 print " " >> /tmp/sysinfo.$$.logfile.warn
1707 # Now change to the Sendmail Post Office directory. This is the directory
1708 # where mail is normally stored on the system. Check for entries which are
1709 # large and very old.
1712 print " " >> /tmp/sysinfo.$$.logfile.info
1713 print "Checking the Mail Post Office Directory: \c" >> \
1714 /tmp/sysinfo.$$.logfile.info
1717 if [[ -z "$llinfo" ]]
1719 print "No Entries Found." >> /tmp/sysinfo.$$.logfile.info
1721 print "Found $(echo $llinfo | wc -w) Entries." >> \
1722 /tmp/sysinfo.$$.logfile.info
1723 ll 2>&1 >> /tmp/sysinfo.$$.logfile.info
1725 # Now that we have found entries in the directory, check to see if they are
1726 # larger than 2 Mbytes.
1728 find . -size +4096 -exec ll -d {} \; > /tmp/sysinfo.$$.logfile.tmp 2>&1
1729 if [[ -s "/tmp/sysinfo.$$.logfile.tmp" ]]
1731 print " " >> /tmp/sysinfo.$$.logfile.warn
1732 print "WARNING ($sysname): Post Office Directory has Files Larger than 2 Mbytes." >> /tmp/sysinfo.$$.errwarn
1733 cat /tmp/sysinfo.$$.logfile.tmp >> /tmp/sysinfo.$$.errwarn
1734 print " " >> /tmp/sysinfo.$$.errwarn
1737 # Now check for entries which have not been access in 90 days. These files
1738 # may be considered obsolete.
1740 find . -mtime +90 -exec ll -d {} \; > /tmp/sysinfo.$$.logfile.tmp 2>&1
1741 if [[ -s "/tmp/sysinfo.$$.logfile.tmp" ]]
1743 print " " >> /tmp/sysinfo.$$.logfile.warn
1744 print "WARNING ($sysname): Post Office Directory has Files Older than 90 days." >> /tmp/sysinfo.$$.errwarn
1745 cat /tmp/sysinfo.$$.logfile.tmp >> /tmp/sysinfo.$$.errwarn
1746 print " " >> /tmp/sysinfo.$$.errwarn
1750 # Change back to our original directory
1754 print " " >> /tmp/sysinfo.$$.logfile.info
1757 f_display_file /tmp/sysinfo.$$.logfile.info
1758 f_display_file /tmp/sysinfo.$$.logfile.warn
1765 ################################################################################
1766 # Function: LookupName()
1767 # Description: Lookup the full name for a specified hostname. Uses nslookup.
1768 # Arguments: <hostname, domainname or address>
1769 # Output: fully qualified hostname
1770 # Returns: 0: successfully determined name
1771 # 1: unable to find name (using /etc/hosts)
1772 # 2: unable to find name (using name server)
1778 # Panic "${0}: expect <hostname|address> argument"
1781 #nslookup "$1" > $_TMP 2>&1
1782 # Return 0 if name found, 1 if not found and using /etc/hosts,
1783 # 2 if not found and using some sort of name server.
1785 nslookup "$1" 2>&1 |
1788 $0 ~ "/etc/hosts" { ret_val=1 }
1789 $1 == "Name:" { print $2; ret_val=0 }
1790 END { exit (ret_val) }
1793 case $return_value in
1794 0) return_string="found using nslookup";;
1795 1) return_string="found in /etc/hosts/";;
1796 2) return_string="not found";;
1798 Debug " return from LookupName = $return_value ($return_string)"
1799 return $return_value
1803 ################################################################################
1807 ### Changed 6/16/99 J.Semroc - allows for possibility of multiple nameservers,
1808 ### domain search directive, and possibility that
1809 ### no domain is specified
1810 ### <ST> 07/12/99 - added -s option to cut in case nslookup does not return
1811 ### fully qualified name.
1812 ### added ^ to nameserver to ignore commented entries
1814 if [ -f $RESOLV_CONF ]
1816 CURRENT_DOMAIN=$(nslookup ${sysname} | grep "^Name: " | \
1817 awk -F: '{print $2}'| cut -s -d. -f2- )
1818 if [[ -z ${CURRENT_DOMAIN} ]]
1820 Debug "Could not find domain using nslookup - checking resolv.conf"
1821 # Extract the domain from resolv.conf
1823 $1 == "domain" { DOMAIN=$2 }
1824 $1 == "nameserver" { ADDRESS=$2 ; exit }
1825 END { printf "%s %s\n", DOMAIN, ADDRESS }' $RESOLV_CONF)
1828 Debug "Found domain using nslookup"
1831 ### Extract the address and name of nameserver from resolv.conf
1834 ### # See if we can get a name for the nameserver
1835 ### CURRENT_DOMAIN="$1"
1836 ### CURRENT_DNS_SERVER_IP="$2"
1837 ### CURRENT_DNS_SERVER=$(LookupName $CURRENT_DNS_SERVER_IP)
1838 ### if [ -z "$CURRENT_DNS_SERVER" ]
1840 ### CURRENT_DNS_SERVER=unknown
1843 ### unset CURRENT_DOMAIN CURRENT_DNS_SERVER_IP CURRENT_DNS_SERVER
1846 CURRENT_DNS_SERVER_IP=$(for server in `grep ^nameserver \
1847 ${RESOLV_CONF} | awk '{print $2}'`
1850 done | awk '{ print $1}')
1851 CURRENT_DNS_SERVER=$(LookupName `echo ${CURRENT_DNS_SERVER_IP} \
1852 | awk '{ print $1}' `)
1857 #===================================================================
1860 # Scan the output from ioscan and filter out all SCSI "target"
1861 # lines. Also filter out entries with a low_level driver of "root"
1862 #===================================================================
1868 low_level_driver = $10
1869 if (class != "target" && low_level_driver != "root")
1875 #==================================================================
1876 # This routine invokes ioscan with any passed in arguments and
1877 # generates the above mentioned colon separated output. Note that
1878 # all lines begin and end with colons. This makes for easy parsing
1879 # of the output to match specific fields via grep.
1880 #===================================================================
1885 #=====================================================================
1886 # Not all of the fields of ioscan output are used by SAM.
1887 # They are all listed here for documentation purposes.
1888 #=====================================================================
1894 # block_major_number = $6
1895 # character_major_number = $7
1898 # low_level_driver = $10
1900 identify_bytes = $12
1901 # device instance = $13
1905 # hardware_type = $17
1908 num_hw = split(full_hw, hw_path, ".");
1911 #============================================================
1913 # Identifying bytes for PA Modules contain this information:
1916 # Address Name Description
1917 # --------- --------------- --------------------------------------
1918 # 0-1 IODC_HVERSION Hardware version number
1919 # 2 IODC_SPA Soft physical address capability
1920 # 3 IODC_TYPE Type of module
1921 # 4-7 IODC_SVERSION Software version number
1922 # 8 IODC_REV IODC revision
1923 # 9 IODV_DEP HVERSION dependent
1925 # 12-13 IODC_CHECK Checksum
1926 # 14-15 IODC_LENGTH Length of entry point table
1928 #============================================================
1930 split(identify_bytes, id_flds, " ");
1931 hversion= (((((id_flds[1]*256)+id_flds[2])*256)+id_flds[3])*256)+id_flds[4];
1932 sversion= (((((id_flds[5]*256)+id_flds[6])*256)+id_flds[7])*256)+id_flds[8];
1933 if ( id_flds[9] != "" ) {
1934 device_id = id_flds[9] " " id_flds[10] " " id_flds[11] " " id_flds[12] " " id_flds[13] " " id_flds[14] " " id_flds[15] " " id_flds[16];
1940 # Specifically for multi path environments (FiberChannel),
1941 # save the driver and last 8 bytes of the identify_bytes
1942 # of this device ("ext_bus" class; parent of actual devices)
1943 # tacking on to actual devices later.
1945 if ( class == "ext_bus") {
1946 if ( ( identify_bytes != "") && (( driver == "fcpmux") || ( driver == "fcpdev"))) {
1947 parent_driver = driver;
1948 parent_id = device_id;
1957 # Set driver to "?" if not known
1959 if ((substr(driver, 1, 1) == "?") || (driver == "pdn0") ||
1963 # SPECIAL CASES FOR NON-AUTOCONFIGURABLE DEVICES
1964 # Check the hardware identifier field, if it matches
1965 # a non-autoconfigurable device and there is no driver
1966 # bound to the device, fill in the driver field with the
1967 # appropriate driver name flag to true
1970 # Change this to use the device description.
1972 if (ident == "0x2080") {
1976 # Change this to use the device description.
1978 else if (ident == "0x2f80") {
1982 else if ((substr(driver, 1, 1) == "?") || (driver == "")) {
1990 if (sw_status != "CLAIMED")
1993 if ((driver == "tape1") || (driver == "tape2") ||
1994 (driver == "lpr0") || (driver == "lpr1") ||
1995 (driver == "disc3") || (driver == "sflop") ||
1996 (driver == "schgr") || (driver == "autox0") ||
1997 (driver == "cs80") || (driver == "sdisk") ||
1998 (driver == "stape") || (driver == "disc4")) {
1999 address = hw_path[num_hw-1];
2000 unit = hw_path[num_hw];
2002 else if ((driver == "disc1") || (driver == "disc2") ||
2003 (driver == "instr0")|| (driver == "pflop")) {
2004 address = hw_path[num_hw];
2008 # printf(":%s:%s:%s:%s:%s:%s:%d:%s:0x%x;0x%x:%s:%s:%s:%s:\n",
2009 # cdio, driver, instance, full_hw, address, unit,
2010 # not_configured, sw_status, sversion, hversion, ident,
2011 # device_id, parent_driver, parent_id );
2012 printf("%22s %12s %s\n", full_hw, driver, ident );
2014 } # end of formatter
2016 #===========================================================
2018 #===========================================================
2021 # first get all volume groups, logical volumes & physical volumes
2022 vgdisplay -v 2>&1 | \
2024 BEGIN { vgprinted = ""; onpvg = ""; numpvgs = 0
2027 vg = substr($3, 6, length($3) - 5);
2028 vgprinted = ""; onpvg = ""; numpvgs = 0;
2029 freepe_count = 0; next;
2038 vgstatus = vgstatus $i;
2039 vgstatus = vgstatus "," vgwrite "@";
2043 vgstatus = vgstatus $1;
2047 vgstatus = vgstatus ",";
2048 vgstatus = vgstatus $1;
2051 /Max LV/ { maxlv = $3; next; }
2052 /Max PV/ { maxpv = $3; next; }
2053 /Cur LV/ { numlvs = $3; next; }
2054 /Cur PV/ { numpvs = $3; next; }
2055 /PE Size/ { pesize = $4; next; }
2056 /Max PE per PV/ { maxpe = $5; next; }
2057 /Total PVG/ { numpvgs = $3; next; }
2059 if (vgprinted == "")
2061 printf("VG:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s::::::\n",
2062 vg, vgstatus, maxlv, maxpv, numlvs,
2063 numpvs, numpvgs, pesize, maxpe,
2064 totalpe * pesize, freepe * pesize);
2067 printf("LV:%s:::::::%s::::%s:::::\n",
2074 if (vgprinted == "")
2076 printf("VG:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s::::::\n",
2077 vg, vgstatus, maxlv, maxpv, numlvs,
2078 numpvs, numpvgs, pesize, maxpe,
2079 totalpe * pesize, freepe * pesize);
2082 printf("ALT:%s::::::::::::%s:%s:::\n", vg, pv, $3);
2090 if (vgprinted == "")
2092 printf("VG:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s:%s::::::\n",
2093 vg, vgstatus, maxlv, maxpv, numlvs,
2094 numpvs, numpvgs, pesize, maxpe,
2095 totalpe * pesize, freepe * pesize);
2101 printf("PV:%s::::::::::::%s::::%s\n",vg, pv, pvg);
2108 if (freepe_count > 0)
2110 printf("PV:%s::::::::::::%s::%s:%s:\n",
2111 vg, pv, totalpe, freepe);
2117 ' >> /tmp/sysinfo.vg.tmp
2118 mv /tmp/sysinfo.vg.tmp $vg_list_file
2120 # now get list of all logical volumes
2122 awk ' BEGIN { FS = ":" }
2123 { type = $1; vgstatus = $2; pesize = $8;
2129 ' $vg_list_file >> /tmp/sysinfo.lvol.list.tmp
2130 sort /tmp/sysinfo.lvol.list.tmp > $lvol_list_file
2131 rm -f /tmp/sysinfo.lvol.list.tmp
2133 # now get details on each logical volume
2135 lvol_list=$(cat $lvol_list_file)
2136 for lvol in $lvol_list
2139 lvdisplay $lvol 2>&1 | \
2148 /LV Name/ { lvname= $3; next }
2149 /LV Permission/ { perm = $3; next }
2150 /Mirror copies/ { nummir = $3; next }
2151 /Consistency Recovery/ { mwc = $3; next }
2152 /Schedule/ { sched = $2; next }
2153 /LV Size/ { size = $4; next }
2154 /Current LE/ { les = $3; next }
2155 /Bad block/ { if ($3 == "on") bbr = 1; badblock = $3;
2156 if (badblock == "NONE")
2159 /Allocation/ { alloc=$2;
2160 if (alloc == "non-strict")
2162 if (alloc == "non-strict/contiguous")
2164 if (alloc == "strict")
2166 if (alloc == "strict/contiguous")
2168 if (alloc == "PVG-strict")
2170 if (alloc == "PVG-strict/contiguous")
2172 if (alloc == "PVG-strict/distributed")
2174 if (alloc == "PVG-strict/partially-distributed")
2178 /LV Status/ { state = $3;
2179 if (state == "available/stale")
2181 if (state == "available/syncd")
2183 if (state == "available")
2185 if (state == "unavailable")
2188 /Stripes/ { numstripes = $2; next }
2189 /Stripe Size/ { stripesize = $4; next }
2199 pesize = size / les;
2202 printf("%-32s %5s %3s %4s %4s %6s %6s %-5s %-5s\n",
2203 lvname, size, numstripes,
2204 stripesize, nummir, mwc, state, badblock,alloc)
2206 ' >> /tmp/sysinfo.lvol.data.tmp
2208 mv /tmp/sysinfo.lvol.data.tmp $lvol_out_file
2209 rm -f /tmp/sysinfo.lvol.data.tmp
2211 # now get list of all physical volumes
2213 awk ' BEGIN { FS = ":" }
2214 { type = $1; vgstatus = $2; pesize = $8;
2220 ' $vg_list_file >> /tmp/sysinfo.pvol.list.tmp
2221 sort /tmp/sysinfo.pvol.list.tmp > $pvol_list_file
2222 rm -f /tmp/sysinfo.pvol.list.tmp
2224 # now get details on each physical volume
2226 pvol_list=$(cat $pvol_list_file)
2227 for pvol in $pvol_list
2229 pvdisplay -v $pvol 2>&1 | \
2233 /PE Size/ {pesize = $4; next}
2234 /LV Name/ {found=1; next}
2235 /Physical extents/ {exit 0}
2238 # Print "LV_Name Logical_MB_of_LV Physical_MB_of_LV"
2241 if (found && NF == 3)
2242 printf("%s:%d:%d\n", $1, $2 * pesize, $3 * pesize)
2244 ' - >> $pvol_out_file
2249 #===========================================================
2250 function launch_lvm_scan
2251 #===========================================================
2253 Debug "Building $lvm_scan_command_file"
2255 rm -f $lvm_scan_done
2257 Debug "$vg_out_file, $vg_list_file, $lvol_out_file"
2258 Debug "$lvol_list_file, $pvol_list_file $pvol_out_file"
2259 Debug "$lvm_scan_done"
2261 cat <<==end_of_command== > $lvm_scan_command_file
2263 # now call the lvm_scan function (exported from parent)
2265 date > \$lvm_scan_done
2269 chmod +x $lvm_scan_command_file
2270 Debug " launching $lvm_scan_command_file"
2271 $lvm_scan_command_file &
2272 Debug " parent PID = $$, child PID = $!"
2274 } # end of launch_lvm_scan
2276 #===========================================================
2277 # launch_kernel_scan
2278 #===========================================================
2279 function launch_kernel_scan
2281 Debug " Starting launch_kernel_scan.....building $kernel_scan_command_file"
2283 # change filenames to send output to parent's PID
2284 rm -f $kernel_scan_done
2286 Debug "$kernel_kinfo $kernel_out_file"
2287 Debug "$kernel_scan_done"
2289 cat <<==end_of_command== > $kernel_scan_command_file
2291 # now call the sam_scan function (exported from parent)
2293 date > \$kernel_scan_done
2297 chmod +x $kernel_scan_command_file
2298 Debug " launching $kernel_scan_command_file"
2299 $kernel_scan_command_file &
2300 Debug " parent PID = $$, child PID = $!"
2303 } # end of launch_kernel_scan
2305 #===========================================================
2307 #===========================================================
2308 function launch_io_scan
2310 Debug " Starting launch_io_scan.....building $io_scan_command_file"
2312 # change filenames to send output to parent's PID
2315 Debug "$io_scan_done"
2317 if (( ${osmajor} >= 10 ))
2319 cat <<==end_of_command== > $io_scan_command_file
2321 # now call the io_scan function (exported from parent)
2323 date > \$io_scan_done
2326 chmod +x $io_scan_command_file
2327 Debug " launching $io_scan_command_file"
2328 $io_scan_command_file &
2329 Debug " parent PID = $$, child PID = $!"
2331 Debug " on 9.x - executing ioscan"
2332 print "H/W Path LU Driver" >> ${io_scan_out}
2333 print -- "-----------------------------" >> ${io_scan_out}
2334 ioscan -f | tail +3 | \
2335 awk '{printf ("%-14s %-6s %-20s\n", $3, $2, $4)}' \
2337 date > $io_scan_done
2340 } # end of launch_io_scan
2344 #===========================================================
2345 # check_if_scan_done
2346 #===========================================================
2347 function check_if_scan_done
2350 done_file=/tmp/sysinfo.$$.${scan_type}_done
2351 Debug " starting check_if_scan_done for ${scan_type}."
2352 Debug " looking for /tmp/sysinfo.$$.${scan_type}_done"
2355 print -n "retrieving ${scan_type} data "
2357 if [ ! -f ${done_file} ] # enter time out loop
2359 Debug " ${scan_type}_done file not ready, entering loop."
2361 for fil in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
2363 ### Changed 6/15/99 J.Semroc - allow more time for large systems
2367 Debug " in loop $fil"
2372 if [ -f ${done_file} ]
2374 Debug " ${scan_type} done."
2379 if [ "$FORCE" = "TRUE" ]
2381 Debug " still no file, forcing an interactive ${scan_type}."
2385 Debug " found ${scan_type}_done file"
2393 #===========================================================
2396 # this routine runs ioscan with the appropriate parameters and
2397 # places the output in /var/sam/<sysname>.iout It also
2398 # provides a semaphore for other asyncronous processes, by removing
2399 # and then creating /var/sam/<sysname>.dion
2401 #===========================================================
2410 # block_major_number = $6
2411 # character_major_number = $7
2414 # low_level_driver = $10
2416 # identify_bytes = $12
2417 # device instance = $13
2421 # hardware_type = $17
2426 # If an inadaquate description is given from ioscan. Initiate a diskinfo
2427 # request to force an open operation and then perform another ioscan for
2428 # that device. If the diskinfo operation results in an error containing
2429 # "Permission Denied" the device may be a tape drive needing a slightly
2430 # different device file. At the time of this modification to this script
2431 # (7/5/94) an HPFL Disc will only give a useful description when there is
2432 # a mounted file system on the disk.
2434 # Change the Internal Field Separator to ":". All output fields of
2435 # ioscan -F are separated by a ":".
2440 ioscan $ioscan_args > $io_scan_tmp
2441 mv $io_scan_out $io_scan_out.old > /dev/null 2>&1
2444 cat $io_scan_tmp | \
2445 while read p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19
2447 if [ "$p18" = "HP-IB Device" -o "$p18" = "HP-IB Tape" -o \
2448 "$p18" = "SCSI Tape" -o "$p18" = "HPFL Disc" ]
2450 mksf -r -H $p11 /var/sam/sam_tmp >/dev/null 2>&1
2451 diskinfo /var/sam/sam_tmp >/dev/null 2>/var/sam/sam_err
2452 if ( grep Permission /var/sam/sam_err >/dev/null 2>&1 )
2454 mksf -r -c -u 0 -H $p11 /var/sam/sam_tmp >/dev/null 2>&1
2455 diskinfo /var/sam/sam_tmp >/dev/null 2>&1
2457 ioscan -H $p11 -F >>$io_scan_out 2>/dev/null
2458 rm -f /var/sam/sam_tmp /var/sam/sam_err
2460 echo "$p1:$p2:$p3:$p4:$p5:$p6:$p7:$p8:$p9:$p10:$p11:$p12:$p13:$p14:$p15:$p16:$p17:$p18:$p19" >>$io_scan_out
2464 date > $io_scan_done
2469 #==================================================================
2471 #==================================================================
2474 Debug "Beginning SW_SCAN"
2475 if [[ -f /usr/sbin/swlist ]]
2477 Debug " found swlist"
2480 print "</PRE>" >> /tmp/sysinfo.$$.swout
2481 print "<A name='Software'></A>" >> /tmp/sysinfo.$$.swout
2482 print "<H2>" >> /tmp/sysinfo.$$.swout
2483 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.swout
2484 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.swout
2485 print "Software Data</FONT></H2>" >> /tmp/sysinfo.$$.swout
2486 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.swout
2488 print "" >> /tmp/sysinfo.$$.swout
2489 print "SOFTWARE DATA" >> /tmp/sysinfo.$$.swout
2490 print "=============" >> /tmp/sysinfo.$$.swout
2494 print "collecting software data "
2496 print "Product Version Description" >> /tmp/sysinfo.$$.swout
2497 print -- "--------------------------------------------------" >> /tmp/sysinfo.$$.swout
2498 swlist -l product | grep -v "^#" | expand >> /tmp/sysinfo.$$.swout
2499 f_display_file /tmp/sysinfo.$$.swout
2500 #check for non-configured software
2501 print "checking for incompletely installed software "
2502 swlist -l fileset -a state | grep -e transient -e corrupt \
2503 -e available -e installed | expand >> /tmp/sysinfo.$$.sw_not_conf
2504 if [[ -s /tmp/sysinfo.$$.sw_not_conf ]]
2506 print "" >> /tmp/sysinfo.$$.sw_not_header
2507 print "Found incompletely installed filesets" >> \
2508 /tmp/sysinfo.$$.sw_not_header
2509 print "=====================================" >> \
2510 /tmp/sysinfo.$$.sw_not_header
2511 print "WARNING (${sysname}): Found incompletely installed software." >> \
2512 /tmp/sysinfo.$$.errwarn
2513 f_display_file /tmp/sysinfo.$$.sw_not_header
2514 f_display_file /tmp/sysinfo.$$.sw_not_conf
2517 Debug " could not find swlist."
2521 #==================================================================
2523 # This function retrieves the os version information and
2524 # series type. It then sets the kernel pointers.
2525 #===================================================================
2526 function f_build_sched_file
2528 Debug "Beginning build_sched_file"
2529 cat <<==end_of_file== > ${where}/sched.models
2743 chmod 444 ${where}/sched.models
2746 #==================================================================
2748 # This function retrieves the os version information and
2749 # series type. It then sets the kernel pointers.
2750 #===================================================================
2751 function f_get_sys_type
2753 Debug "Beginning GET SYSTEM TYPE"
2754 osletter=$(uname -r | awk -F. '{print $1}')
2755 osmajor=$(uname -r | awk -F. '{print $2}')
2756 osminor=$(uname -r | awk -F. '{print $3}')
2757 system=$(uname -m | awk -F/ '{print $1}')
2758 series=$(uname -m | awk -F/ '{print $2}')
2759 machine_id=$(uname -i)
2762 Debug " system = $system"
2763 Debug " series = $series"
2764 Debug " OS = $osletter.$osmajor.$osminor"
2765 Debug " machine = $machine_id"
2766 Debug " license = $license"
2767 if (( `echo $series | cut -b1` == 7 )) && (( $osmajor <= 9 ))
2769 print "\nSorry. Not supported on Series 700 running HP-UX 9.x\n"
2772 if [[ ! -z $(whence model) ]]
2775 Debug " model returned $series"
2776 sched_file=${where}/sched.models
2780 if [[ -f ${sched_file} ]]
2782 check_pa=$(model | awk -F/ '{print $NF}')
2783 pa_ver=$(grep "${check_pa} " $sched_file | awk '{print $2}')
2784 pa_chip=$(grep "${check_pa} " $sched_file | awk '{print $3}')
2790 Debug " model not found, using inline series check"
2792 780) series="780/C160";;
2793 801) series="801/DX0";;
2794 811) series="811/DX5";;
2795 806) series="806/E25";;
2796 807) series="807/F10";;
2797 809) series="809/K100";;
2798 816) series="816/E35";;
2799 817) series="817/F20";;
2800 819) series="819/K200";;
2801 821) series="821/D200/D400";;
2802 826) series="826/E45";;
2803 827) series="827/H20";;
2804 829) series="829/K400";;
2805 831) series="831/D200/D400";;
2806 837) series="837/F30";;
2807 839) series="839/K210";;
2808 841) series="841/D210/D410";;
2809 847) series="847/G30/H30";;
2810 851) series="851/D210/D410";;
2811 849) series="849/K410";;
2812 856) series="856/E55";;
2813 857) series="857/I30";;
2814 859) series="859/K220";;
2815 867) series="867/G40/H40";;
2816 869) series="869/K420";;
2817 877) series="877/I40";;
2818 887) series="887/G50/H50/G60/H60/G70/H70";;
2820 891) series="891/T500";;
2821 892) series="892/T520";;
2822 897) series="897/I50/I60/I70";;
2824 Debug "Series type not found for $series" ;;
2827 if [ $osmajor -lt 10 ]
2831 kernel=/stand/vmunix
2833 Debug " kernel=${kernel}"
2834 if [[ -f /etc/lvmtab ]]
2837 Debug " LVM Detected."
2840 Debug " LVM NOT Detected."
2842 # set PATH variable to ensure access to required commands
2855 Debug " PATH = $PATH"
2856 if [ -f ${where}/system_db ]
2858 conf_file=${where}/system_db
2859 elif [ -f /usr/local/bin/system_db ]
2861 conf_file=/usr/local/bin/system_db
2863 if [[ -n ${conf_file} ]]
2865 Debug " Found config file = $conf_file"
2866 serial_number=$(grep $sysname $conf_file | awk -F: '{print $4}')
2867 Debug " serial number = ${serial_number}"
2869 swap_devs=$(swapinfo -d | grep -v "Kb" |grep -v "TYPE" \
2870 | awk '{printf "%s ", $NF}')
2871 # if (($FULL_KERNEL)) || (( ${LITE_KERNEL} ))
2873 # if (( ${osmajor} >= 10 ))
2874 # rm -f $kernel_scan_done
2875 # launch_kernel_scan
2876 # Debug "Calling kernel_scan"
2879 # print "launching background kernel scan"
2883 if (($IOSCAN)) || (($PHYSICAL))
2886 launch_io_scan $ioscan_args
2887 Debug "Calling io_scan"
2890 print "launching background ioscan"
2895 rm -f $lvm_scan_done
2897 Debug "Calling launch_lvm_scan"
2900 print "launching background lvm scan"
2903 } # end of f_get_sys_type
2905 #===================================================================
2907 #===================================================================
2911 print -n "Checking digmond...."
2913 diagmond_result=$(ps -ef | grep -v grep | grep diagmond > /dev/null 2>&1)
2915 if (($diagmond_result != 0))
2918 Debug "Error: diagmond is not running."
2919 Debug "diagmond_result = $diagmond_result"
2920 print "diagmond is NOT running!"
2921 print "No cstm info is available."
2924 print "diagmond is running."
2927 print -n "Checking cstm......."
2928 cstm_version=$(echo "Version" | /usr/sbin/cstm | grep Version \
2929 | tail -1 | awk '{print $2}' )
2930 cstm_major=$(echo ${cstm_version} | awk -F. '{print $2}')
2932 echo "Version" | /usr/sbin/cstm >/dev/null 2>&1
2934 if (($cstm_result != 0))
2937 Debug "Error returned from cstm"
2938 print "Error returned from cstm"
2939 print "cstm_result = $cstm_result"
2942 if (($cstm_ok == 0))
2944 cstm_version=$(echo "Version" | /usr/sbin/cstm | grep Version \
2945 | tail -1 | awk '{print $2}' )
2946 cstm_major=$(echo ${cstm_version} | awk -F. '{print $2}')
2947 print "found version ${cstm_version}"
2948 ### Changed 6/30/99 J.Semroc also works with V14
2949 ### if (($cstm_major >= 08)) && (($cstm_major <= 13))
2951 ### if (($cstm_major >= 08)) && (($cstm_major <= 16))
2952 ### Removed upper end version check on cstm <st>
2953 if (($cstm_major >= 08))
2956 print "Running cstm....please wait."
2958 if (($cstm_major == 12))
2960 cat <<==end_of_command== > ${cstm_command_file}
2963 # The following connects the UI to the system the UI is being run on,
2964 # and selects this system.
2965 # SelCurrentSys system add localhost system 1
2966 # Use current user name
2967 # No password required on local system.
2968 # don't prompt for overwrite
2972 SelClass type processor qualifier cpu
2973 #collect the information and wait for it to finish
2975 #now display the info log
2976 #version 12 has SaveAs & Print Commands reversed.
2983 SelClass type memory
3003 cat <<==end_of_command== > ${cstm_command_file}
3006 # The following connects the UI to the system the UI is being run on,
3007 # and selects this system.
3008 #SelCurrentSys system add localhost system 1
3009 # Use current user name
3010 # No password required on local system.
3011 #don't prompt for overwrite
3015 SelClass type processor qualifier cpu
3016 #collect the information and wait for it to finish
3018 #now display the info log
3025 SelClass type memory
3043 /usr/sbin/cstm -f ${cstm_command_file} > /dev/null 2>&1
3046 /Hardware path/ {path = $3; next;}
3047 /Slot Number/ {slot = $3; next; }
3048 /PDC Firmware Revision/ {pdc = $4; next;}
3049 /Instruction Cache/ {icache = $4; next;}
3050 /Data Cache/ {dcache = $4; next;}
3051 /Instruction TLB/ {itlb = $4; next;}
3052 /Data TLB/ {dtlb = $5;
3053 printf("%6s%6s %12s%8s %6s%6s %6s\n",
3054 path, slot, pdc, icache, dcache, itlb, dtlb);
3056 ' $cstm_cpu_out > $cstm_cpu_out2
3058 rm -f ${cstm_command_file}
3059 #rm -f ${cstm_cpu_out}
3060 Debug "cstm_cpu_out2 = ${cstm_cpu_out2}"
3061 #Debug "Data Cache = ${data_cache}"
3062 #Debug "Instruction Cache = ${inst_cache}"
3063 #Debug "Data TLB = ${data_cache}"
3064 #Debug "Instruction TLB = ${inst_cache}"
3065 #Debug "PDC Firmware Revision = ${pdc_rev}"
3066 #Debug "${memory_interleave}"
3068 check_na=$(awk ' /Total Physical Memory/ {print $NF}
3069 ' $cstm_mem_out | tail -1)
3070 if [[ ${check_na} != "N/A" ]]
3072 cstm_tot_phys=$(awk ' /Total Physical Memory/ {print $(NF -1)}
3073 ' $cstm_mem_out | tail -1)
3077 cstm_tot_conf=$(awk ' /Total Configured Memory/ {print $(NF -1)}
3078 ' $cstm_mem_out | tail -1)
3079 cstm_page_size=$(awk ' /Page Size/ {print $(NF -1)}
3080 ' $cstm_mem_out | tail -1)
3081 cstm_interleave=$(awk ' /Memory interleaving/ { print $0}
3082 ' $cstm_mem_out | tail -1)
3083 if [[ -z ${cstm_tot_conf} ]] || [[ -z ${cstm_page_size} ]]
3086 cstm_page_size="N/A"
3089 print "Sorry, this version is not supported by SysInfo."
3090 print "Hardware level information will not be available."
3091 Debug "unsupported cstm version ${cstm_version}"
3095 } # end of function f_run_cstm
3098 #===================================================================
3100 #===================================================================
3101 function f_get_array_data
3103 if (( ${cstm_ok} == 0 ))
3105 Debug "Getting array data"
3106 if (($cstm_major == 12))
3108 cat <<==end_of_command== > ${cstm_command_file}
3111 # The following connects the UI to the system the UI is being run on,
3112 # and selects this system.
3113 # SelCurrentSys system add localhost system 1
3114 # Use current user name
3115 # No password required on local system.
3116 # don't prompt for overwrite
3130 else # cstm not equal to 12
3132 cat <<==end_of_command== > ${cstm_command_file}
3135 # The following connects the UI to the system the UI is being run on,
3136 # and selects this system.
3137 #SelCurrentSys system add localhost system 1
3138 # Use current user name
3139 # No password required on local system.
3140 #don't prompt for overwrite
3155 /usr/sbin/cstm -f ${cstm_command_file} > /dev/null 2>&1
3156 cat $cstm_array_out | tail +6 >> /tmp/sysinfo.$$.array
3159 print "Array info not available - Problem with cstm."
3162 } # end of f_get_array_data
3164 #===================================================================
3166 # This function retrieves various system and boot data.
3167 # e.g. amount of memory, number of cpus, etc.
3168 # It also checks to see if memory dumping is properly
3170 #===================================================================
3171 function f_get_system_data
3173 if [[ (-f /usr/sbin/cstm) && (-x /usr/sbin/cstm) ]]
3178 Debug " cstm not found....skipping"
3179 print "WARNING (${sysname}): CSTM not installed." >> \
3180 /tmp/sysinfo.$$.errwarn
3182 Debug "Beginning SYSTEM/ROOT check."
3185 print -n "collecting system data "
3187 # Determine cpu speed in MHz
3188 # Determine the memory size.
3189 # Real memory expressed in units of pages (4 kbytes per page).
3190 if [ ${osmajor} -eq 11 ]
3192 cpu_speed=$(echo itick_per_tick/D | adb -k $kernel /dev/kmem | tail -1 \
3193 | awk '{print $2 / 10000}')
3194 REAL_MEM=$(echo 'phys_mem_pages/D'| adb -k $kernel /dev/kmem | tail -1 \
3196 MemoryDumpSize=$(expr ${REAL_MEM} / 256)
3197 k32_64=$(getconf KERNEL_BITS)
3198 processor_count=$(echo 'processor_count/D' | adb -k $kernel /dev/kmem \
3199 | tail -1 | awk '{print $2}')
3201 cpu_speed=$(echo itick_per_tick/D | adb $kernel /dev/kmem | tail -1 \
3202 | awk '{print $2 / 10000}')
3203 dumppages=$(echo 'dumpsize/D'| adb $kernel /dev/kmem | tail -1 \
3205 MemoryDumpSize=$(expr ${dumppages} / 256)
3206 REAL_MEM=$(echo 'physmem/D'| adb $kernel /dev/kmem | tail -1 \
3208 # determine number of active processors (cpus)
3209 processor_count=$(echo 'processor_count/D' | adb $kernel /dev/kmem \
3210 | tail -1 | awk '{print $2}')
3212 memory=$(expr ${REAL_MEM} / 256)
3217 boot_time=$(who -b | awk '{printf "%s %s %s ", $4, $5, $6}')
3219 #now get date of last patch
3221 #Modified: Greg Sterling
3222 #updated lastpatch for 10.x & 11.x
3224 last_patch="unknown"
3225 if (( $osmajor >= 10 ))
3227 if [ -d /var/adm/sw/products ]
3229 last_patch=$(ls -lt /var/adm/sw/products | egrep 'PHNE|PHCO|PHKL|PHSS' \
3230 | head -1 | awk '{ print $6,$7,$8}')
3232 Debug "ERROR: Product IPD database does not exist."
3237 last_patch=$(ls -lt /system/ | egrep 'PHNE|PHCO|PHKL|PHSS' \
3238 | head -1 | awk '{ print $6,$7,$8}')
3249 lvlnboot -v /dev/vg00 > /tmp/sysinfo.$$.root 2>&1
3250 rootboot=$(grep "Boot Disk" /tmp/sysinfo.$$.root \
3251 | awk '{printf "%s ", $1}')
3252 rootroot=$(grep "^Root:" /tmp/sysinfo.$$.root \
3253 | awk '{print $2,$4}')
3254 rootswap=$(grep "^Swap:" /tmp/sysinfo.$$.root \
3255 | awk '{print $2,$4}')
3256 rootdump=$(grep "^Dump:" /tmp/sysinfo.$$.root \
3257 | awk '{printf "%s ",$2}')
3263 kernel_size=$(ll ${kernel} | awk '{print $5}' 2>&1)
3264 # gather memory dump parms
3265 (( KernelSizeMb=`ll ${kernel} | awk '{print $5}'` / 1024 / 1024 + 1 ))
3266 if (( $osmajor < 10 ))
3268 # it is a 9.x system
3269 if [[ $(grep "dumps" /etc/conf/gen/S800*) = *default* ]]
3271 DumpDiskCapacity=$(swapinfo -mat | grep dev | head -1 | awk '{print $2}')
3273 Debug " 9.x system. default found in S800."
3274 Debug " rootdump=${rootdump}"
3276 Debug " 9.x system. default not found in S800. using rootdump"
3279 grep "/etc/savecore" /etc/rc > /dev/null 2>&1
3284 SAVECORE_DIR=$(grep "/etc/savecore" /etc/rc | tail -1 | awk '{print $NF}')
3286 elif (( $osmajor >= 11 ))
3289 Debug " 11.x system."
3290 if [ -f /etc/rc.config.d/savecrash ]
3292 . /etc/rc.config.d/savecrash
3293 # check if SAVECRASH is set
3294 if [[ ! -z $SAVECRASH ]]
3297 0) Compress_Option="Turned off. ";;
3298 1) Compress_Option="Turned on. ";;
3299 2) Compress_Option="Don't care (default). ";;
3300 *) Compress_Option="N/A";;
3303 SAVECORE_DIR=$SAVECRASH_DIR
3304 Debug " found /etc/rc.config.d/savecrash with following parms:"
3305 Debug " SAVECORE=$SAVECRASH"
3306 Debug " SAVECORE_DIR=$SAVECRASH_DIR"
3307 Debug " CHUNK_SIZE=$CHUNK_SIZE"
3308 Debug " COMPRESS=$COMPRESS"
3309 Debug " MIN_FREE=$MIN_FREE"
3310 Debug " SWAP_LEVEL=$SWAP_LEVEL"
3311 Debug " FOREGRD=$FOREGRD"
3312 Debug " SAVE_PART=$SAVE_PART"
3313 Debug " LOG_ONLY=$LOG_ONLY"
3315 Debug " SAVECRASH is DISABLED"
3319 # Now check for the crashconf file. This file can be used to set additional
3320 # dump parameters in V11.x
3322 if [ -f /etc/rc.config.d/crashconf ]
3324 . /etc/rc.config.d/crashconf
3325 # check if CRASHCONF_ENABLED is set
3326 if [[ -z $CRASHCONF_ENABLED ]]
3328 Debug " CrashConf is disabled."
3331 # Changed: 12/15/98 by Greg Sterling
3332 # If we're using V11.x, and CRASHCONF is enabled, the we've costomized the
3333 # DUMP output. The equation below does not apply to this scenario.
3334 # TotalMemoryDumpSize = MemoryDumpSize + KernelSizeMb + KernelSafetyFactor
3336 # The actual dumpsize can not be computed from the crashconf utility. The
3337 # kernel size and safety values can be set to zero since the crashconf utility
3338 # already calculates these values.
3340 crashconf_dumpsize=$(/sbin/crashconf -v | grep 'Total pages included' \
3341 | awk '{ print $6}')
3342 crashconf_dumpsize=$(expr ${crashconf_dumpsize} \* 4096 / 1024 / 1024)
3344 # KernelSafetyFactor=0
3346 Debug " found /etc/rc.config.d/crashconf with following parms:"
3347 Debug " CRASHCONF_ENABLED=$CRASHCONF_ENABLED"
3348 Debug " CRASH_INCLUDED_PAGES=$CRASH_INCLUDED_PAGES"
3349 Debug " CRASH_EXCLUDED_PAGES=$CRASH_EXCLUDED_PAGES"
3350 Debug " CRASHCONF_READ_FSTAB=$CRASHCONF_READ_FSTAB"
3351 Debug " CRASHCONF_REPLACE=$CRASHCONF_REPLACE"
3353 # Check to see if the CRASHCONF_READ_FSTAB variable is set. If yes, then
3354 # the system will check the /etc/fstab file to see if there are any additional
3355 # dump spaces defined. If the CRASHCONF_REPLACE variable is set then all
3356 # the definitions/parameters defined in this section will replace any
3357 # previously defined DUMP parameters in the kernel.
3359 if [[ ! -z $CRASHCONF_READ_FSTAB ]]
3361 Debug " crashconf_read_fstab is enabled."
3362 crashconf_fstabs=$(awk ' $3=="dump" {printf("%s ",$1)}' /etc/fstab )
3364 Debug " list of crashconf_fstabs = $crashconf_fstabs"
3365 if [[ -z $crashconf_fstabs ]]
3367 Debug " crashconf_fstabs list is empty. Will continue to "
3368 Debug " use the lvlnboot info."
3370 if [[ -z $CRASHCONF_REPLACE ]]
3372 Debug " crashconf_fstabs will be added to existing \
3374 rootdump="$rootdump $crashconf_fstabs"
3376 Debug " crashconf_fstabs will replace default dump config."
3377 rootdump=$crashconf_fstabs
3383 Debug " could not find /etc/rc.config.d/crashconf"
3384 print "ERROR ${sysname}:/etc/rc.config.d/crashconf defaults file MISSING" >> /tmp/sysinfo.$$.errwarn
3388 # must be a 10.x system
3389 Debug " 10.x system."
3390 if [ -f /etc/rc.config.d/savecore ]
3392 . /etc/rc.config.d/savecore
3394 0) Compress_Option="Turned off. ";;
3395 1) Compress_Option="Turned on. ";;
3396 2) Compress_Option="Don't care (default). ";;
3397 *) Compress_Option="N/A";;
3399 Debug " found /etc/rc.config.d/savecore with following parms:"
3400 Debug " SAVECORE=$SAVECORE"
3401 Debug " SAVECORE_DIR=$SAVECORE_DIR"
3402 Debug " CHUNK_SIZE=$CHUNK_SIZE"
3403 Debug " COMPRESS=$COMPRESS"
3404 Debug " MIN_FREE=$MIN_FREE"
3405 Debug " SWAP_LEVEL=$SWAP_LEVEL"
3406 Debug " FOREGRD=$FOREGRD"
3408 Debug " could not find /etc/rc.config.d/savecore"
3409 print "ERROR: ${sysname}:/etc/rc.config.d/savecore defaults file MISSING" >> /tmp/sysinfo.$$.errwarn
3414 # Updated: Greg Sterling
3415 # I moved this section of code outside the savesore/crashconf checks above.
3416 # This dump calculation is pertinent to any version of HPUX and should not be
3417 # restricted to V10.x
3419 if (($lvm_installed))
3421 Debug "Checking for dump space"
3422 Debug " rootdump = ${rootdump}"
3423 for logvol in ${rootdump}
3426 # Added by Greg Sterling
3427 # This code checks for a preceeding /dev. if it exists then
3428 # continue, otherwise append the /dev/vg00 to the lvol definition.
3430 echo $logvol | grep -q "^/dev/"
3433 Debug " adding /dev/vg00 to lvol name"
3434 logvol="/dev/vg00/${logvol}"
3437 # Added by Greg Sterling
3438 # Validate the logvol is a logical volume. Its possible for dump
3439 # devices in later versions of HPUX to be disks w/out LVM
3441 lvdisplay $logvol > /dev/null 2>&1
3444 Debug " dump device is not a logical volume."
3445 rlogvol=$( echo $logvol | sed -e "s:^/dev/dsk/:/dev/rdsk/:" )
3446 DumpSize=$( diskinfo $rlogvol | grep "size" | awk '{print $2}')
3447 DumpSize=$( expr $DumpSize / 1024 )
3449 DumpSize=$(lvdisplay $logvol | grep "LV Size" | awk '{print $4}')
3450 Debug " $logvol DumpSize = ${DumpSize}"
3452 Debug " Adding $DumpSize to DumpDiskCapacity = ${DumpDiskCapacity}"
3453 ((DumpDiskCapacity = DumpDiskCapacity + DumpSize))
3455 Debug " DumpDiskCapacity =${DumpDiskCapacity}"
3457 Debug "Checking how much to dump"
3458 # add kernel size to memory plus 2Mb safety factor
3459 ((TotalMemoryDumpSize = MemoryDumpSize + KernelSizeMb + KernelSafetyFactor))
3460 Debug " REAL_MEM = $REAL_MEM"
3461 Debug " memory = $memory"
3462 Debug " KernelSizeMb = $KernelSizeMb"
3463 Debug " KernelSafetyFactor = $KernelSafetyFactor"
3465 Debug " TotalMemoryDumpSize = $TotalMemoryDumpSize"
3471 # now check to see if everything is okay.
3473 # Updated: 12/15/98 by Greg Sterling
3474 # I updated this code to consider the CRASHCONF utility on V11.x. The
3475 # TotalMemoryDumpSize parameter is only relevent for a FULL crash dump.
3476 # Normal system crashes (if there is such a thing), can be captured within
3477 # smaller dump spaces due to the CRASHUTIL utility.
3481 if (( DumpDiskCapacity < TotalMemoryDumpSize ))
3483 if (( DumpDiskCapacity < crashconf_dumpsize ))
3485 print "WARNING (${sysname}): Dump space is underconfigured!" \
3486 >> /tmp/sysinfo.$$.errwarn
3488 print "WARNING (${sysname}): Dump space is underconfigured \
3489 for a FULL crashdump." >> /tmp/sysinfo.$$.errwarn
3490 print "WARNING (${sysname}): Dump space is adequate for the \
3491 CRASHCONF configuration." >> /tmp/sysinfo.$$.errwarn
3497 if (( DumpDiskCapacity < TotalMemoryDumpSize ))
3499 print "WARNING (${sysname}): Dump space is under configured!" \
3500 >> /tmp/sysinfo.$$.errwarn
3504 if ((! (($exit_code)) ))
3509 if (( ! $SAVECORE ))
3512 if ((! (($exit_code)) ))
3519 print "WARNING (${sysname}): Savecore is not enabled!" \
3520 >> /tmp/sysinfo.$$.errwarn
3524 if [[ -z $CRASHCONF_ENABLED ]]
3526 Debug "Savecore is Disabled and CrashConf is Disabled."
3527 print "WARNING (${sysname}):Both Savecore and crashconf are disabled!" \
3528 >> /tmp/sysinfo.$$.errwarn
3536 # Now check if enough disk space exists to hold savecore
3537 Debug "Checking for sufficient savecore space"
3538 COMPRESSION="Not Applicable"
3539 if [[ -d $SAVECORE_DIR ]]
3541 #SaveCoreAvail=$(bdf $SAVECORE_DIR | grep /dev/ | awk '{print $4}')
3542 # fix for non-standard lvol names
3543 SaveCoreAvail=$(df -b $SAVECORE_DIR | awk '{print $5}')
3544 ((SaveCoreAvail = SaveCoreAvail / 1024))
3545 Debug " SAVECORE=$SAVECORE"
3546 Debug " SAVECORE_DIR=$SAVECORE_DIR"
3547 Debug " SaveCoreAvail=$SaveCoreAvail"
3550 if ((! (($exit_code)) ))
3554 print "WARNING (${sysname}): Directory $SAVECORE_DIR does not exist!" >> /tmp/sysinfo.$$.errwarn
3556 if ((($osmajor == 10)) && (($osminor >= 10))) || (( $osmajor > 10 ))
3558 COMPRESSION="Available"
3559 compression_factor=${compression_factor:-50}
3560 ((MemoryCompression = (TotalMemoryDumpSize * $compression_factor) / 100 ))
3561 ((CompressedMemoryDumpSize = TotalMemoryDumpSize - MemoryCompression))
3563 Debug " Checking for savecore compression"
3564 Debug " Compress_option=$Compress_Option"
3565 Debug " Compression=$COMPRESSION"
3566 Debug " compression_factor=$compression_factor"
3567 Debug " CompressedMemoryDumpSize after = $CompressedMemoryDumpSize"
3568 if (( $CompressedMemoryDumpSize > $SaveCoreAvail ))
3570 if ((! (($exit_code)) ))
3574 print "WARNING (${sysname}): Insufficient file space to hold savecore!" >> /tmp/sysinfo.$$.errwarn
3577 if (( $TotalMemoryDumpSize > $SaveCoreAvail ))
3579 if ((! (($exit_code)) ))
3583 print "WARNING (${sysname}): Insufficient file space to hold savecore!" >> /tmp/sysinfo.$$.errwarn
3586 SaveCoreAvail_Out=$SaveCoreAvail
3590 TotalMemoryDumpSizeOut=$TotalMemoryDumpSize
3592 # now let's print it.
3595 print "</PRE>" >> /tmp/sysinfo.$$.sysout
3596 print "<A name='System'></A>" >> /tmp/sysinfo.$$.sysout
3597 print "<H2>" >> /tmp/sysinfo.$$.sysout
3598 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.sysout
3599 print "System Data" >> /tmp/sysinfo.$$.sysout
3600 print "</FONT></H2>" >> /tmp/sysinfo.$$.sysout
3601 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.sysout
3603 print "" >> /tmp/sysinfo.$$.sysout
3604 print "SYSTEM DATA" >> /tmp/sysinfo.$$.sysout
3605 print "===========" >> /tmp/sysinfo.$$.sysout
3607 print "HOSTNAME: ${sysname}" >> /tmp/sysinfo.$$.sysout
3608 print "SYSTEM: ${system}" >> /tmp/sysinfo.$$.sysout
3609 print "MODEL: ${series}" >> /tmp/sysinfo.$$.sysout
3610 if [[ -n ${pa_chip} ]]
3612 print "RISC CHIP: ${pa_chip}" >> /tmp/sysinfo.$$.sysout
3613 print "PA VERSION: ${pa_ver}" >> /tmp/sysinfo.$$.sysout
3615 if [[ -n ${serial_number} ]]
3617 print "SERIAL #: ${serial_number}" >> /tmp/sysinfo.$$.sysout
3619 print "SYSTEM ID: ${machine_id}" >> /tmp/sysinfo.$$.sysout
3620 print "CPU SPEED: ${cpu_speed} MHz" >> /tmp/sysinfo.$$.sysout
3621 print "CPUS: ${processor_count} active processor(s) " >> /tmp/sysinfo.$$.sysout
3622 print "MEMORY: ${memory} Mbytes of memory." >> /tmp/sysinfo.$$.sysout
3623 print -n "HP-UX VERSION: ${osletter}.${osmajor}.${osminor}" >> /tmp/sysinfo.$$.sysout
3624 if (( $osmajor == 11 ))
3626 print " ${k32_64} Bit" >> /tmp/sysinfo.$$.sysout
3628 print "" >> /tmp/sysinfo.$$.sysout
3630 print "USER LICENSE: ${license}" >> /tmp/sysinfo.$$.sysout
3631 print "LAST BOOT: ${boot_time}" >> /tmp/sysinfo.$$.sysout
3632 print "LAST PATCH: ${last_patch}\n" >> /tmp/sysinfo.$$.sysout
3633 print "" >> /tmp/sysinfo.$$.sysout
3635 if (( ${cstm_ok} == 0 ))
3637 print "System H/W data" >> /tmp/sysinfo.$$.sysout
3638 print "===============" >> /tmp/sysinfo.$$.sysout
3639 print " Processor data" >> /tmp/sysinfo.$$.sysout
3640 print -- " --------------" >> /tmp/sysinfo.$$.sysout
3641 print " H/W PDC Cache Size TLB Size" >>/tmp/sysinfo.$$.sysout
3642 print " path slot rev level Inst Data Inst Data" >>/tmp/sysinfo.$$.sysout
3643 print -- " -----------------------------------------------------" >>/tmp/sysinfo.$$.sysout
3644 cat $cstm_cpu_out2 | awk -F: '
3645 {printf("%8s%6s%14s%7s%7s%6s%6s\n",$1,$2,$3,$4,$5,$6,$7)}
3646 ' >> /tmp/sysinfo.$$.sysout
3648 print "" >> /tmp/sysinfo.$$.sysout
3649 print " Memory Information" >> /tmp/sysinfo.$$.sysout
3650 print -- " ------------------" >> /tmp/sysinfo.$$.sysout
3651 #print " Total Physical Memory = $cstm_tot_phys MB" \
3652 # >> /tmp/sysinfo.$$.sysout
3653 #print " Total Configured Memory = $cstm_tot_conf MB" \
3654 # >> /tmp/sysinfo.$$.sysout
3655 #print " Memory Page Size = $cstm_page_size Bytes" \
3656 # >> /tmp/sysinfo.$$.sysout
3657 #print "$cstm_interleave" >> /tmp/sysinfo.$$.sysout
3658 #print "" >> /tmp/sysinfo.$$.sysout
3660 cat ${cstm_mem_out} | tail -n +10 | sed -e '/^$/d' >> /tmp/sysinfo.$$.sysout
3661 print "" >> /tmp/sysinfo.$$.sysout
3664 print "SWAP DATA" >> /tmp/sysinfo.$$.sysout
3665 print "=========" >> /tmp/sysinfo.$$.sysout
3666 if (( $osmajor >= 10 ))
3668 Debug "`swapinfo -dtfnrMa`"
3670 Debug "`swapinfo -dtfa`"
3673 swapinfo -m | grep dev | \
3674 awk '{printf "%6s MB on %s\n",$2,$9}' >> /tmp/sysinfo.$$.sysout
3675 swapinfo -m | grep fs | \
3676 awk '{printf "%6s MB on %s\n",$2,$9}' >> /tmp/sysinfo.$$.sysout
3677 swapinfo -m | grep memory | \
3678 awk '{printf "%6s MB on memory\n",$2}' >> /tmp/sysinfo.$$.sysout
3679 print -- " ----" >> /tmp/sysinfo.$$.sysout
3681 if (( $osmajor >= 10 ))
3683 swapinfo -mdfMt | grep total | \
3684 awk '{printf "%6s MB Total \n",$2}' >> /tmp/sysinfo.$$.sysout
3686 swapinfo -mdft | grep tot | \
3687 awk '{printf "%6s MB Total \n",$2}' >> /tmp/sysinfo.$$.sysout
3689 print "" >> /tmp/sysinfo.$$.sysout
3690 print "DUMP DISKS" >> /tmp/sysinfo.$$.sysout
3691 print "==========" >> /tmp/sysinfo.$$.sysout
3692 lvlnboot -v /dev/vg00 2>&1 | grep Dump | awk '{print " "$0}' >> \
3693 /tmp/sysinfo.$$.sysout
3694 print "" >> /tmp/sysinfo.$$.sysout
3695 print "DUMP DATA" >> /tmp/sysinfo.$$.sysout
3696 print "=========" >> /tmp/sysinfo.$$.sysout
3697 print "SAVECORE: ${SAVECORE}" >> /tmp/sysinfo.$$.sysout
3702 print "SAVECORE DIR: ${SAVECORE_DIR}" >> \
3703 /tmp/sysinfo.$$.sysout
3704 if ((($osmajor == 10)) && (($osminor >= 10))) || (( $osmajor > 10 ))
3706 print "SAVECORE COMPRESSION: ${COMPRESSION}" >> \
3707 /tmp/sysinfo.$$.sysout
3708 print "COMPRESSION OPTION: ${Compress_Option}" >> \
3709 /tmp/sysinfo.$$.sysout
3710 print "COMPRESSION FACTOR: ${compression_factor} %" >> \
3711 /tmp/sysinfo.$$.sysout
3712 print "COMPRESSED MEMORY TO DUMP: ${CompressedMemoryDumpSize} MB" >> \
3713 /tmp/sysinfo.$$.sysout
3714 print "SAVECORE CAPACITY: ${SaveCoreAvail_Out} MB\n" >> \
3715 /tmp/sysinfo.$$.sysout
3721 # Added: Greg Sterling
3722 # Added code to output the status of the CrashConf configuration.
3724 if (($osmajor > 10))
3726 if [[ ! -z $CRASHCONF_ENABLED ]]
3728 print "" >> /tmp/sysinfo.$$.sysout
3729 if [[ -z $CRASHCONF_READ_FSTAB ]]
3731 print "CRASHCONF : Enabled" >> /tmp/sysinfo.$$.sysout
3733 print "CRASHCONF : Enabled (referencing /etc/fstab)" >> \
3734 /tmp/sysinfo.$$.sysout
3736 if [[ -z $CRASHCONF_REPLACE ]]
3738 print " Replace Option : CrashConf values have been Added to existing Kernel Definitions." >> /tmp/sysinfo.$$.sysout
3740 print " Replace Option : CrashConf values REPLACE existing Kernel Definitions." >> /tmp/sysinfo.$$.sysout
3743 print " Included Pages : $CRASH_INCLUDED_PAGES" >> \
3744 /tmp/sysinfo.$$.sysout
3745 print " Excluded Pages : $CRASH_EXCLUDED_PAGES" >> \
3746 /tmp/sysinfo.$$.sysout
3747 print " FSTAB File Entries : $crashconf_fstabs" >> \
3748 /tmp/sysinfo.$$.sysout
3749 print " CRASHCONF Configured MEMORY TO DUMP: ${crashconf_dumpsize} MB" \
3750 >> /tmp/sysinfo.$$.sysout
3752 print "CRASHCONF : Disabled" >> /tmp/sysinfo.$$.sysout
3754 print "" >> /tmp/sysinfo.$$.sysout
3757 print "KERNEL SIZE: ${kernel_size} Bytes." >> \
3758 /tmp/sysinfo.$$.sysout
3759 print "TOTAL MEMORY TO DUMP: ${TotalMemoryDumpSizeOut} MB" >> \
3760 /tmp/sysinfo.$$.sysout
3762 print "DUMP DISK CAPACITY: ${DumpDiskCapacity} MB" >> \
3763 /tmp/sysinfo.$$.sysout
3765 f_display_file /tmp/sysinfo.$$.sysout
3766 f_display_file /tmp/sysinfo.$$.stmout
3767 #f_display_file /tmp/sysinfo.$$.dumpwarn
3768 print "" >> /tmp/sysinfo.$$.sysout
3774 } # end of f_get_system_data
3776 function f_call_getkinfo
3778 /usr/sam/lbin/getkinfo -b -o ${sam_kinfo}
3781 function get_all_parms
3783 Debug "starting get_all_parms"
3785 BEGIN { FS = "\n"; RS = "}" }
3789 /KC_PARAM_NAME/ {name = $3; printf("%s,", name)}
3790 /KC_PARAM_CLASS/ {class = $3 " " $4; printf("%s\n", class)}
3791 ' #| sed -e 's/\"*//g'
3794 function get_all_classes
3796 Debug "starting get_all_classes"
3797 awk ' BEGIN { FS = "\n"; RS = "}" }
3798 $0 ~ /'\"$parm\"'/ {print $0}' $sam_kinfo \
3800 /^KC_PARAM_CLASS/ {printf("%s %s\n",$3,$4)}
3801 ' #| sed -e 's/\"*//g'
3804 function f_query_sam
3808 awk ' BEGIN { FS = "\n"; RS = "}" }
3809 $0 ~ /'$sam_parm'/ {print $0}' $sam_kinfo \
3811 /^KC_PARAM_NAME/ {name = $3}
3812 /^KC_PARAM_STATUS/ {status = $3}
3813 /^KC_PARAM_DEFAULT/ {default = $3}
3814 /^KC_PARAM_MAX/ {max = $3}
3815 /^KC_PARAM_MIN/ {min = $3}
3816 /^KC_PARAM_CLASS/ {class = $3" " $4}
3817 /^KC_PARAM_DESC/ {desc = ""
3822 END { printf("%s@%s@%s@%s@%s@%s@%s\n",
3823 name,status,default,max,min,desc,class)}
3824 ' | sed -e 's/\"*//g'
3828 #===================================================================
3830 # This function queries the kernel for various parameters.
3831 #===================================================================
3832 function f_get_kernel_data
3835 Debug "Beginning KERNEL check."
3838 print -n "collecting kernel data "
3839 print "" >> /tmp/sysinfo.$$.kernout
3841 print "Collecting kernel metrics....please wait."
3846 print "</PRE>" >> /tmp/sysinfo.$$.kernout
3847 print "<A name='Kernel'></A>" >> /tmp/sysinfo.$$.kernout
3848 print "<H2>" >> /tmp/sysinfo.$$.kernout
3849 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.kernout
3850 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.kernout
3851 if (( ${FULL_KERNEL} ))
3853 print "Kernel Parms (Verbose Listing)" >> /tmp/sysinfo.$$.kernout
3855 print "Kernel Parms (Brief Listing)" >> /tmp/sysinfo.$$.kernout
3857 print "</FONT></H2>" >> /tmp/sysinfo.$$.kernout
3858 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.kernout
3860 print "KERNEL PARAMETERS" >> /tmp/sysinfo.$$.kernout
3861 print "=================" >> /tmp/sysinfo.$$.kernout
3864 Debug "calling f_call_getkinfo -> ${sam_kinfo}"
3867 Debug "calling get_all_parms -> ${all_parms_file}"
3868 get_all_parms > ${all_parms_file}
3869 Debug " parm names = `cat ${all_parms_file}`"
3871 Debug "calling get_all_classes -> ${all_classes_file}"
3872 get_all_classes | sort -t , -k 7 | uniq > ${all_classes_file}
3873 #sed -e 's/ /_/g' -e 's/_$//g' > ${all_classes_file}
3874 Debug " class names = `cat ${all_classes_file}`"
3876 exec 3< ${all_classes_file}
3877 exec 4< ${all_parms_file}
3878 while read -u3 class
3884 print_class=$(echo $class | sed -e 's/\"*//g')
3887 print "<H3>${print_class} Metrics</H3>" >> /tmp/sysinfo.$$.kernout
3889 print "${print_class} Metrics" >> /tmp/sysinfo.$$.kernout
3890 print "============================" >> /tmp/sysinfo.$$.kernout
3892 Debug "Class = ${class}"
3893 for parm1 in $(grep "${class}" ${all_parms_file} | awk -F, '{print $1}')
3895 Debug "Parm1 = $parm1"
3898 f_query_sam ${parm1} | \
3899 awk 'BEGIN {FS = "@"}
3901 printf(" Title: %s\n",$6)
3902 printf(" Current: %s\n",$2)
3903 printf(" Default: %s\n",$3)
3904 printf(" Min: %s\n",$5)
3905 printf(" Max: %s\n",$4)
3906 #printf(" Class: %s\n",$7)
3907 } '>> /tmp/sysinfo.$$.kernout
3909 f_query_sam ${parm1} | \
3910 awk 'BEGIN {FS = "@"}
3911 {printf(" %-20s %s\n",$1,$2)
3912 } ' >> /tmp/sysinfo.$$.kernout
3915 print "" >> /tmp/sysinfo.$$.kernout
3917 print "" >> /tmp/sysinfo.$$.kernout
3918 f_display_file /tmp/sysinfo.$$.kernout
3922 if (($DB_on_this_sys))
3924 dbc_max=$(grep dbc_max /tmp/sysinfo.$$.kernout | awk '{print $2}')
3925 if (( dbc_max > 10 ))
3927 print "WARNING ($sysname): dbc_max is set to ${dbc_max} on DB server" >> \
3928 /tmp/sysinfo.$$.sapwarn
3932 f_display_file /tmp/sysinfo.$$.kernwarn
3937 } # end of f_get_kernel_data
3939 #===================================================================
3940 # f_get_9x_kernel_data
3941 # This function queries the kernel for various parameters.
3942 #===================================================================
3943 function f_get_9x_kernel_data
3946 Debug "Beginning 9x KERNEL check."
3949 print -n "collecting kernel data "
3951 shmmni=$(echo 'shmmni/D'|adb $kernel /dev/kmem \
3952 | tail -1 | awk '{print $2}')
3953 maxfiles=$(echo 'maxfiles/D'|adb $kernel /dev/kmem \
3954 | tail -1 | awk '{print $2}')
3959 shmmax=$(echo 'shmmax/D'|adb $kernel /dev/kmem \
3960 | tail -1 | awk '{print $2}')
3961 shmseg=$(echo 'shmseg/D'|adb $kernel /dev/kmem \
3962 | tail -1 | awk '{print $2}')
3963 shmem=$(echo 'shmem/D'|adb $kernel /dev/kmem \
3964 | tail -1 | awk '{print $2}')
3969 maxfiles_lim=$(echo 'maxfiles_lim/D'|adb $kernel /dev/kmem \
3970 | tail -1 | awk '{print $2}')
3971 maxuprc=$(echo 'maxuprc/D'|adb $kernel /dev/kmem \
3972 | tail -1 | awk '{print $2}')
3977 nproc=$(echo 'nproc/D'|adb $kernel /dev/kmem \
3978 | tail -1 | awk '{print $2}')
3979 nfile=$(echo 'nfile/D'|adb $kernel /dev/kmem \
3980 | tail -1 | awk '{print $2}')
3985 nflocks=$(echo 'nflocks/D'|adb $kernel /dev/kmem \
3986 | tail -1 | awk '{print $2}')
3987 ninode=$(echo 'ninode/D'|adb $kernel /dev/kmem \
3988 | tail -1 | awk '{print $2}')
3993 # PA8000 chips support variable page sizes
3994 super_page_supp=$(echo cpu_has_var_size_pages/D | adb $kernel /dev/kmem \
3995 | tail -1 | awk '{print $2}')
3996 case $super_page_supp in
3997 0) super_page_support=no;;
3998 1) super_page_support=yes;;
3999 *) super_page_support=n/a;; # not found in kernel
4005 npty=$(echo 'npty/D'|adb $kernel /dev/kmem \
4006 | tail -1 | awk '{print $2}')
4007 # check for asynch disc writes enabled
4008 fs_async=$(echo 'fs_async/D'|adb $kernel /dev/kmem \
4009 | tail -1 | awk '{print $2}')
4010 if ((${fs_async} == 0))
4020 nbuf=$(echo 'nbuf/D'|adb $kernel /dev/kmem \
4021 | tail -1 | awk '{print $2}')
4022 bufpages=$(echo 'bufpages/D'|adb $kernel /dev/kmem \
4023 | tail -1 | awk '{print $2}')
4029 msgmap=$(echo 'msgmap/D'|adb $kernel /dev/kmem \
4030 | tail -1 | awk '{print $2}')
4035 maxdsiz=$(echo 'maxdsiz/D'|adb $kernel /dev/kmem \
4036 | tail -1 | awk '{print $2}')
4037 maxssiz=$(echo 'maxssiz/D'|adb $kernel /dev/kmem \
4038 | tail -1 | awk '{print $2}')
4043 maxtsiz=$(echo 'maxtsiz/D'|adb $kernel /dev/kmem \
4044 | tail -1 | awk '{print $2}')
4045 maxuprc=$(echo 'maxuprc/D'|adb $kernel /dev/kmem \
4046 | tail -1 | awk '{print $2}')
4051 ncdnode=$(echo 'ncdnode/D'|adb $kernel /dev/kmem \
4052 | tail -1 | awk '{print $2}')
4057 sema=$(echo 'sema/D'|adb $kernel /dev/kmem \
4058 | tail -1 | awk '{print $2}')
4063 semmap=$(echo 'semmap/D'|adb $kernel /dev/kmem \
4064 | tail -1 | awk '{print $2}')
4069 # get LVM related kernel parameters
4070 maxvgs=$(echo 'maxvgs/D'|adb $kernel /dev/kmem \
4071 | tail -1 | awk '{print $2}')
4072 lv_vgs_opn=$(echo 'lv_vgs_opn/D'|adb $kernel /dev/kmem \
4073 | tail -1 | awk '{print $2}')
4078 lv_lvs_opn=$(echo 'lv_lvs_opn/D'|adb $kernel /dev/kmem \
4079 | tail -1 | awk '{print $2}')
4080 lv_pbuf_cnt=$(echo 'lv_pbuf_cnt/D'|adb $kernel /dev/kmem \
4081 | tail -1 | awk '{print $2}')
4086 lv_pbuf_inuse=$(echo 'lv_pbuf_inuse/D'|adb $kernel /dev/kmem \
4087 | tail -1 | awk '{print $2}')
4088 lv_pbuf_maxuse=$(echo 'lv_pbuf_maxuse/D'|adb $kernel /dev/kmem \
4089 | tail -1 | awk '{print $2}')
4094 lv_pbuf_pending_Q=$(echo 'lv_pbuf_pending_Q/D'|adb $kernel /dev/kmem \
4095 | tail -1 | awk '{print $2}')
4099 print "</PRE>" >> /tmp/sysinfo.$$.kernout
4100 print "<A name='Kernel'></A>" >> /tmp/sysinfo.$$.kernout
4101 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.kernout
4102 print "<H2>Kernel Data</H2></FONT>" >> /tmp/sysinfo.$$.kernout
4103 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.kernout
4105 print "KERNEL DATA" >> /tmp/sysinfo.$$.kernout
4106 print "===========" >> /tmp/sysinfo.$$.kernout
4108 print "Super page support (cpu_has_var_size_pages) $super_page_support" >> /tmp/sysinfo.$$.kernout
4109 print "" >> /tmp/sysinfo.$$.kernout
4110 print "Max shared memory segments in system (shmmni)$shmmni" >> /tmp/sysinfo.$$.kernout
4111 print "Enable Sys V Shared Memory(shmem) ${shmem}" >> /tmp/sysinfo.$$.kernout
4113 print "" >> /tmp/sysinfo.$$.kernout
4114 print "Soft file limit per process (maxfiles) $maxfiles" >> /tmp/sysinfo.$$.kernout
4115 print "Hard file limit per process (maxfiles_lim) $maxfiles_lim" >> /tmp/sysinfo.$$.kernout
4116 print "Max number of processes (nproc) $nproc" >> /tmp/sysinfo.$$.kernout
4117 print "Max number of user processes (maxuprc) $maxuprc" >> /tmp/sysinfo.$$.kernout
4118 print "Number of open files in system (nfile) $nfile" >> /tmp/sysinfo.$$.kernout
4119 print "Maximum number of file locks (nflocks) $nflocks" >> /tmp/sysinfo.$$.kernout
4120 print "Max number of in-core inodes (ninode) $ninode" >> /tmp/sysinfo.$$.kernout
4121 print "Asynchronous disk writes allowed (fs_async) $fs_async" >> /tmp/sysinfo.$$.kernout
4122 print "Number of pseudo-teletypes (npty) $npty" >> /tmp/sysinfo.$$.kernout
4123 print "Number of filesystem buffer headers (nbuf) $nbuf" >> /tmp/sysinfo.$$.kernout
4124 print "Number of buffer pages in cache (bufpages) $bufpages" >> /tmp/sysinfo.$$.kernout
4125 print "Max Number of Message Map Entries (msgmap) $msgmap" >> /tmp/sysinfo.$$.kernout
4126 print "Max Data Segment Size (Bytes) (maxdsiz) $maxdsiz" >> /tmp/sysinfo.$$.kernout
4127 print "Max Stack Segment Size (Bytes) (maxssiz) $maxssiz" >> /tmp/sysinfo.$$.kernout
4128 print "Max Text Segment Size (Bytes) (maxtsiz) $maxtsiz" >> /tmp/sysinfo.$$.kernout
4129 print "Enable Sys V Semaphores (sema) $sema" >> /tmp/sysinfo.$$.kernout
4131 if (($lvm_installed))
4133 print "" >> /tmp/sysinfo.$$.kernout
4134 print "LVM Parms" >> /tmp/sysinfo.$$.kernout
4135 print " Max number of volume groups (maxvgs) $maxvgs" >> /tmp/sysinfo.$$.kernout
4136 print " Number of open volume groups (lv_vgs_opn) $lv_vgs_opn" >> /tmp/sysinfo.$$.kernout
4137 print " Number of open logical volumes (lv_lvs_opn)$lv_lvs_opn" >> /tmp/sysinfo.$$.kernout
4138 print " Lvol pbuf count (lv_pbuf_cnt) $lv_pbuf_cnt" >> /tmp/sysinfo.$$.kernout
4139 print " Lvol pbuf current usage (lv_pbuf_inuse) $lv_pbuf_inuse" >> /tmp/sysinfo.$$.kernout
4140 print " Lvol pbuf high water mark (lv_pbuf_maxuse) $lv_pbuf_maxuse" >> /tmp/sysinfo.$$.kernout
4141 print " lv_pbuf_pending_Q: $lv_pbuf_pending_Q \n" >> /tmp/sysinfo.$$.kernout
4143 f_display_file /tmp/sysinfo.$$.kernout
4144 f_display_file /tmp/sysinfo.$$.kernwarn
4149 } # end of f_get_9x_kernel_data
4152 #===================================================================
4153 # f_get_network_data
4154 # This function queries each lan card and retrieves information
4156 #===================================================================
4157 function f_get_network_data
4159 Debug "Beginning NETWORK check."
4162 print -n "scanning network cards "
4165 #DOMAIN=$(nslookup ${sysname} | grep Name | grep -v Server | cut -d. -f2-6)
4166 default_router=$( netstat -r | grep default | awk '{print $2}')
4167 default_router_ip=$( netstat -rn | grep default | awk '{print $2}')
4170 print "</PRE>" >> /tmp/sysinfo.$$.netout
4171 print "<A NAME='Network'></A>" >> /tmp/sysinfo.$$.netout
4172 print "<H2>" >> /tmp/sysinfo.$$.netout
4173 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.netout
4174 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.netout
4175 print "Network Data </H2>" >> /tmp/sysinfo.$$.netout
4176 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.netout
4178 print "NETWORK DATA" >> /tmp/sysinfo.$$.netout
4179 print "============" >> /tmp/sysinfo.$$.netout
4181 print "DOMAIN NAME: ${CURRENT_DOMAIN}" >> /tmp/sysinfo.$$.netout
4182 print -n "DNS SERVER: ${CURRENT_DNS_SERVER} " >> /tmp/sysinfo.$$.netout
4183 print "(${CURRENT_DNS_SERVER_IP})" >> /tmp/sysinfo.$$.netout
4184 print -n "DEFAULT ROUTER: ${default_router} " >> /tmp/sysinfo.$$.netout
4185 print "(${default_router_ip})" >> /tmp/sysinfo.$$.netout
4186 print "" >> /tmp/sysinfo.$$.netout
4188 #for CARD in $(netstat -in | grep lan | awk '{print $1}' | sed 's/\*//')
4189 # 1.42 change to handle multiple I/F cards
4190 if (( ${osmajor} >= 10 ))
4192 card_list=$(/etc/lanscan -i | awk '{print $1}')
4193 Debug " 10.x using lanscan -i"
4195 card_list=$(/etc/lanscan | tail +3 | awk '{printf("%s\n",$5)}')
4196 Debug " 9.x using lanscan "
4198 for CARD in ${card_list}
4200 ifconfig "${CARD}" > /tmp/sysinfo.$$.ipdata 2>&1
4203 Debug " checking lan card -> $CARD"
4204 #lanconfig "$CARD" >> /tmp/sysinfo.$$.ipdata 2>&1
4205 #card_type=$(lanconfig "$CARD" | grep ${CARD} | awk '{print $2}')
4206 if (( ${osmajor} >= 11 ))
4208 card_type=$(lanscan -im | grep "${CARD} " | awk '{print $NF}')
4210 card_type=$(lanscan | grep "${CARD} " | awk '{print $8}')
4212 Debug " card_type=$card_type"
4213 #MWR fix for incorrect handling of multiple lan cards
4214 #macaddr=$(/etc/lanscan | grep x | awk '{print $2}')
4215 macaddr=$(/etc/lanscan | grep "${CARD} " | awk '{print $2}')
4216 lan_hw_addr=$(/etc/lanscan | grep "${CARD} " | awk '{print $1}')
4217 nmid=$(/etc/lanscan | grep "${CARD} " | awk '{print $7}')
4218 ip_addr=$(grep inet /tmp/sysinfo.$$.ipdata | awk '{print $2}')
4219 ip_addr_name=$(LookupName ${ip_addr})
4220 lanspeed=$(lanadmin -s ${nmid} | awk '{print $3}')
4221 netmask=$(grep inet /tmp/sysinfo.$$.ipdata | awk '{print $4}')
4223 #convert hex netmask to decimal-dot.
4224 typeset -Z8 hex=0${netmask#0x}; typeset +Z hex
4228 while [ "$hex" ]; do
4231 netmask=$netmask.$dec
4234 netmask=${netmask#.}
4236 broadcast=$(grep inet /tmp/sysinfo.$$.ipdata | awk '{print $6}')
4239 print "</PRE>" >> /tmp/sysinfo.$$.netout
4240 print "<H3>INTERFACE DATA for ${CARD}</H3>" >> /tmp/sysinfo.$$.netout
4241 print "<PRE><font size = '4'>" >> /tmp/sysinfo.$$.netout
4243 print "INTERFACE DATA for ${CARD}" >> /tmp/sysinfo.$$.netout
4244 print "===========================" >> /tmp/sysinfo.$$.netout
4246 #print "NMID: ${nmid}" >> /tmp/sysinfo.$$.netout
4247 print "H/W ADDR: ${lan_hw_addr}" >> /tmp/sysinfo.$$.netout
4248 print "CARD TYPE: ${card_type}" >> /tmp/sysinfo.$$.netout
4249 print "SPEED: ${lanspeed}" >> /tmp/sysinfo.$$.netout
4250 print "MAC ADDRESS: ${macaddr}" >> /tmp/sysinfo.$$.netout
4251 print -n "IP ADDRESS: ${ip_addr}" >> /tmp/sysinfo.$$.netout
4252 print " (${ip_addr_name})" >> /tmp/sysinfo.$$.netout
4253 print "BROADCAST: ${broadcast}" >> /tmp/sysinfo.$$.netout
4254 print "NETMASK: ${netmask}\n" >> /tmp/sysinfo.$$.netout
4261 f_display_file /tmp/sysinfo.$$.netout
4266 } # end of f_get_network_data
4268 function query_EMC_disks
4270 Debug "Beginning query_EMC_disks"
4271 if [ -f ${where}/inq.hp ]
4273 Debug " found inq.hp"
4276 Debug " Could not find inq.hp....no query done."
4281 # Filters out the first raw disk file after an HP Claimed disk
4283 ( $0 ~ "CLAIMED" ) { hit=0 }
4284 ( $0 ~ "CLAIMED" && $0 ~ "HP") { hit=1; next }
4285 ( $0 !~ "CLAIMED" && hit==1) { hit=0; print $2 }
4290 #===================================================================
4291 # f_get_physical_disk_data
4292 # This function scans each physical disk.
4293 # It uses ioscan to collect disk info and the queries each
4294 # device using diskinfo.
4295 # The output is displayed in sorted order.
4296 #===================================================================
4297 function f_get_physical_disk_data
4299 Debug "Beginning PHYSICAL DISK check."
4300 # first let's print header information
4303 print "</PRE>" >> /tmp/sysinfo.$$.physinfoh
4304 print "<A NAME='Physical'></A>" >> /tmp/sysinfo.$$.physinfoh
4305 print "<H2>" >> /tmp/sysinfo.$$.physinfoh
4306 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.physinfoh
4307 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.physinfoh
4308 print "Physical Disk Data </H2>" >> /tmp/sysinfo.$$.physinfoh
4309 print "</FONT><PRE>" >> /tmp/sysinfo.$$.physinfoh
4310 print "</PRE>" >> /tmp/sysinfo.$$.boot
4311 print "<H3>Bootable Disks</H3>" >> /tmp/sysinfo.$$.boot
4312 print "<PRE><font size = '3'>" >> /tmp/sysinfo.$$.boot
4313 print "Volume Name H/W Path Auto Boot String" >> \
4314 /tmp/sysinfo.$$.boot
4315 print -- "-------------- ------------ ----------------" >> \
4316 /tmp/sysinfo.$$.boot
4317 print "<font size = '4'>" >> /tmp/sysinfo.$$.boot
4319 print "PHYSICAL DISK DATA" >> /tmp/sysinfo.$$.physinfoh
4320 print "==================" >> /tmp/sysinfo.$$.physinfoh
4321 print "BOOTABLE DISKS" >> /tmp/sysinfo.$$.boot
4322 print "==============" >> /tmp/sysinfo.$$.boot
4323 print "Volume Name H/W Path Auto Boot String" >> \
4324 /tmp/sysinfo.$$.boot
4325 print -- "-------------- ------------ ----------------" >> \
4326 /tmp/sysinfo.$$.boot
4329 # Header for XP256 Information
4330 print > /tmp/sysinfo.$$.256header
4331 print "XP256 Disc Array Information" >> /tmp/sysinfo.$$.256header
4332 print "============================" >> /tmp/sysinfo.$$.256header
4333 print -n " " >> /tmp/sysinfo.$$.256header
4334 print " Size" >> /tmp/sysinfo.$$.256header
4335 print -n "Device File Port Scsi Lun CU:Ldev Serial#" \
4336 >> /tmp/sysinfo.$$.256header
4337 print " Type (MB)" >> /tmp/sysinfo.$$.256header
4339 # Header for NIKE Array Information
4340 print > /tmp/sysinfo.$$.arrayheader
4341 print "Disk Array Information" >> /tmp/sysinfo.$$.arrayheader
4342 print "======================" >> /tmp/sysinfo.$$.arrayheader
4348 print "</PRE>" >> /tmp/sysinfo.$$.pmap
4349 print "<A NAME='Pmap'></A>" >> /tmp/sysinfo.$$.pmap
4350 print "<H2>" >> /tmp/sysinfo.$$.pmap
4351 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.pmap
4352 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.pmap
4353 print "Physical Disk To Logical Volume Mapping</H2>" >> /tmp/sysinfo.$$.pmap
4354 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.pmap
4356 print "PHYSICAL DISK TO LOGICAL VOLUME MAPPING" >> /tmp/sysinfo.$$.pmap
4357 print "=======================================" >> /tmp/sysinfo.$$.pmap
4359 print -n "Physical Disk " >> /tmp/sysinfo.$$.pmap
4360 print " Alternate Link" >> /tmp/sysinfo.$$.pmap
4361 print " Logical Volume LE PE" >> /tmp/sysinfo.$$.pmap
4362 print -n -- "----------------------------------------" >> /tmp/sysinfo.$$.pmap
4363 print -- "-----------------------" >> /tmp/sysinfo.$$.pmap
4365 Debug " calling check_if_scan_done"
4366 check_if_scan_done io_scan
4367 print -n "scanning physical disks "
4369 #get physical disk names
4370 if (( $osmajor >= 10 ))
4372 Debug "Found 10.x system"
4373 # hw_path=$(ioscan -kfC disk | sed '1,/^=/d' | awk '{print $3}')
4374 hw_path=$(grep disk $io_scan_out | awk -F: '{print $11}' | sort)
4375 Debug "hw_path=$hw_path"
4376 for hwpath in ${hw_path}
4378 Debug "hwpath=${hwpath}"
4381 tmpin=$(echo $hwpath | cut -d. -f1)
4382 ### Changed 6/15/99 J.Semroc - to improve Performance reuse existing data
4383 ### inst=$(ioscan -kf | grep "^ext_bus" | grep " ${tmpin} " \
4384 ### | grep -v fcpdev | awk '{print $2}')
4385 inst=$(grep $hwpath $io_scan_out | grep disk | awk '{print $NF}' \
4388 #scsi_addr=$(echo $hwpath | cut -d. -f2)
4389 #unit_addr=$(echo $hwpath | cut -d. -f3)
4390 #physvol="/dev/dsk/c${inst}t${scsi_addr}d${unit_addr}"
4391 #rphysvol="/dev/rdsk/c${inst}t${scsi_addr}d${unit_addr}"
4392 #physvol=$(ioscan -kfnH ${hwpath} | awk ' BEGIN {FS=" "; RS=" "} /dev\/dsk/ {printf("%s", $1)}')
4393 #rphysvol=$(ioscan -kfnH ${hwpath} | awk ' BEGIN {FS=" "; RS=" "} /dev\/rdsk/ {printf("%s", $1)}')
4394 #block_major=$(grep "$hwpath" $io_scan_out | grep disk | awk -F: '{print $6}')
4395 #char_major=$(grep "$hwpath" $io_scan_out | grep disk | awk -F: '{print $7}')
4396 #block_minor=$(grep "$hwpath" $io_scan_out | grep disk | awk -F: '{print $8}')
4397 #Debug " block_major = ${block_major}"
4398 #Debug " char_major = ${char_major}"
4399 #Debug " block_minor = ${block_minor}"
4401 scsi_addr=$(echo $hwpath | awk -F. '{print $(NF-1)}')
4402 unit_addr=$(echo $hwpath | awk -F. '{print $NF}')
4403 physvol="/dev/dsk/c${inst}t${scsi_addr}d${unit_addr}"
4404 rphysvol="/dev/rdsk/c${inst}t${scsi_addr}d${unit_addr}"
4406 Debug "Physical volume ${physvol}"
4407 Debug " tmpin=${tmpin}"
4408 Debug " inst=${inst} scsi_addr=${scsi_addr} unit_addr=${unit_addr}"
4410 XP256=$(grep ${hwpath} ${io_scan_out} | weed_targets | awk -F: '{print $18}')
4411 if [[ ${XP256} = *OPEN* ]]
4414 if [[ -f /usr/contrib/bin/inquiry256 ]]
4416 inqcmd="/usr/contrib/bin/inquiry256"
4418 inqcmd="${where}/inquiry256"
4420 Debug "XP256 disc array found! ${XP256} ${hwpath}"
4421 Debug "inqcmd=${inqcmd}"
4422 info=$(diskinfo -v ${rphysvol} 2>&1)
4424 *"No such file or directory"* )
4425 Debug " diskinfo reports No such file or directory on $physvol"
4427 # awk -F"+" '{printf("%55s\n"),$1}' \
4428 # >> /tmp/sysinfo.$$.inq256
4430 print "$rphysvold No such file or directory" \
4431 >> /tmp/sysinfo.$$.inq256
4433 *"No such device or address"* )
4434 Debug " diskinfo reports No such device or address on $physvol"
4436 # awk -F"+" '{printf("%55s\n"),$1}' \
4437 # >> /tmp/sysinfo.$$.inq256
4439 print "$rphysvold No such device or address" \
4440 >> /tmp/sysinfo.$$.inq256
4443 Debug " found a device (no diskinfo error)...so follow it"
4444 Inq=$(${inqcmd} ${rphysvol} 2>&1 )
4445 psize=$(echo $info | sed -e 's/^.*size: //' -e 's/ .*$//')
4446 psize_mb=$(expr ${psize} / 1024)
4447 product1=$(echo $info | sed -e 's/^.*product id: //' -e 's/ .*$//')
4448 echo "$Inq+$product1+$psize_mb" | \
4449 awk -F"+" '{printf("%55s%16s%8s\n"),$1,$2,$3}' \
4450 >> /tmp/sysinfo.$$.inq256
4456 *C1300* | *C2300* | *C3400* )
4457 Debug " found an Nike disk array at $hwpath"
4462 Debug " found a Cascade disk array at $hwpath"
4466 *C5447A* | *C3586A* )
4467 # C5447A is 12H C3586A is 12
4468 Debug " found a AutoRaid disk array at $hwpath"
4473 Debug " found a FC60 disk array at $hwpath"
4478 Debug " found a jbod disk at $hwpath"
4485 # Run pvdisplay to get the disk information
4486 pvdisplay -v ${physvol} > /tmp/sysinfo.$$.pvdisp 2>&1
4487 # Check for alternate link so that we don't try to access it
4488 Debug " Checking if this is an alternate link"
4489 grep "Using Primary Link" /tmp/sysinfo.$$.pvdisp > /dev/null 2>&1
4491 if ((detect_alt_link == 0))
4493 Debug " this IS an alternate link, so skip"
4495 elif [[ "${rphysvol}" = "" ]] then
4496 Debug " no physvol found for $hwpath"
4497 if ((! (($exit_code)) ))
4501 print "WARNING (${sysname}):No device file found for $hwpath" >> \
4502 /tmp/sysinfo.$$.errwarn
4504 Debug " this is NOT an alternate link, so query disk"
4505 hwpathd=${hwpath} # for display purposes
4506 #info=$(diskinfo -v /dev/rdsk/c${inst}t${scsi_addr}d${unit_addr} 2>&1)
4507 info=$(diskinfo -v ${rphysvol} 2>&1)
4508 Debug "info= ${info}"
4511 Debug " diskinfo reports Device Busy Error on $rphysvol"
4512 lu=$(grep ${hwpath} $io_scan_out | grep -v target \
4514 vendor1=$(ioscan -H $hwpath | tail -1 | awk '{print $3}')
4516 product1=$(ioscan -H $hwpath | tail -1 | awk '{print $NF}')
4518 print "${physvol}${lu}${hwpathd} ${vendor}${product}" \
4519 >> /tmp/sysinfo.$$.physinfo
4520 Debug " ${physvol}${lu}${hwpathd}${vendor}${product}"
4522 *"No such file or directory"* )
4523 Debug " diskinfo reports No such file or directory on $physvol"
4525 vendor1=$(ioscan -H $hwpath | tail -1 | awk '{print $3}')
4527 product1=$(ioscan -H $hwpath | tail -1 | awk '{print $NF}')
4529 print "${physvol}${lu}${hwpathd} ${vendor}${product}" \
4530 >> /tmp/sysinfo.$$.physinfo
4532 *"No such device or address"* )
4533 Debug " diskinfo reports No such device or address on $physvol"
4535 vendor1=$(ioscan -H $hwpath | tail -1 | awk '{print $3}')
4537 product1=$(ioscan -H $hwpath | tail -1 | awk '{print $NF}')
4539 print "${physvol}${lu}${hwpathd} ${vendor}${product}" \
4540 >> /tmp/sysinfo.$$.physinfo
4543 Debug " found a device (no diskinfo error)...so follow it"
4545 #lu=$(grep ${hwpath} $io_scan_out | grep -v target | awk '{print $2}')
4546 ### Changed 6/15/99 J.Semroc - to improve Performance reuse existing data
4547 ### lu=$(ioscan -kfCdisk | grep "${hwpath}" | awk '{print $2}')
4548 lu=$(grep ${hwpath} $io_scan_out | grep -v target | grep disk | \
4549 awk -F: '{print $13}')
4552 ludebug=$(grep ${hwpath} $io_scan_out | grep -v target )
4553 Debug "ludebug= ${ludebug}"
4554 psize=$(echo $info | sed -e 's/^.*size: //' -e 's/ .*$//')
4555 psize_mb=$(expr ${psize} / 1024)
4556 product1=$(echo $info | sed -e 's/^.*product id: //' -e 's/ .*$//')
4558 vendor1=$(echo $info | sed -e 's/^.*vendor: //' -e 's/ .*$//')
4560 rev_level=$(echo $info | sed -e 's/^.*rev level: //' -e 's/ .*$//')
4561 #rev_level=$(echo $info | grep "rev level" \
4562 # | awk '{print $3}')
4564 if [[ "${product1}" != "CD-ROM" ]] && [[ "${product1}" != "DVD-ROM" ]]
4566 ((total_p_mb=total_p_mb + psize_mb))
4567 ((pcount=pcount + 1))
4569 Debug " vendor1=$vendor1"
4570 Debug " product=$product"
4571 Debug " rev_level=$rev_level"
4572 Debug " psize=$psize"
4573 Debug " psize_mb=$psize_mb"
4575 # check for bootable disk
4577 Debug " Checking for Bootable PV"
4578 lifls ${physvol} 2> /dev/null | grep -i isl > /dev/null 2>&1
4581 Debug " Found Bootable PV at ${physvol}"
4583 lifls ${rphysvol} | grep AUTO > /dev/null 2>&1
4586 Debug " Found auto_string=$auto_string"
4587 auto_string=$(lifcp ${rphysvol}:AUTO -)
4588 print "${physvol}${hwpathd} ${auto_string}" >> \
4589 /tmp/sysinfo.$$.boot
4591 Debug " Did not find auto_string."
4594 Debug " Did not find Bootable PV on ${physvol}"
4597 if grep "find the volume group" /tmp/sysinfo.$$.pvdisp > /dev/null
4599 Debug " NON-LVM /dev/dsk/c${inst}t${scsi_addr}d${unit_addr}"
4600 Debug " id as::${vendor}${product}${psize_mb} Mbytes."
4602 elif grep "path does not correspond" /tmp/sysinfo.$$.pvdisp > /dev/null
4604 Debug "Specified path not found! ${rphysvol}"
4607 ### Changed 6/15/99 J.Semroc - to improve Performance reuse existing data
4608 ### lu=$(ioscan -kfCdisk | grep " ${hwpath}" | awk '{print $2}')
4609 lu=$(grep ${hwpath} $io_scan_out | grep -v target | grep disk | \
4610 awk -F: '{print $13}')
4612 if [[ "${vendor1}" = "EMC" ]] # && ((detect_alt_link == 0))
4615 ### Correction 6/15/99 J.Semroc - physvol was misspelled
4616 Debug " Found EMC at ${physvol}."
4617 Debug " detect_alt_link = ${detect_alt_link}"
4618 bblvols=$(pvdisplay -v ${physvol} | \
4619 awk ' /current/ {print $3}' | sort | uniq | \
4621 for bblvol in $bblvols
4623 bblock=$(lvdisplay $bblvol | awk ' /Bad block/ {print $3}')
4624 Debug " bblvol= $bblvol"
4625 Debug " bblock= $bblock"
4626 if [[ "${bblock}" != "NONE" ]]
4628 if ((! (($exit_code)) ))
4632 print "WARNING (${sysname}):EMC w/ LVM bad block enabled on ${bblvol}" >> /tmp/sysinfo.$$.errwarn
4638 Debug " Begin PHYSICAL TO LOGICAL Mapping"
4640 if (($osmajor == 11))
4642 # PVdisplay looks different on 10.20 (MWR)
4643 alt_link=$(grep "^PV Name" /tmp/sysinfo.$$.pvdisp | \
4644 grep "Alternate Link" | awk '{printf "%s ", $3}' )
4645 Debug " =11 alt_link=$alt_link"
4646 elif (($osmajor == 10)) && (($osminor >= 20))
4648 # PVdisplay looks different on 10.20 (MWR)
4649 alt_link=$(grep "^PV Name" /tmp/sysinfo.$$.pvdisp | \
4650 grep "Alternate Link" | awk '{printf "%s ", $3}' )
4651 Debug " >=10.20 alt_link=$alt_link"
4654 alt_link=$(grep "^ PV Name" /tmp/sysinfo.$$.pvdisp | \
4655 grep "Alternate Link" | awk '{printf "%s ", $3}' )
4656 Debug " <10.20 alt_link=$alt_link"
4658 if [ "$alt_link" = "" ]
4662 Debug " alt_link=$alt_link"
4663 print "${physvol} ${alt_link}" \
4664 >> /tmp/sysinfo.$$.pmap
4665 sed '1,15d;/current/d;/Status/d;/free/d;' \
4666 /tmp/sysinfo.$$.pvdisp | \
4667 sed '/^$/d;/---/d;/LV/d; s/\/dev/ \/dev/' \
4668 >> /tmp/sysinfo.$$.pmap
4671 print -n "${physvol}${lu}${hwpathd} ${vendor}${product}" >> \
4672 /tmp/sysinfo.$$.physinfo
4673 print " ${psize_mb} ${bootable_pv}" >> \
4674 /tmp/sysinfo.$$.physinfo
4679 done # end of hwpath loop
4680 # end of 10.x system
4682 Debug "must be a 9.x system"
4683 pvol=$(vgdisplay -v 2>&1 | grep "^ PV Name" | grep -v "Alternate Link" \
4684 | sort | awk '{printf "%s ", $3}' )
4685 ioscan -kfCdisk | sort > /tmp/sysinfo.$$.io_disk
4686 #now force access to disks.
4687 for physvol in ${pvol} # loop through all phys vols
4689 hwpath=$(lssf ${physvol} | awk '{printf "%s ", $(NF -1)}')
4690 hwpathd=${hwpath} # for display purposes
4691 disktype=$(echo ${physvol} | sed s/dsk/rdsk/)
4692 diskinfo -v ${disktype} > /tmp/sysinfo.$$.diskinfo 2>&1
4695 print "ERROR:${sysname}: diskinfo reports an error on ${physvol}."
4696 >> /tmp/sysinfo.$$.errwarn
4697 exit_code=${SYS_ERROR}
4699 vendor=$(grep "vendor" /tmp/sysinfo.$$.diskinfo \
4700 | awk '{printf "%s ", $2}')
4701 product1=$(grep "product id" /tmp/sysinfo.$$.diskinfo \
4702 | awk '{printf "%s ", $3}')
4703 type=$(grep "type" /tmp/sysinfo.$$.diskinfo \
4705 psize=$(grep "size" /tmp/sysinfo.$$.diskinfo \
4706 | awk '{printf "%s ", $2}')
4707 psize_mb=$(expr ${psize} / 1024)
4708 lu=$(grep " ${hwpath}" /tmp/sysinfo.$$.io_disk | awk '{print $2}')
4709 rev_level=$(grep "rev level" /tmp/sysinfo.$$.diskinfo \
4712 if [[ "${product1}" != "CD-ROM" ]] && [[ "${product1}" != "DVD-ROM" ]]
4714 ((total_p_mb=total_p_mb + psize_mb))
4715 ((pcount=pcount + 1))
4719 pvdisplay -v ${physvol} > /tmp/sysinfo.$$.pvdisp 2>&1
4721 alt_link=$(grep "^ PV Name" /tmp/sysinfo.$$.pvdisp | \
4722 grep "Alternate Link" | awk '{printf "%s ", $3}' )
4723 #alt_link="/dev/dsk/cxtxdx"
4724 if [ "$alt_link" = "" ]
4728 print "${physvol} ${alt_link}" \
4729 >> /tmp/sysinfo.$$.pmap
4730 sed '1,15d;/current/d;/Status/d;/free/d;' /tmp/sysinfo.$$.pvdisp | \
4731 sed '/^$/d;/---/d;/LV/d; s/\/dev/ \/dev/' \
4732 >> /tmp/sysinfo.$$.pmap
4734 Debug "\ndisktype=$disktype"
4735 Debug "hwpath=$hwpath"
4736 Debug "vendor=$vendor"
4737 Debug "product=$product"
4738 Debug "psize=$psize"
4739 Debug "psize_mb=$psize_mb"
4742 Debug "total_p_mb=$total_p_mb"
4743 Debug "pcount=$pcount"
4744 Debug "rev_level=$rev_level"
4745 Debug "alt_link=$alt_link"
4747 print "${physvol}${lu}${hwpathd}${vendor}${product}${psize_mb}" >> /tmp/sysinfo.$$.physinfo
4752 print " Rev" > /tmp/sysinfo.$$.disk_rev
4753 print " HW Path Level Serial Number LUN" \
4754 >> /tmp/sysinfo.$$.disk_rev
4755 print " --------------------- ----- --------------------- ----" \
4756 >> /tmp/sysinfo.$$.disk_rev
4758 if (( ${cstm_ok} == 0 ))
4761 /Hardware path/ {path = $3; next;}
4762 /Product Id/ {prod = $3; vend = $NF; next;}
4763 /Firmware Rev/ {fw = $NF; next;}
4764 /Logical Unit/ {lu = $NF; next;}
4765 /Serial Number/ {sn = $3; next;}
4766 /Capacity/ {cap = $NF; printf("%24s %8s %24s %6s\n",
4767 path,fw,sn,lu);}' $cstm_disk_out >> /tmp/sysinfo.$$.disk_rev
4768 print "" >> /tmp/sysinfo.$$.disk_rev
4773 Debug "calling EMC query routine"
4778 # check for boot path settings
4780 if [[ -f /usr/sbin/setboot ]]
4782 pri_boot_path=$(/usr/sbin/setboot | grep Primary | awk '{print $4}')
4783 alt_boot_path=$(/usr/sbin/setboot | grep Alternate | awk '{print $4}')
4784 auto_boot=$(/usr/sbin/setboot | grep Autoboot | awk '{print $3}')
4785 auto_search=$(/usr/sbin/setboot | grep Autosearch | awk '{print $3}' )
4786 print "" >> /tmp/sysinfo.$$.boot
4787 print "Primary Boot Path = ${pri_boot_path}" >> /tmp/sysinfo.$$.boot
4788 print "Alternate Boot Path = ${alt_boot_path}" >> /tmp/sysinfo.$$.boot
4789 print "Autoboot = ${auto_boot}" >> /tmp/sysinfo.$$.boot
4790 print "Autosearch = ${auto_search}" >> /tmp/sysinfo.$$.boot
4792 print "\n" >> /tmp/sysinfo.$$.boot
4794 # now print out totals
4795 ### Changed 6/16/99 J.Semroc sort LU numerically
4796 ### sort -k2. -o /tmp/sysinfo.$$.physinfos /tmp/sysinfo.$$.physinfo
4797 sort -k2n -o /tmp/sysinfo.$$.physinfos /tmp/sysinfo.$$.physinfo
4799 rm -f /tmp/sysinfo.$$.physinfo 2>&1
4801 # print "" >> /tmp/sysinfo.$$.physinfoh
4802 print -n " " >> /tmp/sysinfo.$$.physinfoh
4803 print " Size" >> /tmp/sysinfo.$$.physinfoh
4804 print -n " Volume Name LU# " >> /tmp/sysinfo.$$.physinfoh
4805 print " H/W Path Vendor / Model (MB) B" >> /tmp/sysinfo.$$.physinfoh
4806 print -n " -------------- --- " >> /tmp/sysinfo.$$.physinfoh
4807 print " ---------------- -------------------- ------ -" >> /tmp/sysinfo.$$.physinfoh
4808 print " ======" >> /tmp/sysinfo.$$.physinfot
4809 print -n " Total (MB)" >> /tmp/sysinfo.$$.physinfot
4810 print " ${total_p_mb}" >> /tmp/sysinfo.$$.physinfot
4811 ### Changed 6/15/99 J.Semroc - generated the following error
4812 ### "cat: Cannot use /tmp/sysinfo.14950.physinfod as both input and output."
4813 ### cat /tmp/sysinfo.$$.physinfo? > /tmp/sysinfo.$$.physinfod
4814 cat /tmp/sysinfo.$$.physinfo? > /tmp/sysinfo.$$.PHYSINFOD
4815 mv /tmp/sysinfo.$$.PHYSINFOD /tmp/sysinfo.$$.physinfod
4817 print "B = Bootable Disk" >> \
4818 /tmp/sysinfo.$$.physinfod
4819 print "n/v = Not Valid, n/f = Not Found\n" >> \
4820 /tmp/sysinfo.$$.physinfod
4821 f_display_file /tmp/sysinfo.$$.physinfod
4822 print "" >> /tmp/sysinfo.$$.physwarn
4823 f_display_file /tmp/sysinfo.$$.physwarn
4824 f_display_file /tmp/sysinfo.$$.disk_rev
4825 if [[ -f /tmp/sysinfo.$$.inq256 ]]
4827 f_display_file /tmp/sysinfo.$$.256header
4828 print "" >> /tmp/sysinfo.$$.inq256
4829 f_display_file /tmp/sysinfo.$$.inq256
4832 if [[ -f /tmp/sysinfo.$$.array ]]
4834 f_display_file /tmp/sysinfo.$$.arrayheader
4835 print "\n\n" >> /tmp/sysinfo.$$.array
4836 f_display_file /tmp/sysinfo.$$.array
4839 f_display_file /tmp/sysinfo.$$.boot
4842 f_display_file /tmp/sysinfo.$$.pmap
4845 } # end of f_get_physical_disk_data
4847 #===================================================================
4849 #===================================================================
4850 function f_get_ioscan_data
4852 Debug " calling check_if_scan_done"
4853 check_if_scan_done io_scan
4854 GREP_V_ARGS="-eboot_console $GREP_V_ARGS"
4857 print "</PRE>" >> /tmp/sysinfo.$$.ioout
4858 print "<A NAME='IO'></A>" >> /tmp/sysinfo.$$.ioout
4859 print "<H2>" >> /tmp/sysinfo.$$.ioout
4860 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.ioout
4861 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.ioout
4862 print "I/O Configuration Data</H2>" >> /tmp/sysinfo.$$.ioout
4863 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.ioout
4865 print "I/O CONFIGURATION DATA" >> /tmp/sysinfo.$$.ioout
4866 print "======================" >> /tmp/sysinfo.$$.ioout
4868 print "" >> /tmp/sysinfo.$$.ioout
4869 print " H/W Path Driver Identifier String" >>/tmp/sysinfo.$$.ioout
4870 print " -------- ------ -----------------" >>/tmp/sysinfo.$$.ioout
4872 Debug " `cat ${io_scan_out}`"
4873 if (( ${osmajor} >= 10 ))
4875 Debug "found 10.x or later"
4876 Debug "sending $io_scan_out to formatter"
4877 Debug " GREP_V_ARGS = $GREP_V_ARGS"
4879 cat $io_scan_out | weed_targets | formatter | \
4880 grep -F -v $GREP_V_ARGS >> /tmp/sysinfo.$$.ioout
4883 cp ${io_scan_out} /tmp/sysinfo.$$.ioout
4885 Debug " `cat /tmp/sysinfo.$$.ioout`"
4888 print "" >>/tmp/sysinfo.$$.ioout
4889 f_display_file /tmp/sysinfo.$$.ioout
4891 } # end of f_get_ioscan_data
4893 #===================================================================
4894 # f_get_volume_group_data
4895 # This function retrieves volume group data using vgdisplay
4896 # and by scannig /etc/lvmconf for config files.
4897 #===================================================================
4898 function f_get_volume_group_data
4900 Debug "Beginning VOLUME GROUP check."
4901 # first print header information
4905 print "</PRE>" >> /tmp/sysinfo.$$.vginfoh
4906 print "<A NAME='Volume'></A>" >> /tmp/sysinfo.$$.vginfoh
4907 print "<H2>" >> /tmp/sysinfo.$$.vginfoh
4908 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.vginfoh
4909 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.vginfoh
4910 print "Volume Group Data</H2>" >> /tmp/sysinfo.$$.vginfoh
4911 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.vginfoh
4913 print >> /tmp/sysinfo.$$.vginfoh
4914 print "VOLUME GROUP DATA" >> /tmp/sysinfo.$$.vginfoh
4915 print "=================" >> /tmp/sysinfo.$$.vginfoh
4917 Debug " calling check_if_scan_done"
4918 check_if_scan_done lvm_scan
4920 vgdisplay -v > /tmp/sysinfo.$$.vgout 2>&1
4921 #MWR fix when PVG-strict policies used
4922 #all_volgroups=$(grep "VG Name" /tmp/sysinfo.$$.vgout | awk '{print $3}' | sort)
4923 all_volgroups=$(grep -v "PVG Name" /tmp/sysinfo.$$.vgout | \
4924 grep "VG Name" | awk '{print $3}' | sort)
4925 all_logvols=$(grep "LV Name" /tmp/sysinfo.$$.vgout | awk '{print $3}' | sort)
4926 #Debug "all_volgroups=\n$all_volgroups"
4927 #Debug "all_logvols=\n$all_logvols"
4929 print -n "scanning volume groups "
4930 for volgroup in ${all_volgroups}
4932 Debug "Volumegroup = $volgroup"
4933 vgdisplay $volgroup > /tmp/sysinfo.$$.volgroup 2>&1
4934 #Debug "vgdisplay=\n`cat /tmp/sysinfo.$$.volgroup`"
4935 ((vgcount=vgcount + 1))
4936 CURLV=$(grep "Cur LV" /tmp/sysinfo.$$.volgroup | awk '{print $3}')
4937 CURPV=$(grep "Cur PV" /tmp/sysinfo.$$.volgroup | awk '{print $3}')
4938 AllocPe=$(grep "Alloc PE" /tmp/sysinfo.$$.volgroup | awk '{print $3}')
4939 FreePe=$(grep "Free PE" /tmp/sysinfo.$$.volgroup | awk '{print $3}')
4940 TotalPe=$(grep "Total PE" /tmp/sysinfo.$$.volgroup | awk '{print $3}')
4941 PeSize=$(grep "PE Size" /tmp/sysinfo.$$.volgroup | awk '{print $4}')
4942 ((AllocMb = AllocPe * PeSize))
4943 ((FreeMb = FreePe * PeSize))
4944 ((TotalMb = TotalPe * PeSize))
4945 ((TotalAllocMb = TotalAllocMb + AllocMb))
4946 ((TotalFreeMb = TotalFreeMb + FreeMb))
4947 ((SystemTotalMb = SystemTotalMb + TotalMb))
4948 Debug " Physical Extent Size = ${PeSize}"
4949 Debug " Number of Allocated Physical Extents = ${AllocPe}"
4950 Debug " Free Physical Extents = ${FreePe}"
4951 Debug " Total Physical Extents = ${TotalPe}"
4952 Debug " Allocated Mb = ${AllocMb}"
4953 Debug " Free Mb = ${FreeMb}"
4954 Debug " Total Mb = ${TotalMb}"
4955 Debug " Total Allocated Mb = ${TotalAllocMb}"
4956 Debug " Total Free Mb = ${TotalFreeMb}"
4957 Debug " System Total Mb = ${SystemTotalMb}"
4959 print -n "${volgroup}${CURLV}${CURPV}${PeSize}" >> /tmp/sysinfo.$$.vginfos
4960 print "${AllocMb}${FreeMb}${TotalMb}" >> /tmp/sysinfo.$$.vginfos
4963 Debug "Checking for vgcount = maxvgs"
4966 maxvgs=$(echo 'maxvgs/D'|adb -k $kernel /dev/kmem \
4967 | tail -1 | awk '{print $2}')
4969 Debug " vgcount = $vgcount"
4970 Debug " maxvgs = $maxvgs"
4971 if ((vgcount == maxvgs))
4973 if ((! (($exit_code)) ))
4977 print "WARNING (${sysname}): number of volume groups is at maximum."\
4978 >> /tmp/sysinfo.$$.errwarn
4981 # now check for a cfg backup file for each volume group.
4983 print -n "scanning config files "
4984 Debug "Checking vg config files"
4985 for volgroup in ${all_volgroups}
4987 Debug " volgroup ${volgroup}"
4988 vg=$(echo ${volgroup} | awk -F/ '{print $3}')
4990 if [ -f /etc/lvmconf/${vg}.conf ]
4992 # this is a kludge. if file is less than 6 months old then
4993 # ls -l prints the time, so scan for a colon.
4994 ls -l /etc/lvmconf/${vg}.conf | awk '{print $8}' | grep ":" > /dev/null
4997 if ((! (($exit_code)) ))
5001 print "WARNING (${sysname}): vgconfig file > 6 months old for /etc/lvmconf/${vg}.conf"\
5002 >> /tmp/sysinfo.$$.errwarn
5005 if ((! (($exit_code)) ))
5009 print -n "WARNING (${sysname}): no config " >> /tmp/sysinfo.$$.errwarn
5010 print "file found for volume group ${vg}." >> /tmp/sysinfo.$$.errwarn
5011 if ((! (($exit_code)) ))
5018 f_display_file /tmp/sysinfo.$$.novgcfg
5019 print "" >> /tmp/sysinfo.$$.vginfoh
5020 print " Volume Logical Physical Extent MBs of Physical Space" >> /tmp/sysinfo.$$.vginfoh
5021 print " Group Volumes Volumes Size(MB) Alloc Free Total" >> /tmp/sysinfo.$$.vginfoh
5022 print " --------- ------- -------- ------ ----- ---- -----" >> /tmp/sysinfo.$$.vginfoh
5023 print " ===== ==== =====" >> /tmp/sysinfo.$$.vginfot
5024 print -n " Totals " >> /tmp/sysinfo.$$.vginfot
5025 print "${TotalAllocMb}${TotalFreeMb}${SystemTotalMb}" >> /tmp/sysinfo.$$.vginfot
5026 cat /tmp/sysinfo.$$.vginfo? > /tmp/sysinfo.$$.vginfod
5027 f_display_file /tmp/sysinfo.$$.vginfod
5029 } # end of f_get_volume_group_data
5031 #===================================================================
5032 # f_get_logical_volume_data
5033 # This function uses lvdisplay to scan logical volumes.
5034 # It retrieves information about the logvol and also checks
5035 # for stale mirrors (if used).
5036 #===================================================================
5037 function f_get_logical_volume_data
5039 Debug "Beginning LOGICAL DISK check."
5040 # first print out header information
5044 print "</PRE>" >> /tmp/sysinfo.$$.lvinfoh
5045 print "<A NAME='Logical'></A>" >> /tmp/sysinfo.$$.lvinfoh
5046 print "<H2>" >> /tmp/sysinfo.$$.lvinfoh
5047 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.lvinfoh
5048 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.lvinfoh
5049 print "Logical Volume And Extent Data</H2>" >> /tmp/sysinfo.$$.lvinfoh
5050 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.lvinfoh
5052 print >> /tmp/sysinfo.$$.lvinfoh
5053 print "LOGICAL VOLUME AND EXTENT DATA" >> /tmp/sysinfo.$$.lvinfoh
5054 print "==============================" >> /tmp/sysinfo.$$.lvinfoh
5056 Debug " calling check_if_scan_done"
5057 check_if_scan_done lvm_scan
5059 print -n "scanning logical volumes "
5060 if [[ ! -f /tmp/sysinfo.$$.vgout ]]
5062 vgdisplay -v > /tmp/sysinfo.$$.vgout 2>&1
5063 all_volgroups=$(grep "VG Name" /tmp/sysinfo.$$.vgout | awk '{print $3}' | sort)
5064 all_logvols=$(grep "LV Name" /tmp/sysinfo.$$.vgout | awk '{print $3}' | sort)
5066 for logvol in ${all_logvols}
5068 Debug "lvdisplay of ${logvol}"
5069 lvol_major=$(ls -l $logvol | awk '{print $5}')
5070 lvol_minor=$(ls -l $logvol | awk '{print $6}')
5071 Debug " major= $lvol_major minor=$lvol_minor"
5072 lvdisplay -v ${logvol} > /tmp/sysinfo.$$.logical 2>&1
5073 STATUS=$(grep "LV Status" /tmp/sysinfo.$$.logical | awk '{print $3}')
5074 LVSize=$(grep "LV Size" /tmp/sysinfo.$$.logical | awk '{print $4}')
5075 LogicalExtents=$(grep "Current LE" /tmp/sysinfo.$$.logical \
5077 StaleExtents=$(grep stale /tmp/sysinfo.$$.logical | wc -l)
5078 MirrorCopies=$(grep "Mirror copies" /tmp/sysinfo.$$.logical \
5080 Consistency=$(grep "Consistency Recovery" /tmp/sysinfo.$$.logical \
5084 ((total_l_mb = total_l_mb + LVSize))
5085 ((MirrorMb = LVSize * MirrorCopies))
5086 ((TotalMirrorMb = TotalMirrorMb + MirrorMb))
5088 # check to make sure lvol has extents allocated to it
5089 if (( $LogicalExtents > 0 ))
5091 ### Changed 6/15/99 J.Semroc - grep for lvol1 would also match lvol10, lvol11...
5092 ### MOUNT=$(cat /etc/mnttab | grep ${logvol} | cut -f 2 -d" ")
5093 MOUNT=$(cat /etc/mnttab | grep "${logvol} " | cut -f 2 -d" ")
5095 if [[ ${swap_devs} = *${logvol}* ]]
5099 ((lcount=lcount + 1))
5100 if (( ${StaleExtents} > 0 )) # we found stale extents
5102 Debug " Found ${StaleExtents} STALE extents on ${logvol}!"
5104 ((StaleMB = (LVSize / LogicalExtents) * StaleExtents ))
5105 ((TotalStaleMb = TotalStaleMb + StaleMB))
5106 ((total_stale = $total_stale + $StaleExtents))
5107 fi # end of stale extents
5108 else # no extents allocated
5109 if ((! (($exit_code)) ))
5114 print -n "\nWARNING (${sysname}): Detected logical " >> /tmp/sysinfo.$$.errwarn
5115 print "volume (${logvol}) with no extents!\n" >> /tmp/sysinfo.$$.errwarn
5116 fi # end of check for allocated extents
5117 Debug " STATUS= ${STATUS}"
5118 Debug " LVSize= ${LVSize}"
5119 Debug " LogicalExtents = ${LogicalExtents}"
5120 Debug " StaleExtents = ${StaleExtents}"
5121 Debug " StaleMb= $StaleMB"
5122 Debug " TotalStaleMb= $TotalStaleMb "
5123 Debug " TotalMb checked= $total_l_mb"
5125 # now let's print out the results.
5127 logvold=${logvol} # for display purposes only.
5128 print "${logvold}${MOUNT}" >> /tmp/sysinfo.$$.lvinfos
5129 #print "${LogicalExtents}${StaleExtents}" >> /tmp/sysinfo.$$.lvinfos
5130 #print "${MirrorCopies}${Consistency}" >> /tmp/sysinfo.$$.lvinfos
5132 # end of loop for all log vols
5133 # now print out any errors or warnings.
5134 f_display_file /tmp/sysinfo.$$.nolvext
5135 # print "" >> /tmp/sysinfo.$$.lvinfoh
5136 print " " >> /tmp/sysinfo.$$.lvinfoh
5137 print -n " Volume Name " >> /tmp/sysinfo.$$.lvinfoh
5138 print "Mounted File System" >> /tmp/sysinfo.$$.lvinfoh
5139 print -n " -------------- " >> /tmp/sysinfo.$$.lvinfoh
5140 print -- "--------------------" >> /tmp/sysinfo.$$.lvinfoh
5141 print "" >> /tmp/sysinfo.$$.lvinfos
5142 cat /tmp/sysinfo.$$.lvinfo? > /tmp/sysinfo.$$.lvinfod
5143 f_display_file /tmp/sysinfo.$$.lvinfod
5145 print "\nAllocation" > /tmp/sysinfo.$$.lvol_legend
5146 print -n " ns non-strict " >> /tmp/sysinfo.$$.lvol_legend
5147 print "PVG-s PVG-strict " >> /tmp/sysinfo.$$.lvol_legend
5148 print -n " ns-c non-strict/contiguous " >> /tmp/sysinfo.$$.lvol_legend
5149 print "PVG-c PVG-strict/contiguous" >> /tmp/sysinfo.$$.lvol_legend
5150 print -n " s strict " >> /tmp/sysinfo.$$.lvol_legend
5151 print "PVG-d PVG-strict/distributed " >> /tmp/sysinfo.$$.lvol_legend
5152 print -n " s-c strict/contiguous " >> /tmp/sysinfo.$$.lvol_legend
5153 print "PVG-p PVG-strict/partially-distributed" >> /tmp/sysinfo.$$.lvol_legend
5154 print "" >> /tmp/sysinfo.$$.lvol_legend
5157 # display using data from batch lvm_scan
5158 print "" > /tmp/sysinfo.$$.lvinfoh
5159 print -n " " >> /tmp/sysinfo.$$.lvinfoh
5160 print " Bad" >> /tmp/sysinfo.$$.lvinfoh
5161 print -n " " >> /tmp/sysinfo.$$.lvinfoh
5162 print " Size Stripes Mirrors LV Block" >> /tmp/sysinfo.$$.lvinfoh
5163 print -n " Volume Name " >> /tmp/sysinfo.$$.lvinfoh
5164 print " (MB) # Size # Const State Reloc Alloc" >> /tmp/sysinfo.$$.lvinfoh
5165 print -n " -------------- " >> /tmp/sysinfo.$$.lvinfoh
5166 print " ----- ------- --------- ----- ----- -----" >> /tmp/sysinfo.$$.lvinfoh
5167 f_display_file /tmp/sysinfo.$$.lvinfoh
5168 f_display_file $lvol_out_file
5169 f_display_file /tmp/sysinfo.$$.lvol_legend
5175 } # end of f_get_logical_volume_data
5178 #===================================================================
5179 # f_logical_to_physical
5180 # This function produces a cross reference of physical disks
5181 # for each logical volume.
5182 #===================================================================
5183 function f_logical_to_physical
5185 Debug "Beginning LOGICAL TO PHYSICAL Mapping."
5187 if [[ ! -f /tmp/sysinfo.$$.vgout ]]
5189 Debug "/tmp/sysinfo.$$.vgout not found....building."
5190 vgdisplay -v > /tmp/sysinfo.$$.vgout 2>&1
5191 all_logvols=$(grep "LV Name" /tmp/sysinfo.$$.vgout | awk '{print $3}' |sort)
5195 print "</PRE>" >> /tmp/sysinfo.$$.l2p
5196 print "<A NAME='Lmap'></A>" >> /tmp/sysinfo.$$.l2p
5197 print "<H2>" >> /tmp/sysinfo.$$.l2p
5198 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >> /tmp/sysinfo.$$.l2p
5199 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.l2p
5200 print "Logical Volume To Physical Disk Mapping</H2>" >> /tmp/sysinfo.$$.l2p
5201 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.l2p
5203 print "" >> /tmp/sysinfo.$$.l2p
5204 print "LOGICAL VOLUME TO PHYSICAL DISK MAPPING " >> /tmp/sysinfo.$$.l2p
5205 print "=========================================================" >> /tmp/sysinfo.$$.l2p
5207 print "Logical Volume" >> /tmp/sysinfo.$$.l2p
5208 print " extents Primary disk Mirror Disk 1 Mirror Disk 2" >> /tmp/sysinfo.$$.l2p
5209 print -- "---------------------------------------------------------" >> /tmp/sysinfo.$$.l2p
5210 print -n "generating disk mappings "
5212 for logvol in ${all_logvols}
5214 Debug " scanning ${logvol}"
5215 lvdisplay -v ${logvol} > /tmp/sysinfo.$$.logical 2>&1
5216 PhysicalDisks=$(awk '$1 ~ /\/dev\/dsk\/.*/ {printf "%s\n",$1}' \
5217 /tmp/sysinfo.$$.logical \
5218 | sed -e 's/\/dev\/dsk\///' | sort)
5219 # output physical disk data for each logical volume
5220 print "${logvol} " >> /tmp/sysinfo.$$.l2p
5221 # print -n " Disks = " >> /tmp/sysinfo.$$.l2p
5223 # count the number of physical disks found.
5225 for disk in ${PhysicalDisks}
5227 ((diskcount = diskcount + 1))
5228 Debug " disk = $disk"
5230 Debug " found $diskcount physical disks"
5231 lvdisplay -v $logvol | sed '1,/ LE/d' | awk '{print $2, $5, $8}' \
5232 | sort | grep "dev" | uniq -c | awk \
5233 '{printf "%6s %18s %16s %16s\n",$1,$2,$3,$4}' \
5234 >> /tmp/sysinfo.$$.l2p
5235 # print "" >> /tmp/sysinfo.$$.l2p
5238 print "" >> /tmp/sysinfo.$$.l2p
5239 f_display_file /tmp/sysinfo.$$.l2p
5242 } # end of f_logical_to_physical
5245 #===================================================================
5246 # f_filesystem_check
5247 # This function checks mounted filesystems and reports
5248 # capcity information. It prints warnings if greater than
5250 #===================================================================
5252 function f_filesystem_check
5254 Debug "Beginning FILE SYSTEM check."
5256 # first print out headers
5259 print "</PRE>" >> /tmp/sysinfo.$$.bdf_outh
5260 print "<A NAME='File'></A>" >> /tmp/sysinfo.$$.bdf_outh
5261 print "<H2>" >> /tmp/sysinfo.$$.bdf_outh
5262 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >>/tmp/sysinfo.$$.bdf_outh
5263 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.bdf_outh
5264 print "File System Data</H2>" >> /tmp/sysinfo.$$.bdf_outh
5265 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.bdf_outh
5267 print "" >> /tmp/sysinfo.$$.bdf_outh
5268 print "FILE SYSTEM DATA" >> /tmp/sysinfo.$$.bdf_outh
5269 print "================" >> /tmp/sysinfo.$$.bdf_outh
5271 print -n "scanning filesystems "
5273 typeset -R10 kbytes used avail iused ifree
5274 typeset -R5 percent_used
5275 mnttab=$(cat /etc/mnttab | grep /dev | awk '{printf "%s\n", $2}')
5276 num_fs=$(bdf -il 2>&1 | grep "/dev/" | wc -l)
5277 ((num_fs = num_fs -1))
5278 Debug "Found $num_fs mounted file systems"
5279 # bdf -i | tail -${num_fs} > /tmp/sysinfo.$$.bdf_data 2>&1
5280 for mounted in ${mnttab}
5282 bdf -i ${mounted} 2>&1 | tail -1 > /tmp/sysinfo.$$.bdf_data 2>&1
5283 if ( grep "No such file" /tmp/sysinfo.$$.bdf_data >/dev/null 2>&1 )
5285 Debug " bdf reports No such file or directory on ${mounted}"
5286 print "WARNING (${sysname}): No such file or directory for ${mounted}" >> /tmp/sysinfo.$$.errwarn
5288 fs_type=$(cat /etc/mnttab | grep " ${mounted} " | awk '{printf "%s\n", $3}')
5289 Debug "filesys = ${mounted} fs_type = ${fs_type}"
5290 if [[ $fs_type = vxfs ]]
5292 mnt_lvol=$(cat /etc/mnttab | grep " ${mounted} " | awk '{printf "%s\n", $1}')
5293 fs_ver=$(fstyp -v ${mnt_lvol} 2>&1 | grep version | awk '{printf "%s\n", $2}')
5294 if [[ -f ${mounted}/lost+found/.fsadm ]]
5296 vxfs_defrag=$(fsadm -F vxfs -E ${mounted} | grep \
5297 "extents 64 blks or larger" | awk '{print $NF}')
5298 ((vxfs_frag = 100 - vxfs_defrag))
5301 Debug " ${mounted}/lost+found/.fsadm not found - no frag check"
5306 Debug "fs_ver = ${fs_ver} vxfs_frag = ${vxfs_frag}"
5307 if ( [[ $osmajor = 10 ]] && [[ $osminor > 10 ]] ) || [[ $osmajor = 11 ]]
5309 if [[ $fs_ver < 3 ]]
5311 Debug "Found vxfs version $fs_ver"
5312 print "WARNING (${sysname}): Version ${fs_ver} of vxfs found on ${mounted}" >> /tmp/sysinfo.$$.errwarn
5316 Debug " `cat /tmp/sysinfo.$$.bdf_data`"
5317 kbytes=$(awk '{if (NF == 9) print $2; else print $1}' /tmp/sysinfo.$$.bdf_data)
5318 used=$(awk '{if (NF == 9) print $3; else print $2}' /tmp/sysinfo.$$.bdf_data)
5319 if [[ $fs_type != "cdfs" ]]
5321 avail=$(awk '{if (NF == 9) print $4; else print $3}' /tmp/sysinfo.$$.bdf_data)
5322 iused=$(awk '{if (NF == 9) print $6; else print $5}' /tmp/sysinfo.$$.bdf_data)
5323 ifree=$(awk '{if (NF == 9) print $7; else print $6}' /tmp/sysinfo.$$.bdf_data)
5324 #((percent_used = (used * 100) / (used + avail) ))
5325 percent_used=$(echo $used $avail | \
5328 pct_used = ($1 * 100) / ($1 + $2)
5329 printf("%d", pct_used)
5332 if (($percent_used > 95)) && [[ $fs_type != "cdfs" ]]
5334 if ((! (($exit_code)) ))
5338 print "WARNING (${sysname}): ${mounted} has less than 5% free space left!" >> /tmp/sysinfo.$$.errwarn
5340 else #must be a cdrom, so don't calculate free space
5346 if [[ $fs_type != vxfs ]]
5351 print "${mounted}" >> /tmp/sysinfo.$$.bdf_outs
5352 # print " ${fs_type} ${kbytes}${used}${avail}${percent_used}${iused}${ifree}" >> /tmp/sysinfo.$$.bdf_outs
5353 print " ${fs_type} ${kbytes}${used}${avail}${percent_used} ${vxfs_frag}${vxfs_pct}" >> /tmp/sysinfo.$$.bdf_outs
5357 print "" >> /tmp/sysinfo.$$.bdf_outs
5358 print -n "Mounted " >> /tmp/sysinfo.$$.bdf_outh
5359 print -- " Extents" >> /tmp/sysinfo.$$.bdf_outh
5360 print -n "Filesystems Type Kbytes Used Avail" >> /tmp/sysinfo.$$.bdf_outh
5361 # print " % Iused Ifree" >> /tmp/sysinfo.$$.bdf_outh
5362 print " % Fragmented" >> /tmp/sysinfo.$$.bdf_outh
5363 print -n " ---------- ---- ------ ------ ------" >> /tmp/sysinfo.$$.bdf_outh
5364 print -- " --- ----------" >> /tmp/sysinfo.$$.bdf_outh
5365 cat /tmp/sysinfo.$$.bdf_out? > /tmp/sysinfo.$$.bdf_outd
5366 if (( ${no_lost} == 1 ))
5368 print -n "*** could not get fsadm lock - " >> /tmp/sysinfo.$$.bdf_outd
5369 print "lost+found/.fsadm not found" >> /tmp/sysinfo.$$.bdf_outd
5370 print "" >> /tmp/sysinfo.$$.bdf_outd
5372 f_display_file /tmp/sysinfo.$$.bdf_outd
5373 f_display_file /tmp/sysinfo.$$.bdf_warn
5376 } # end of f_filesystem_check
5378 #===================================================================
5380 # This function displays total disk, group, and lvol capacities.
5381 # The data comes from the logical, physical, & volume functions.
5382 # Therefore, this function does not stand alone. It must be run
5383 # with the l, p, & v options.
5384 #===================================================================
5385 function f_disk_capacity
5387 Debug "Beginning DISK CAPACITY calculations."
5390 print "</PRE>" >> /tmp/sysinfo.$$.capacity
5391 print "<A NAME='Capacity'></A>" >> /tmp/sysinfo.$$.capacity
5392 print "<H2>" >> /tmp/sysinfo.$$.capacity
5393 print "<P ALIGN=RIGHT><A HREF='#Top'>TOP</A></P>" >>/tmp/sysinfo.$$.capacity
5394 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.capacity
5395 print "Disk Capacity Data</H2>" >> /tmp/sysinfo.$$.capacity
5396 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.capacity
5398 print "DISK CAPACITY DATA" >> /tmp/sysinfo.$$.capacity
5399 print "==================" >> /tmp/sysinfo.$$.capacity
5401 ((unused_cap = total_p_mb - TotalAllocMb))
5402 ((OtherMb = TotalAllocMb - total_l_mb - TotalMirrorMb))
5403 print "Logical Volume Space = $total_l_mb MB" >> /tmp/sysinfo.$$.capacity
5404 print "Mirror Space = $TotalMirrorMb MB" >> /tmp/sysinfo.$$.capacity
5405 print "Other Space Allocated = $OtherMb MB" >> /tmp/sysinfo.$$.capacity
5406 print " -----------" >> /tmp/sysinfo.$$.capacity
5407 print "Total Disk Allocated = $TotalAllocMb MB" >> /tmp/sysinfo.$$.capacity
5408 print "Unallocated Disk = $unused_cap MB" >> /tmp/sysinfo.$$.capacity
5409 print " ===========" >> /tmp/sysinfo.$$.capacity
5410 print "Total Physical Disk = $total_p_mb MB\n" >> /tmp/sysinfo.$$.capacity
5412 print "Checked:" >> /tmp/sysinfo.$$.capacity
5413 print "${pcount} physical volumes" >> /tmp/sysinfo.$$.capacity
5414 print "${vgcount} volume groups" >> /tmp/sysinfo.$$.capacity
5415 print "${lcount} logical volumes" >> /tmp/sysinfo.$$.capacity
5417 Debug " found ${pcount} physical volumes"
5418 Debug " found ${vgcount} volume groups"
5419 Debug " found ${lcount} logical volumes"
5423 Debug "found ${total_stale} STALE extents"
5424 Debug " calculating re-syncing time"
5425 exit_code=${SYS_ERROR}
5426 print "STALE extents detected!" >> /tmp/sysinfo.$$.capacity
5427 print " check error listing for more details." >> /tmp/sysinfo.$$.capacity
5428 print -n "\n\nERROR:${sysname}: ${total_stale}" >> /tmp/sysinfo.$$.errwarn
5429 print " stale extents detected.\n" >> /tmp/sysinfo.$$.errwarn
5430 print -n "Estimated time to re-sync ${total_stale}" >> /tmp/sysinfo.$$.errwarn
5431 print " stale extents is" >> /tmp/sysinfo.$$.errwarn
5432 if ((${TotalStaleMb} < 100))
5434 print " less than 1 minute." >> /tmp/sysinfo.$$.errwarn
5435 Debug " less than 1 minute"
5437 ((TIME = TotalStaleMb / 100))
5438 ((HOURS = TIME /60))
5439 ((MINUTES = TIME % 60))
5440 print " ${HOURS} hours and ${MINUTES} minutes." >> /tmp/sysinfo.$$.errwarn
5441 Debug " ${TIME} total minutes or"
5442 Debug " ${HOURS} hours and ${MINUTES} minutes"
5444 print >> /tmp/sysinfo.$$.errwarn
5446 print "with no stale extents detected.\n" >> /tmp/sysinfo.$$.capacity
5447 Debug "No stale extents detected"
5449 f_display_file /tmp/sysinfo.$$.capacity
5451 } # end of f_disk_capacity
5454 #===================================================================
5456 # This function checks to see if the user is root.
5457 #===================================================================
5458 function f_check_root
5460 id | grep '(root)' > /dev/null
5463 print "\nYou must be super-user to run ${script}.\n"
5466 } # end of check_root
5468 #===================================================================
5470 # This function checks to see if running on HP-UX
5471 #===================================================================
5472 function f_check_hpux
5474 uname -s | grep HP-UX > /dev/null
5477 print "\nThis utility is only supported on HP-UX systems!\n"
5480 } # end of check_hpux
5482 #===================================================================
5484 # This function extract WARNINGS & ERRORS from the logfile
5485 #===================================================================
5486 function f_extract_errors
5488 if [[ -f /tmp/sysinfo.$$.errwarn ]]
5492 print "</PRE>" >> /tmp/sysinfo.$$.errwarn.header
5493 print "<A NAME='ErrWarn'></A>" >> /tmp/sysinfo.$$.errwarn.header
5494 print "<H2>" >> /tmp/sysinfo.$$.errwarn.header
5495 print "<P ALIGN=RIGHT><A HREF='#Top'>" >> /tmp/sysinfo.$$.errwarn.header
5496 print "TOP</A></P>" >> /tmp/sysinfo.$$.errwarn.header
5497 print "<FONT COLOR=red>" >> /tmp/sysinfo.$$.errwarn.header
5498 print "Summary of Errors/Warnings</H2>" >> /tmp/sysinfo.$$.errwarn.header
5499 print "</FONT><PRE><font size = '4'>" >> /tmp/sysinfo.$$.errwarn.header
5501 print "" >> /tmp/sysinfo.$$.errwarn.header
5502 print "ERROR/WARNING SUMMARY" >> /tmp/sysinfo.$$.errwarn.header
5503 print "=====================" >> /tmp/sysinfo.$$.errwarn.header
5506 grep -e WARNING -e ERROR /tmp/sysinfo.$$.errwarn > /dev/null 2>&1
5509 Debug "No errors/warnings found."
5512 print "No ERRORS or WARNINGS found."
5514 print "($sysname): No errors/warnings found." >> /tmp/sysinfo.$$.errwarn
5516 Debug "Found errors/warnings, displaying /tmp/sysinfo.$$.errwarn"
5519 print "Errors and/or Warnings were found."
5520 print "Please check output file ${LOGFILE}."
5523 print "" >> /tmp/sysinfo.$$.errwarn
5524 f_display_file /tmp/sysinfo.$$.errwarn.header
5525 f_display_file /tmp/sysinfo.$$.errwarn
5527 print "Could not find /tmp/sysinfo.$$.errwarn"
5531 function print_header
5534 #print " **** *****"
5536 #print "* * * *** * ** * **** **** "
5537 #print " **** * * * * * * * * * *"
5538 #print " * * *** * * * * *** * *"
5539 #print " * * * * * ** * * *"
5540 #print " **** * *** ***** * * * ****"
5545 print "@ @ @ @@@ @ @@ @ @@@@ @@@@ "
5546 print " @@@@ @ @ @ @ @ @ @ @ @ @"
5547 print " @ @ @@@ @ @ @ @ @@@ @ @"
5548 print " @ @ @ @ @ @@ @ @ @"
5549 print " @@@@ @ @@@ @@@@@ @ @ @ @@@@"
5552 #===================================================================
5554 #===================================================================
5555 typeset -fx lvm_scan
5556 typeset -fx sam_scan
5558 typeset -fx f_query_sam
5560 where=`dirname ${0}`
5566 #print "\n${script} ${version} by Scott Truesdale\n"
5568 print "Author: Scott Truesdale"
5569 print "Version: ${version}\n"
5572 print "<HTML><HEAD>" >> $LOGFILE
5573 print "<HTML><HEAD>" >> $LOGFILE_INDEX
5574 print "<HTML><HEAD>" >> $LOGFILE_MAIN
5575 print "<TITLE>Sysinfo for ${sysname}</TITLE>" >> $LOGFILE
5576 print "<TITLE>Sysinfo (Index) for ${sysname}</TITLE>" >> $LOGFILE_INDEX
5577 print "<TITLE>Sysinfo (Main) for ${sysname}</TITLE>" >> $LOGFILE_MAIN
5578 print "</HEAD>" >> $LOGFILE
5579 print "<FRAMESET ROWS='175,*' FRAMEBORDER='YES'" >> $LOGFILE
5580 print "BORDERCOLOR='darkblue' FRAMESPACING='2'" >> $LOGFILE
5581 print "BORDER='2'>" >> $LOGFILE
5582 print "<FRAME SRC='${LOGFILE_INDEX_REL}'" >> $LOGFILE
5583 print "NAME='IndexFrame' SCROLLING='NO'>" >> $LOGFILE
5584 print "<FRAME SRC='${LOGFILE_MAIN_REL}'" >> $LOGFILE
5585 print "NAME='MainFrame'" >> $LOGFILE
5586 print "SCROLLING='AUTO'><NOFRAMES>" >> $LOGFILE
5587 print "<BODY BGCOLOR=lightblue>" >> $LOGFILE
5588 print "</HEAD><BODY BGCOLOR=lightblue>" >> $LOGFILE_INDEX
5589 print "</HEAD><BODY BGCOLOR=lightblue>" >> $LOGFILE_MAIN
5590 print "<CENTER>" >> $LOGFILE
5591 print "<A name='TOP'></A>" >> $LOGFILE
5592 print "<FONT SIZE=6 COLOR=darkblue>" >> $LOGFILE
5593 print "${script} ${version} " >> $LOGFILE
5594 print "by Scott Truesdale</FONT><BR>" >> $LOGFILE
5595 print "<FONT SIZE=6>Configuration Data for" >> $LOGFILE
5596 print "<FONT COLOR=red>${sysname}</FONT></FONT><BR>" >> $LOGFILE
5597 print "<FONT SIZE=3>Collected on `date`.</FONT><BR>" >> $LOGFILE
5598 print "<A HREF='#System'>System</A>" >> $LOGFILE
5599 print "<A HREF='#Kernel'>Kernel</A>" >> $LOGFILE
5600 print "<A HREF='#Network'>Network</A>" >> $LOGFILE
5601 print "<A HREF='#File'>File System</A>" >> $LOGFILE
5602 print "<BR>" >> $LOGFILE
5603 print "<A HREF='#IO'>IO Configuration</A>" >> $LOGFILE
5604 print "<A HREF='#Physical'>Physical Disks</A>" >> $LOGFILE
5605 print "<A HREF='#Pmap'>Physical Mapping</A>" >> $LOGFILE
5606 print "<A HREF='#Volume'>Volume Groups</A>" >> $LOGFILE
5607 print "<BR>" >> $LOGFILE
5608 print "<A HREF='#Logical'>Logical Disks</A>" >> $LOGFILE
5609 print "<A HREF='#Lmap'>Logical Mapping</A>" >> $LOGFILE
5610 print "<A HREF='#Capacity'>Disk Capacity</A>" >> $LOGFILE
5611 print "<A HREF='#Software'>Software List</A>" >> $LOGFILE
5612 print "<BR>" >> $LOGFILE
5613 print "<A HREF='#SYSACCESS'>Security Check</A>" >> $LOGFILE
5614 print "<A HREF='#DIAGNOSTICS'>Diagnostic Settings</A>" >> $LOGFILE
5615 print "<A HREF='#LOGFILES'>System Logfiles</A>" >> $LOGFILE
5616 print "<A HREF='#ErrWarn'>Errors/Warnings</A>" >> $LOGFILE
5619 print "<BR>" >> $LOGFILE
5620 print "<A HREF='#SAP'>SAP R/3 Info</A>" >> $LOGFILE
5622 print "</CENTER>" >> $LOGFILE
5623 print "<CENTER>" >> $LOGFILE_INDEX
5624 print "<A name='TOP'></A>" >> $LOGFILE_INDEX
5625 print "<FONT SIZE=6 COLOR=darkblue>" >> $LOGFILE_INDEX
5626 print "${script} ${version} " >> $LOGFILE_INDEX
5627 print "by Scott Truesdale</FONT><BR>" >> $LOGFILE_INDEX
5628 print "<FONT SIZE=6>Configuration Data for" >> $LOGFILE_INDEX
5629 print "<FONT COLOR=red>${sysname}</FONT></FONT><BR>" >> $LOGFILE_INDEX
5630 print "<FONT SIZE=3>Collected on `date`.</FONT><BR>" >> $LOGFILE_INDEX
5631 print "<A HREF='${LOGFILE_MAIN_REL}#System' TARGET='MainFrame'>System</A>" >> $LOGFILE_INDEX
5632 print "<A HREF='${LOGFILE_MAIN_REL}#Kernel' TARGET='MainFrame'>Kernel</A>" >> $LOGFILE_INDEX
5633 print "<A HREF='${LOGFILE_MAIN_REL}#Network' TARGET='MainFrame'>Network</A>" >> $LOGFILE_INDEX
5634 print "<A HREF='${LOGFILE_MAIN_REL}#File' TARGET='MainFrame'>File System</A>" >> $LOGFILE_INDEX
5635 print "<A HREF='${LOGFILE_MAIN_REL}#IO' TARGET='MainFrame'>IO Configuration</A>" >> $LOGFILE_INDEX
5636 print "<A HREF='${LOGFILE_MAIN_REL}#Physical' TARGET='MainFrame'>Physical Disks</A>" >> $LOGFILE_INDEX
5637 print "<A HREF='${LOGFILE_MAIN_REL}#Pmap' TARGET='MainFrame'>Physical Mapping</A>" >> $LOGFILE_INDEX
5638 print "<A HREF='${LOGFILE_MAIN_REL}#Volume' TARGET='MainFrame'>Volume Groups</A>" >> $LOGFILE_INDEX
5639 print "<A HREF='${LOGFILE_MAIN_REL}#Logical' TARGET='MainFrame'>Logical Disks</A>" >> $LOGFILE_INDEX
5640 print "<A HREF='${LOGFILE_MAIN_REL}#Lmap' TARGET='MainFrame'>Logical Mapping</A>" >> $LOGFILE_INDEX
5641 print "<A HREF='${LOGFILE_MAIN_REL}#Capacity' TARGET='MainFrame'>Disk Capacity</A>" >> $LOGFILE_INDEX
5642 print "<A HREF='${LOGFILE_MAIN_REL}#Software' TARGET='MainFrame'>Software List</A>" >> $LOGFILE_INDEX
5643 print "<A HREF='${LOGFILE_MAIN_REL}#SYSACCESS' TARGET='MainFrame'>Security Check</A>" >> $LOGFILE_INDEX
5644 print "<A HREF='${LOGFILE_MAIN_REL}#DIAGNOSTICS' TARGET='MainFrame'>Diagnostic Settings</A>" >> $LOGFILE_INDEX
5645 print "<A HREF='${LOGFILE_MAIN_REL}#LOGFILES' TARGET='MainFrame'>System Logfiles</A>" >> $LOGFILE_INDEX
5646 print "<A HREF='${LOGFILE_MAIN_REL}#ErrWarn' TARGET='MainFrame'>Errors/Warnings</A>" >> $LOGFILE_INDEX
5649 print "<A HREF='${LOGFILE_MAIN_REL}#SAP' TARGET='MainFrame'>SAP R/3 Info</A>" >> $LOGFILE_INDEX
5651 print "</CENTER>" >> $LOGFILE_INDEX
5654 print "\n${script} ${version} by Scott Truesdale\n" >> $LOGFILE
5655 print "Configuration data for ${sysname}\ncollected on `date`\n" >> $LOGFILE
5659 print "Author: Scott Truesdale"
5660 print "Version: ${version}\n"
5661 print "Configuration data for ${sysname}\ncollected on `date`.\n"
5663 touch /tmp/sysinfo.$$.errwarn
5664 #===================================================================
5665 # Begin PASS section
5666 #===================================================================
5669 touch /tmp/sysinfo.$$.sapwarn
5673 #===================================================================
5674 # SYSTEM CHECK AND ROOT DATA
5675 #===================================================================
5682 #===================================================================
5684 #===================================================================
5685 if (($FULL_KERNEL)) || (($LITE_KERNEL))
5687 if (( ${osmajor} >= 10 ))
5691 f_get_9x_kernel_data
5695 #if (($SAMSCAN)) && (( ${osmajor} >= 10 ))
5697 # f_display_sam_kernel_data
5700 #===================================================================
5702 #===================================================================
5708 #===================================================================
5710 #===================================================================
5716 #===================================================================
5718 #===================================================================
5724 #===================================================================
5725 # PHYSICAL DISK CHECK
5726 #===================================================================
5729 f_get_physical_disk_data
5732 #===================================================================
5733 # VOLUME GROUP CHECK
5734 #===================================================================
5737 if (($lvm_installed))
5739 f_get_volume_group_data
5741 print "LVM must be installed to use this option."
5745 #===================================================================
5746 # LOGICAL DISK CHECK
5747 #===================================================================
5750 if (($lvm_installed))
5752 f_get_logical_volume_data
5754 print "LVM must be installed to use this option."
5758 #===================================================================
5759 # LOGICAL VOLUME TO PHYSICAL DISK MAPPING
5760 #===================================================================
5761 # check which physical disks have this logvol on them
5764 if (($lvm_installed))
5766 f_logical_to_physical
5768 print "LVM must be installed to use this option."
5772 #===================================================================
5773 # DISK CAPACITY TABLE
5774 #===================================================================
5775 # note that the CAPACITY flag cannot be set directly.
5776 # it is automatically enabled when either the -a or -lpv flags
5779 if (($lvm_installed))
5783 print "LVM must be installed to use this option."
5787 #===================================================================
5789 #===================================================================
5795 #===================================================================
5796 # Check system file/directory access and some security parms.
5797 #===================================================================
5803 #===================================================================
5804 # Check to see if the system has diagnostics
5805 #===================================================================
5812 #===================================================================
5813 # Check System Logfiles
5814 #===================================================================
5821 #===================================================================
5822 # Extract ERROR/WARNING messages
5823 #===================================================================
5828 f_display_file /tmp/sysinfo.$$.sap
5829 print "\n\n" >> /tmp/sysinfo.$$.sapwarn
5830 f_display_file /tmp/sysinfo.$$.sapwarn
5834 #===================================================================
5835 # Clean up end of HTML files if necessary
5836 #===================================================================
5840 print "</BODY></HTML>" >> $LOGFILE_INDEX
5841 print "</BODY></HTML>" >> $LOGFILE_MAIN
5842 print "</BODY></NOFRAMES></FRAMESET></HTML>" >> $LOGFILE
5843 chmod 444 $LOGFILE_INDEX $LOGFILE_MAIN $LOGFILE
5846 #===================================================================
5847 # END OF SCRIPT - SO LET'S GET OUT OF HERE!
5848 #===================================================================
5849 Debug "exit_code = ${exit_code}"