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.
10 echo "QA output created by $seq"
12 # get standard filters
20 ln $seq.out.ipv6
$seq.out ||
exit 1
22 ln $seq.out.nonipv6
$seq.out ||
exit 1
25 trap "rm -f $tmp $tmp.*; exit" 0 1 2 3 15
28 # real QA test starts here
30 signal
=$PCP_BINADM_DIR/pmsignal
38 _filter_pmcd_log
<$log \
39 |
grep -v "^access violation from host" \
40 |
grep -v "^endclient client" \
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' \
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' \
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) }
72 if [ -d $PCP_LOG_DIR/pmlogger
]
74 LOGGING_DIR
=$PCP_LOG_DIR/pmlogger
76 LOGGING_DIR
=$PCP_LOG_DIR
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 \
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
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 "/^$PCP_PLATFORM/s/.*/[platform PMDA]/" \
105 -e 's;$PCP_PMDAS_DIR/pmcd/;;' \
106 -e "s;\.$DSO_SUFFIX;.\$DSO_SUFFIX;g" \
110 pmafm
$LOGGING_DIR/$LOCALHOST/Latest remove
>$tmp.cmd
2>&1 \
113 trap "interrupt; cleanup; exit" 1 2 3 15
114 trap "cleanup; exit" 0
116 cat >$tmp <<End-of-File
117 # need the pmcd PMDA so that "init" restart can start pmlogger
118 # the OS PMDA has to be there so that the default logging config works
123 # order MATTERS ... platform PMDA first, then pmcd PMDA
125 if [ $PCP_PLATFORM = linux
]
127 cat >>$tmp <<End-of-File
128 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
129 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
131 elif [ $PCP_PLATFORM = darwin
]
133 cat >>$tmp <<End-of-File
134 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
135 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
137 elif [ $PCP_PLATFORM = solaris
]
139 cat >>$tmp <<End-of-File
140 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
141 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
143 elif [ $PCP_PLATFORM = freebsd
]
145 cat >>$tmp <<End-of-File
146 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
147 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
150 echo "Error - need pmcd.conf setup for PCP_PLATFORM $PCP_PLATFORM"
154 cat >>$tmp <<End-of-File
157 allow localhost: all;
158 disallow 131.25.*: store;
163 eval `./getpmcdhosts -L -n 2 \
164 | $PCP_AWK_PROG '{ if (NF == 2) printf("other1=%s other2=%s\n",$1,$2); }'`
166 if [ -z "$other1" -o -z "$other2" ]
168 echo "Cannot find two remote hosts running pmcd" >$seq.notrun
173 _save_config
$PCP_PMCDCONF_PATH
174 echo "+++ stopping pmcd `date` +++" >>$seq.full
175 $sudo $PCP_RC_DIR/pcp stop |
tee -a $seq.full | _filter_pcp_stop
176 $sudo $signal -a pmgadgets pmchart pmview
>/dev
/null
2>&1
177 $sudo cp $tmp $PCP_PMCDCONF_PATH
178 # try to dodge bind: Address already in use
179 [ $PCP_PLATFORM = solaris
] && sleep 10
180 echo "+++ starting pmcd `date` +++" >>$seq.full
181 $sudo $PCP_RC_DIR/pcp start |
tee -a $seq.full | _filter_pcp_start
183 _myfilter_config
<$PCP_PMCDCONF_PATH
186 cat >>$tmp <<End-of-File
188 disallow $other1: store;
191 ddiissallow misspelt: all;
194 $sudo cp $tmp $PCP_PMCDCONF_PATH
195 echo "second config:"
196 _myfilter_config
<$PCP_PMCDCONF_PATH
199 $sudo $signal -a -s HUP pmcd
202 # wait for PMCD to finish writing log (or 5 seconds)
209 cat ${log}.prev
>>$seq.full
211 elif [ `egrep '^Host access' $log | wc -l` = 2 ]