403244ab92a62d7f4c9a477f5459b58382642833
[clearscm.git] / clients / HP / bin / machine_stats
1 #!/bin/ksh
2 ################################################################################
3 #
4 # File:         machine_stats
5 # Description:  Displays statistical information about all machines
6 # Author:       Andrew@DeFaria.com
7 # Created:      Fri Apr 30 14:13:56 PDT 1999
8 # Language:     Korn Shell
9 #
10 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
11 #
12 ################################################################################
13 # Set me to command name
14 me=$(basename $0)
15
16 # Set adm_base
17 adm_base=${adm_base:-$HOME/adm}
18
19 # Set adm_fpath
20 adm_fpath=${adm_fpath:-$adm_base/functions}
21
22 # Source functions
23 . $adm_fpath/common
24
25 # Set machines
26 machines=${machines:-$adm_base/data/machines}
27
28 if [ ! -f $machines ]; then
29   print -u2 "$me: Error: Unable to find $machines file!"
30   exit 1
31 fi
32
33 total_machines=$(grep -cv "^#" $machines)
34 total_infrastructure=$(grep -v "^#" $machines | grep -c ":Infrastructure:")
35 total_test=$(grep -v "^#" $machines | grep -c ":Test:")
36 total_desktop=$(grep -v "^#" $machines | grep -c ":Desktop:")
37 total_unknown=$(grep -v "^#" $machines | cut -f9 -d: | grep -c "Unknown")
38 total_5_6=$(grep -v "^#" $machines | grep -c "5\.6\:")
39 total_5_6_other=$(grep -v "^#" $machines | grep -c "5\.6[^:]")
40 total_11_00=$(grep -v "^#" $machines | grep -c "B\.11\.00")
41 total_11_11=$(grep -v "^#" $machines | grep -c "B\.11\.11")
42 total_10_30=$(grep -v "^#" $machines | grep -c "B\.10\.30")
43 total_10_20=$(grep -v "^#" $machines | grep -c "B\.10\.20")
44 total_10_10=$(grep -v "^#" $machines | grep -c "B\.10\.10")
45 total_10_01=$(grep -v "^#" $machines | grep -c "B\.10\.01")
46 total_4_0_cc=$(grep -v "^#" $machines | grep -c "4\.0\:")
47 total_3_2_cc=$(grep -v "^#" $machines | grep -c "3\.2\:")
48 total_3_2_1_cc=$(grep -v "^#" $machines | grep -c "3\.2\.1")
49 total_eclipse01=$(grep -v "^#" $machines | awk -F: '{print $11}' | grep -c
50 "01")
51 total_eclipse02=$(grep -v "^#" $machines | awk -F: '{print $11}' | grep -c
52 "02")
53 total_eclipse03=$(grep -v "^#" $machines | awk -F: '{print $11}' | grep -c
54 "03")
55 total_eclipseno=$(grep -v "^#" $machines | awk -F: '{print $11}' | grep -c
56 "No Eclipse")
57 let total_cc=total_4_0_cc+total_3_2_cc+total_3_2_1_cc
58
59 print "PDL Machines"
60 let
61 hp_machines=total_11_00+total_11_11+total_10_30+total_10_20+total_10_10+total_10_01
62
63 if [ $hp_machines -gt 0 ]; then
64   print " "
65   print "HP-UX Versions:"
66   print - ---------------
67   if [ $total_11_00 -gt 0 ]; then
68     print "Total 11.00 .................. $total_11_00"
69   fi
70   if [ $total_11_11 -gt 0 ]; then
71     print "Total 11.11 .................. $total_11_11"
72   fi
73   if [ $total_10_30 -gt 0 ]; then
74     print "Total 10.30 .................. $total_10_30"
75   fi
76   if [ $total_10_20 -gt 0 ]; then
77     print "Total 10.20 .................. $total_10_20"
78   fi
79   if [ $total_10_10 -gt 0 ]; then
80     print "Total 10.10 .................. $total_10_10"
81   fi
82   if [ $total_10_01 -gt 0 ]; then
83     print "Total 10.01 .................. $total_10_01"
84   fi
85 fi
86 let sun_machines=total_5_6+total_5_6_other
87 if [ $sun_machines -gt 0 ]; then
88   print " "
89   print "Sun Versions:"
90   print - -------------
91   print "5.6 .......................... $total_5_6"
92   print "5.6 (other) .................. $total_5_6_other"
93 fi
94 print " "
95 print "Total Machines ............... $total_machines"
96 print " "
97 print "ClearCase Machines:"
98 print - -------------------
99 if [ $total_4_0_cc -gt 0 ]; then
100   print "4.0 .......................... $total_4_0_cc"
101 fi
102 if [ $total_3_2_cc -gt 0 ]; then
103   print "3.2 .......................... $total_3_2_cc"
104 fi
105 if [ $total_3_2_1_cc -gt 0 ]; then
106   print "3.2.1 ........................ $total_3_2_1_cc"
107 fi
108 if [ $total_eclipse01 -gt 0 ]; then
109   print "Eclipse 01 ................... $total_eclipse01"
110 fi
111 if [ $total_eclipse02 -gt 0 ]; then
112   print "Eclipse 02 ................... $total_eclipse02"
113 fi
114 if [ $total_eclipse03 -gt 0 ]; then
115   print "Eclipse 03 ................... $total_eclipse03"
116 fi
117 if [ $total_eclipseno -gt 0 ]; then
118   print "No Eclipse ................... $total_eclipseno"
119 fi
120 print " "
121 print "Total ClearCase Machines ..... $total_cc"
122
123 print
124 print "Machine classes:"
125 print - -----------------
126 print "Infrastructure ............... $total_infrastructure"
127 print "Test ......................... $total_test"
128 print "Desktop ...................... $total_desktop"
129 if [ $total_unknown -gt 0 ]; then
130   print "Unknown ...................... $total_unknown"
131 fi