pmrep: update TODO, man page
[pcp.git] / qa / 066
bloba27e8b3e88cbee90fc442fef770974278eb5cf1c
1 #! /bin/sh
2 # PCP QA Test No. 066
3 # Test PMCD correctly restores original access control list after
4 # reconfiguration with a bad config file.
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard filters
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 rm -f $seq.out
18 _get_libpcp_config
19 if $ipv6 ; then
20 ln $seq.out.ipv6 $seq.out || exit 1
21 else
22 ln $seq.out.nonipv6 $seq.out || exit 1
25 trap "rm -f $tmp $tmp.*; exit" 0 1 2 3 15
26 rm -f $seq.full
28 # real QA test starts here
30 signal=$PCP_BINADM_DIR/pmsignal
31 log=$PCP_PMCDLOG_PATH
32 _needclean=true
33 LOCALHOST=`hostname`
35 _filter_log()
37 sleep 1
38 _filter_pmcd_log <$log \
39 | grep -v "^access violation from host" \
40 | grep -v "^endclient client" \
41 | sed \
42 -e 's/^$//' \
43 -e '/^00[08]:/d' \
44 -e '/^linux/s/\/var\//\/usr\//' \
45 -e '/^sample/s/.*/sample agent.../' \
46 -e 's;pcp/lib/mips_[^.]*\.;pcp/lib/ISA.;' \
47 -e '/client connection from/,/^$/d' \
48 -e 's/1 dso/X dso/' \
49 -e 's/2 dso/X dso/' \
50 -e 's/00001983 0000ffff/83190000 ffff0000/' \
51 -e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;g" \
52 -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;g" \
53 -e 's;$PCP_PMDAS_DIR/pmcd/;;' \
54 -e "s;\.$DSO_SUFFIX;.\$DSO_SUFFIX;g" \
55 -e '/UNIX_DOMAIN_SOCKET/d' \
56 -e '/unix:/d' \
57 | $PCP_AWK_PROG '
58 /localhost/ { sub(/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/,"MYIPADDR",$5)
59 sub(/^[0-9a-f:][0-9a-f:]*%[0-9a-z]+$/,"MYIPADDR",$5)
60 sub(/^[0-9a-f:][0-9a-f:]*$/,"MYIPADDR",$5)
61 sub(/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/,"MYHOSTMASK",$6)
62 sub(/^[0-9a-f:][0-9a-f:]*$/,"MYHOSTMASK",$6) }
63 { print }'
66 interrupt()
68 echo "Interrupted"
69 exit
72 if [ -d $PCP_LOG_DIR/pmlogger ]
73 then
74 LOGGING_DIR=$PCP_LOG_DIR/pmlogger
75 else
76 LOGGING_DIR=$PCP_LOG_DIR
79 cleanup()
81 if [ $_needclean ]
82 then
83 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
84 _restore_config $PCP_PMCDCONF_PATH
85 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
86 && $sudo sh $tmp.cmd
87 echo "Restarting pmcd"
88 echo "+++ restarting pmcd `date` +++" >>$seq.full
89 $sudo $PCP_RC_DIR/pcp restart | tee -a $seq.full | _filter_pcp_start
90 _wait_for_pmcd
91 _wait_for_pmlogger
92 _needclean=false
94 rm -f $tmp $tmp.*
97 _myfilter_config()
99 sed \
100 -e "s/$other1/OTHER1/" \
101 -e "s/$other2/OTHER2/" \
102 -e "s;$PCP_RC_DIR;\$PCP_RC_DIR;g" \
103 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;g" \
104 -e "/^irix/s/.*/[platform PMDA]/" \
105 -e "/^linux/s/.*/[platform PMDA]/" \
106 -e "/^darwin/s/.*/[platform PMDA]/" \
107 -e "/^solaris/s/.*/[platform PMDA]/" \
108 -e 's;$PCP_PMDAS_DIR/pmcd/;;' \
109 -e "s;\.$DSO_SUFFIX;.\$DSO_SUFFIX;g" \
110 | _filter_pmcd_log
113 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
114 && $sudo sh $tmp.cmd
116 trap "interrupt; cleanup; exit" 1 2 3 15
117 trap "cleanup; exit" 0
119 cat >$tmp <<End-of-File
120 # need the pmcd PMDA so that "init" restart can start pmlogger
121 # the OS PMDA has to be there so that the default logging config works
122 # created by QA 066
124 End-of-File
126 if [ $PCP_PLATFORM = linux ]
127 then
128 cat >>$tmp <<End-of-File
129 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
130 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
131 End-of-File
132 elif [ $PCP_PLATFORM = irix ]
133 then
134 cat >>$tmp <<End-of-File
135 irix 1 dso irix_init libirixpmda.so
136 pmcd 2 dso pmcd_init pmda_pmcd.so
137 End-of-File
138 elif [ $PCP_PLATFORM = darwin ]
139 then
140 cat >>$tmp <<End-of-File
141 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
142 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
143 End-of-File
144 elif [ $PCP_PLATFORM = solaris ]
145 then
146 cat >>$tmp <<End-of-File
147 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
148 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
149 End-of-File
150 else
151 echo "Error - need pmcd.conf setup for $PCP_PLATFORM"
152 exit 1
155 cat >>$tmp <<End-of-File
157 [access]
158 allow localhost: all;
159 disallow 131.25.*: store;
160 disallow *: all;
162 End-of-File
164 eval `./getpmcdhosts -L -n 2 \
165 | $PCP_AWK_PROG '{ if (NF == 2) printf("other1=%s other2=%s\n",$1,$2); }'`
167 if [ -z "$other1" -o -z "$other2" ]
168 then
169 echo "Cannot find two remote hosts running pmcd" >$seq.notrun
170 status=1
171 exit
174 _save_config $PCP_PMCDCONF_PATH
175 echo "+++ stopping pmcd `date` +++" >>$seq.full
176 $sudo $PCP_RC_DIR/pcp stop | tee -a $seq.full | _filter_pcp_stop
177 $sudo $signal -a pmgadgets pmchart pmview >/dev/null 2>&1
178 $sudo cp $tmp $PCP_PMCDCONF_PATH
179 # try to dodge bind: Address already in use
180 [ $PCP_PLATFORM = solaris ] && sleep 10
181 echo "+++ starting pmcd `date` +++" >>$seq.full
182 $sudo $PCP_RC_DIR/pcp start | tee -a $seq.full | _filter_pcp_start
183 echo "first config:"
184 _myfilter_config <$PCP_PMCDCONF_PATH
185 echo
187 cat >>$tmp <<End-of-File
189 disallow $other1: store;
190 allow $other2: all;
192 ddiissallow misspelt: all;
193 End-of-File
195 $sudo cp $tmp $PCP_PMCDCONF_PATH
196 echo "second config:"
197 _myfilter_config <$PCP_PMCDCONF_PATH
199 echo
200 $sudo $signal -a -s HUP pmcd
201 _wait_for_pmcd
203 # wait for PMCD to finish writing log (or 5 seconds)
204 for t in 1 2 3 4 5
206 if [ ! -f $log ]
207 then
208 echo "$log missing!"
209 ls -l `dirname $log`
210 cat ${log}.prev >>$seq.full
211 exit
212 elif [ `egrep '^Host access' $log | wc -l` = 2 ]
213 then
214 break
216 sleep 1
217 done
219 _filter_log