-
Notifications
You must be signed in to change notification settings - Fork 0
/
hp-ux_snapshot.sh
6691 lines (5476 loc) · 177 KB
/
hp-ux_snapshot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/ksh
#
# @(#) /usr/contrib/bin/snapshot $Revision 0.3.0 $ Date: 98/03/31 08:00:00 $
##########################################################################
# #
# Program: snapshot ver 3.0, HP-UX System Documentation Tool #
# #
# Author: Jack Maynard, #
# #
# Please direct comments, suggestions and/or bug-fixes #
# to jack@maynard.com #
# #
# DISCLAIMER: This script is a contributed utility, no official #
# support for it will be provided. #
# #
# Important: If you are running on a 9.x O/S, please configure #
# the shell on line 1 to /bin/ksh. For 10 & 11 systems #
# please use /usr/bin/ksh. This assumes no transition links.#
# #
# Important: You must configure the customer variables section #
# located at line 112 for this script to run correctly, #
# or use the command line argument -i for interactive. #
# #
# Xvg Note: This script collects data using VgCollect for Xvg. #
# You may open the output of this script directly by the #
# Xvg application without need to trim other data within #
# the script. Save output of script to <filename> then #
# load it into Xvg with the command Xvg <filename>. Xvg #
# will ignore all other non-relevant data within the file #
# and display the Motif LVM data. #
# #
# ABSTRACT: This script is known to run on HP-UX 9.x, 10.x, & 11.x #
# O/S versions. It gathers system configuration #
# information for use by engineers needing comprehensive #
# system documentation. It's output can be configured #
# to log to a file or to e-mail to a distribution list, #
# or both. #
# #
# The intent was to find the best support scripts and #
# incorporate them into one cohesive script. With #
# apologies to the various script authors, it #
# incorporates the best of the following scripts: #
# #
# * VgCollect ver. 2.04 (collect script for Xvg) #
# Author: Didier Lecardez #
# #
# * capture ver. 3.6 #
# Author: Dave Olker #
# #
# * LVMcollect ver. 4.0 (10.x) #
# Author: Peter Van Giel #
# #
# * LVMcollect ver. 3.02 (9.x) #
# Author: Peter Van Giel #
# #
# Modifications: #
# #
# 03/31/98 ver 3.0 #
# #
# * ported to hp-ux 11.x #
# #
# * updated VgCollect script to ver 2.04 for 11.x #
# #
# * added Table of Contents to output #
# #
# #
# 08/26/97 ver 2.03 #
# #
# * incorporated VgCollect script to enable #
# capture of customer's LVM configuration #
# for import into XVG #
# #
# * fixed a bug that caused invalid diskinfo #
# checks on softlink device files created #
# by HP transition links for software #
# compatibility between 9.x and 10.x. #
# #
# * added variable to choose whether to include #
# password and group files in output. Some #
# customers are sensitive (and rightly so) to #
# sending un-encrypted password info across the #
# internet. #
# #
# 06/03/96 ver 2.02 #
# #
# * enhanced OS version lookup to include #
# release level, ie: 9.04.3b #
# ^^ #
# #
# * enhanced error messages when command #
# is not found on system #
# #
# * sorted patch output by type, ie CO,KL #
# #
# * fixed path to diags for DUI #
# #
# * added variable to turn on or off collection #
# of network rc scripts -- too verbose #
# #
# 03/04/96 ver 2.01 #
# #
# * 9.x systems called wrong mailer - fixed #
# #
# 02/23/96 ver 2.0 #
# #
# * updated capture to ver 3.6 #
# #
# * updated LVMcollect to ver 4.0 & 3.02 #
# #
# * removed shar'd logfile collection from capture #
# #
# * removed LVM section from capture #
# #
# * added configurable printer variable #
# #
##########################################################################
##########################################################################
# START OF CUSTOMER VARIABLES #
##########################################################################
# Note: configure these variables to run in non-interactive mode (cron) #
# For yes or no answers, please use "YES" or "NO".
# Company name of customer.
CUST_NAME=""
# System Handle or support identifier.
SYS_ID=""
# Do you wish to mail the output file?
MAIL_FILE=""
# Customer e-mail address for output file.
CUST_EMAIL=""
# Alternate e-mail address for support personel.
ALT_EMAIL=""
# Directory where you wish to save output.
SAVE_DIR=""
# Do you want to include sensitive files (like passwords)?
SENSITIVE_FILES="YES"
##########################################################################
# END OF CUSTOMER VARIABLES #
##########################################################################
##########################################################################
# PROGRAM VARIABLES #
##########################################################################
PATH=:/usr/contrib/bin:/etc:/usr/etc:/sbin:/usr/sbin:/usr/sbin/diag:/usr/diag/bin:/bin:/usr/bin:/usr/lib:/usr/sam/lbin:/usr/sam/bin:/etc/netbios:/usr/net/servers/lanman/bin:/usr/netware/bin:/opt/netware/bin:/usr/etc/yp:/etc/net/osi/ots:/usr/lib/netsvc:/usr/lib/netsvc/yp:/system/TOOL:/usr/local/bin:/usr/lbin/sysadm:/opt/lmu/netbios/bin:/opt/lmu/lanman/bin:/opt/lmx/lanman/bin
export PATH
SCRIPT_NAME=`basename $0`
HOST_NAME=$(hostname)
OS_VERSION=$(uname -r | awk -F. '{print $2}')
SPU_ID=$(uname -i)
USER_LICENSE=$(uname -l | awk '{print $1}')
VER="3.0"
if [ $OS_VERSION -lt 10 ]
then
DNS_DOMAIN=$(domainname)
else
DNS_DOMAIN="$(nslookup $HOST_NAME |grep Name |grep -v Server | cut -d"." -f2-6)"
fi
##########################################################################
# PROGRAM FUNCTIONS #
##########################################################################
get_opts()
{
if (($# == 0))
then
usage
exit 1
fi
while getopts :iachlsuxH arguments
do
case $arguments in
a) redirect
summary_info
capture
lvm_info
print_footer
vgcollect;;
c) redirect
summary_info
capture
print_footer;;
h) print_help
exit 1;;
i) interact;;
l) redirect
lvm_info
print_footer;;
s) redirect
summary_info
print_footer;;
x) redirect
vgcollect;;
u) usage
exit -1;;
*) print "\n${half}Invalid option${off}\n"
usage
exit -1;;
esac
done
}
print_help()
{
cat << EOF | more
Please execute '$SCRIPT_NAME -u' for usage information.
EOF
}
usage()
{
clear
cat << EOF | more
$SCRIPT_NAME $VER by Jack Maynard (jack_maynard@hp.com)
Usage: ${SCRIPT_NAME} [-a] [-i] [-H]
${SCRIPT_NAME} [-cdilsxH]
${SCRIPT_NAME} [-h]
-a collect all of the following options
-c collect system configuration data
-d collect diagnostic (hardware map) data
-l collect Logical Volume Manager data
-s collect summary (quick) system data
-x collect XVG (vgcollect) data
-i interactive mode - prompts for runtime variables
-h displays detailed help message
-H send output to logfile in HTML format (default is ascii)
Note: If you wish to run this script non-interactively,
please modify the variables at line 112 of the script.
Otherwise use the '-i' flag and the script will prompt
you for the proper information.
EOF
}
interact()
{
part_1()
{
print
print "Enter Customer Name > \c"
read CUST_NAME
print "You entered "$CUST_NAME". Is this correct? (y/n)> \c"
read ANSWER
while [[ $ANSWER != "y" ]]
do
print
print "Enter Customer Name > \c"
read CUST_NAME
print "You entered: "$CUST_NAME" Is this correct? (y/n)> \c"
read ANSWER
done
print
}
part_2()
{
print "Enter System Handle > \c"
read SYS_ID
print "You entered: "$SYS_ID" Is this correct? (y/n)> \c"
read ANSWER
while [[ $ANSWER != "y" ]]
do
print
print "Enter System Handle > \c"
read SYS_ID
print "You entered: "$SYS_ID" Is this correct? (y/n)> \c"
read ANSWER
done
print
}
part_3()
{
print "Please enter where you want output file saved ie: /tmp> \c"
read SAVE_DIR
print "You entered: "$SAVE_DIR" Is this correct? (y/n)> \c"
read ANSWER
while [[ $ANSWER != "y" ]]
do
print
print "Please enter where you want output file saved ie: /tmp> \c"
read SAVE_DIR
print "You entered: "$SAVE_DIR" Is this correct? (y/n)> \c"
read ANSWER
done
print
}
part_4()
{
print "Do you wish to mail the output file? (y/n)> \c"
read MAIL_FILE
if [[ $MAIL_FILE = "y" ]]
then
print
print "Please enter a valid e-mail address, ie: root or root@xyz.com> \c"
read CUST_EMAIL
print "You entered: "$CUST_EMAIL" Is this correct? (y/n)> \c"
read ANSWER
while [[ $ANSWER != "y" ]]
do
print
print "Please enter a valid e-mail address, ie: root or root@xyz.com> \c"
read CUST_EMAIL
print "You entered: "$CUST_EMAIL" Is this correct? (y/n)> \c"
read ANSWER
done
fi
print
}
part_5()
{
ANSWER=""
print "You chose:"
print
print " 1. Customer Name : $CUST_NAME"
print " 2. System Handle : $SYS_ID"
print " 3. Save directory : $SAVE_DIR"
if [[ $MAIL_FILE != "n" ]]
then
print " 4. e-mail address : $CUST_EMAIL"
fi
print
print "Is the above information correct? (y/n)> \c"
read ANSWER
while [[ $ANSWER != "y" ]]
do
print "Enter the number of the item you wish to change > \c"
read NUMBER
if [[ $NUMBER = "1" ]]
then
part_1
part_5
fi
if [[ $NUMBER = "2" ]]
then
part_2
part_5
fi
if [[ $NUMBER = "3" ]]
then
part_3
part_5
fi
if [[ $NUMBER = "4" ]]
then
part_4
part_5
fi
done
print
}
part_1
part_2
part_3
part_4
part_5
} # end of interact function
vgcollect()
{
#
# This function runs the VgCollect 2.04 script for import into XVG
#
print "*******************************************************************************"
print "******* START OF VGCOLLECT for XVG *******"
print "*******************************************************************************"
echo
OS=`uname -r | cut -d'.' -f2`
typeset -i pvnum
pvnum=0
FULLREV=""
if [ ${OS} = "09" ]
then
FULLREV=`awk '/^fv:/ {print $2}' /system/UX-CORE/index`
else
FULLREV=`uname -r`
fi
FSTAB=/etc/mnttab
echo "VGINFO of `uname -nm` $FULLREV \$Rev: 2.04 \$"
date
lvlnboot -v 2>/dev/null | grep "^Dump:" | awk '{print $2,$4}' > /tmp/dump$$
vgdisplay | grep -v "Volume groups" > /tmp/vgdisplay$$
awk '\
{if ( NF == 0) {
printf "\n"
}
else {
printf "%s ", $NF}
}' < /tmp/vgdisplay$$ > /tmp/vglist$$
swapinfo -d | awk '{print $NF}' > /tmp/swap$$
> /tmp/pv$$
vgdisplay -v | grep "^ PV Name" |
grep -v "Alternate Link" |
awk '{print $3}' |
while read a
do
grep -q "$a" /tmp/pv$$ || echo "$a" >> /tmp/pv$$
done
#
echo PVs=`cat /tmp/pv$$ | wc -l ` VGs=`cat /tmp/vglist$$ | wc -l`
cat /tmp/vglist$$;rm -f /tmp/vglist$$
for pv in `cat /tmp/pv$$`
do
echo "#####PV#${pvnum}"
pvnum=pvnum+1
pvdisplay $pv > /tmp/curpv$$
grep -Ev "Physical|Alternate|alternate" /tmp/curpv$$ | awk '{printf "%s ", $NF}'
if [ ${OS} = "09" ]
then
echo "N/A \c"
fi
RPV=`echo $pv | sed s/dsk/rdsk/`
DISKTYPE=`diskinfo $RPV |grep "product id" | awk '{print $3}'`
HWPATH=`lssf $pv | awk '{print $(NF -1)}'`
echo "$DISKTYPE $HWPATH\c"
integer i=1
awk '/Alternate Link/ {print $3}' /tmp/curpv$$ | while read PVLINK[i]
do
HWPATH[i]=`lssf ${PVLINK[i]} | awk '{print $(NF -1)}'`
let i=i+1
done
if [ $i -eq 1 ]
then
echo " NOPVLINK NOPVLINK"
else
integer j=1
while [ $j -ne $i ]
do
printf " %s %s " ${PVLINK[j]} ${HWPATH[j]}
let j=j+1
done
echo
fi
pvdisplay -v $pv | awk '\
BEGIN{num=0;str=""}
{
if ( $0 ~ /PE Status LV/){
for(;;){
getline
if ( $0 == "" ){
pr();
break;
}
if ( $2 == "free" ) {
if ( $2 == str ){
num++;
}else{
pr();
str=$2;
num=1;
}
}else{
if ( $3 == str ){
num++;
}else{
pr();
str=$3;
num=1;
}
}
}
}else{
continue
}
}
function pr()
{
if ( num > 0 ){
printf("%s %d\n",str,num);
str="";
num=0;
}
}'| while read LVNAME LVSIZE
do
echo "$LVNAME $LVSIZE \c"
F1=`dirname $LVNAME`
F2=`basename $LVNAME`
RLV=`printf "%s/r%s" $F1 $F2`
if [ "$LVNAME" != "free" ]
then
lvdisplay $LVNAME | egrep -v "\-\-\- |/dev/" | awk '{printf "%s ", $NF}'
else
echo "-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 \c"
fi
FST=`grep "$LVNAME " $FSTAB | awk '{print $3}'`
case ${FST} in
hfs)
tunefs -v $RLV >/dev/null 2>&1
if [ $? = 0 ]
then
tunefs -v $RLV | awk '\
/super/ {if ($6 != "") \
{printf "%s ",$6} else { printf "/??? "}} \
/minfree/ {printf "%s ",$2} \
/^bsize/ {printf "%s ",$2} \
/fsize/ {printf "%s ",$2} \
/rotdelay/ {printf "%s ",$4} \
/nbfree/ {printf "%s ",$2} \
/nifree/ {printf "%s", $6} '
else
echo "/??? -1 -1 -1% -1ms -1 -1\c"
fi
;;
vxfs)
MNTPT=""
grep "$LVNAME " $FSTAB | read dummy MNTPT dummy
if [ -z "${MNTPT}" ]
then
echo "/??? -1 -1 -1% -1ms -1 -1\c"
else
MINFREE="";BLOCKSIZE="";FRAGSIZE="";FREEBLOCKS="";FREEINODES=""
df -t ${LVNAME} | grep "percent minfree" | read MINFREE dummy
df -g ${LVNAME} > /tmp/df$$
grep "file system block" /tmp/df$$ | read BLOCKSIZE nul nul nul nul FRAGSIZE nul
grep "total blocks" /tmp/df$$ | read nul nul nul FREEBLOCKS nul
grep "total i-nodes" /tmp/df$$ | read nul nul nul nul FREEINODES nul
echo "${MNTPT} ${BLOCKSIZE} ${FRAGSIZE} ${MINFREE} -1ms ${FREEBLOCKS} ${FREEINODES}\c"
fi
;;
*)
echo "/??? -1 -1 -1% -1ms -1 -1\c"
;;
esac
IsFs="y"
if [ `grep -c "${LVNAME}$" /tmp/swap$$` -gt 0 ]
then
echo " swap\c"
IsFs=""
fi
if [ `grep -c "$F2" /tmp/dump$$` -gt 0 -a `grep -c "$pv" /tmp/dump$$` -gt 0 ]
then
echo "/dump\c"
IsFs=""
fi
if [ "$IsFs" = "y" ]
then
echo " fs\c"
fi
FST=`grep "$LVNAME " $FSTAB | awk '{print $3}'`
if [ X${FST} = "X" ]
then
echo " nofs\c"
else
echo " ${FST}\c"
fi
echo
done
done
echo "[End VGINFO]"
if [ ${OS} != "09" ]
then
echo "[Start Interfaces]"
ioscan -FC ext_bus | cut -d':' -f 11
echo "[End Interfaces]"
fi
rm -f /tmp/pv$$ /tmp/swap$$ /tmp/dump$$ /tmp/vgdisplay$$ /tmp/curpv$$ /tmp/df$$
echo
print "*******************************************************************************"
print "******* END OF VGCOLLECT for XVG *******"
print "*******************************************************************************"
}
redirect()
{
#
# Redirect stdout to file
#
OUTPUT_FILE=${SAVE_DIR}/${SCRIPT_NAME}.$(date +%m%d)
print Output will be save in ${SAVE_DIR}/${SCRIPT_NAME}.$(date +%m%d)
exec > $OUTPUT_FILE 2>&1
# Attach mail header if to be e-mailed
attach_header
# Redirect stderr
ERR_FILE="/dev/null"
exec 2>>$ERR_FILE
}
check_user()
{
#
# Make sure 'root' is executing the script
#
if [ $(id -u) -ne 0 ]
then
print
print "Sorry! You must be root to run the $SCRIPT_NAME script"
print
exit 1
fi
}
summary_info()
{
print "*******************************************************************************"
print "******* *******"
print "******* SUMMARY INFORMATION *******"
print "******* *******"
print "*******************************************************************************"
DATE=$(date)
print "$DATE $SCRIPT_NAME $VER"
print
print
#
# Identify customer
#
print "Company Name : $CUST_NAME"
#
# Identify System
#
print "System ID : $SYS_ID"
print
#
# Call 'hostname' to get system hostname
#
print "Host Name : $(hostname)"
#
# Get domain name
#
print "Domain Name : $DNS_DOMAIN"
#
# Get system type
#
MODEL=$(uname -m)
print "System Type : $MODEL"
#
# Get OS Version
#
if [ $OS_VERSION -lt 10 ]
then
REV_LEVEL="HP-UX $(grep fv /system/UX-CORE/index | awk '{print $2}')"
print "Operating System : $REV_LEVEL"
else
REV_LEVEL="$(uname -a | awk '{print $1 " " $3 " rev. " $4}')"
print "Operating System : $REV_LEVEL"
fi
#
# Get SPU ID
#
print "SPU ID : $SPU_ID"
#
# Get user license
#
print "User License : $USER_LICENSE"
#
# Get IP and MAC Address from installed lan cards
#
for LAN in $(lanscan | grep lan | awk '{print $5}')
do
IP_ADDRESS=$(ifconfig $LAN | grep inet | awk '{print $2}')
MAC_ADDRESS=$(lanscan | grep $LAN | awk '{print $2}')
print "IP addr ($LAN) : $IP_ADDRESS"
print "MAC addr ($LAN) : $MAC_ADDRESS"
done
#
# Get Installed Memory
#
#
# Determine the memory size.
#
# Real memory expressed in units of pages (4 kbytes per page).
OS_VERSION=$(uname -r | awk -F. '{print $2}')
if [ $OS_VERSION -lt 10 ]
then
REAL_MEM=`print 'physmem/D'| adb /hp-ux /dev/kmem | tail -1 | \
awk '{print $2}'`
else
REAL_MEM=`print 'physmem/D'| adb /stand/vmunix /dev/kmem | tail -1 | \
awk '{print $2}'`
fi
print "Real Memory : `expr ${REAL_MEM} / 256` Mbytes"
#
# Get swap memory
#
swapinfo -m | grep dev | awk '{print "Swap Space : "$2" Mbytes on "$9}'
#
# Call 'who -b' to see when the system was last rebooted.
#
print "Last Reboot : "$(who -b | sed 's/^.*boot //')
#
# Call 'who -r' to see what run level the machine is at.
#
print "Run Level : "$(who -r | sed 's/^.*run-level //' | \
sed 's/ .*$//')
#
# Call 'uptime' to look at load averages
#
AVERAGE=$(uptime | sed 's/^.*average: / /')
print "Load Averages :$AVERAGE"
}
mail_header()
{
#
# This function adds a mail header for e-mail via Internet
#
print "From: $CUST_NAME "
print "Subject: Output of $SCRIPT_NAME script"
print "Priority: Urgent"
print ""
}
print_footer()
{
#
# This function prints the closing footer
#
print "*******************************************************************************"
print "******* END OF SNAPSHOT SCRIPT *******"
print "*******************************************************************************"
echo
echo
}
capture()
{
#############################################################################
#
# VARIABLES
#
#############################################################################
SYSTEM_TYPE=$(uname -m | awk -F/ '{print $2}' | cut -c 1)00
SUB_SYSTEMS="HARDWARE OS SYSTEM NETWORKING"
ALL_SUB_SYSTEMS="HARDWARE OS SYSTEM NETWORKING INETSVC LMU LMX NETWARE NFS_NIS OTS_FTAM SLIP SNAP TIO_DTC X25"
NIS_SERVER="YES"
NIS_CLIENT="YES"
SCRIPT_CAPS=$(print $SCRIPT_NAME | tr "[a-z]" "[A-Z]")
#
# Locate the temporary holding directory under /tmp
#
TMP_DIR=>/dev/null
OUTPUT_SHAR_FILE=/tmp/capture.$(date +%m%d%H%M)
ANALYZE_FILE=$TMP_DIR/analyze.output
AUDIT_LOGS=$TMP_DIR/audit.logs
CRON_INFO=$TMP_DIR/cron_info.$$
CRON_JOBS=$TMP_DIR/cron_jobs.$$
GATED_FILES=$TMP_DIR/gated_files.$$
DIAG_LOGS=$TMP_DIR/diag_logs.$$
NAMED_FILES=$TMP_DIR/named_files.$$
NFS_FILES=$TMP_DIR/nfs_files.$$
NIS_MAPS=$TMP_DIR/client.nismaps
MAIL_FILES=$TMP_DIR/mailfiles.$$
RBOOTD_FILES=$TMP_DIR/rbootd_files.$$
RC_FILES=$TMP_DIR/rc_files.$$
SLIP_FILES=$TMP_DIR/slipfiles.$$
SNAP_FILES=$TMP_DIR/snapfiles.$$
SYS_FILES=$TMP_DIR/sys_files.$$
SAR_FILE=$TMP_DIR/sar_file.$$
TMPFILE1=$TMP_DIR/tmpfile1.$$
TMPFILE2=$TMP_DIR/tmpfile2.$$
SHAR_ARGS="-bCZshm"
SAR_OPTS="b d y c w a q v m"
#############################################################################
#
# FUNCTIONS
#
#############################################################################
function SYSTEM_Info {
bigtitle "General System Information"
#
# Call 'who -rRub' to see when the system was last booted, the current
# system run-level, and the list of currently logged-in users with their
# respective hostnames.
#
execute who -rRub
#
# Print inittab file
#
cat_file /etc/inittab
#
# Call 'dmesg' to see console message buffer.
#
title "System Diagnostic Messages"
execute dmesg
#
# If we are on an 800 system, call 'sar' to gather system data
#
if [ $SYSTEM_TYPE -eq 800 ]
then
title "System Activity Reporter Information"
execute sar "-o $SAR_FILE 5 20" \ "Output from $(whence sar) 5 20"
for OPT in $SAR_OPTS
do
execute sar "-f $SAR_FILE -M$OPT" \
"Output from $(whence sar) -$OPT"
done
fi
#
# Look for - but do not execute - well known performance monitors
#
title "Performance Monitors Available"
PERFORMANCE_TOOLS="/usr/bin/top /usr/contrib/bin/monitor /usr/perf/bin/glance \
/usr/perf/bin/gpm /usr/perf/bin/scope.start /usr/perf/bin/rx \
/opt/perf/bin/glance /opt/perf/bin/gpm /opt/perf/bin/scope.start /opt/perf/bin/rx"
for TOOL in $PERFORMANCE_TOOLS
do
if [ -f $TOOL ]
then
echo "$(echo $TOOL) is available"
print
fi
done
#
# Collect the following files: cron.allow, at.allow.
# Also get the contents of the crontabs and atjobs directories.
#
title "CRON Information"
if [ $OS_VERSION -lt 10 ]
then
cat_file /usr/lib/cron/at.allow
cat_file /usr/lib/cron/at.deny
cat_file /usr/lib/cron/cron.allow
cat_file /usr/lib/cron/cron.deny
cat_file /usr/spool/cron/.ataids
cat_file /usr/spool/cron/.cronaids
else
cat_file /var/adm/cron/at.allow
cat_file /var/adm/cron/at.deny
cat_file /var/adm/cron/cron.allow
cat_file /var/adm/cron/cron.deny
cat_file /var/spool/cron/.ataids
cat_file /var/spool/cron/.cronaids
fi
#
# Collect the scripts launched in the various cron schedules.
# Call 'sed' and 'awk' to parse out the filenames listed in the
# crontab files. Call 'file' to make sure they are ascii text
# files and not binaries.
#
cat /dev/null > $TMPFILE1
cat /dev/null > $TMPFILE2
if [ $OS_VERSION -lt 10 ]
then
ATJOB_DIR=/usr/spool/cron/atjobs
CRONTAB_DIR=/usr/spool/cron/crontabs
CRON_DIR=/usr/lib/cron
else
ATJOB_DIR=/var/spool/cron/atjobs
CRONTAB_DIR=/var/spool/cron/crontabs
CRON_DIR=/var/adm/cron
fi
if [ -f $CRONTAB_DIR/* ]