/var/lib/pcp/testsuite/023 is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #! /bin/sh
# PCP QA Test No. 023
# Test PMCD's PMDA timeout behaviour
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
ipv6=false
eval `pmconfig -L 2>/dev/null`
rm -f $seq.out
if [ "$ipv6" = "true" ]; then
ln $seq.out.2 $seq.out || exit 1
else
ln $seq.out.1 $seq.out || exit 1
fi
BINFMT=unknown-obj
which pmobjstyle >/dev/null 2>&1 && BINFMT=`pmobjstyle`
_filter_log()
{
sleep 3
_filter_pmcd_log <./pmcd.log \
| sed \
-e '/^DATA: from client/d' \
-e 's/Cannot open 000000660066: No such file or directory//' \
-e 's/^$//' \
-e '/^00[08]:/d' \
-e '/started PMDA ora_/d' \
-e '/cmd=\/usr\/pcp\/lib\/pmdaoracle7/d' \
-e '/started PMDA watch/d' \
-e '/cmd=\/usr\/pcp\/lib\/pmdawatch/d' \
-e '/pmGetPDU/{
s/\[[0-9][0-9]*]/[PID]/
s/from=.*/from=PID/
}' \
-e '/_pmHaveMoreInput/{
s/\[[0-9][0-9]*]/[PID]/
s/0x[^ ]*\([^ ][^ ][^ ]\)/ADDR...\1/
}' \
-e '/Piggy-back/{
s/0x[^ ]*\([^ ][^ ][^ ]\)/ADDR...\1/
s/from=.*/from=PID/
}' \
-e '/pmXmitPDU/s/\[[0-9][0-9]*]/[PID]/' \
-e '/pmResult/s/ .* numpmid/ ... numpmid/' \
-e '/value /{
s/value [0-9][0-9]*/value INTEGER/
}' \
-e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;g" \
-e 's#/usr/pcp/lib/mips#mips#' \
-e 's#/usr/lib/pcp/mips#mips#' \
-e "s/$BINFMT/ISA/g" \
-e '/access violation from host/d' \
-e '/endclient client.* No permission/d' \
-e 's/ while attempting to read 12 bytes out of 12 in .*on fd/ on fd/' \
-e 's/fd=[0-9][0-9]*/fd=FD/g' \
-e "s;$here/src/;;" \
-e '/UNIX_DOMAIN_SOCKET/d' \
-e '/unix:/d' \
| $PCP_AWK_PROG '
$3 ~ /^[0-9][0-9]*$/ { $3 = "A_PID"; }
/Host access list:/ { localHostPrinted = 0 }
$1 == "y" && $2 = "y" && $8 == "localhost" {
if (! localHostPrinted) {
localHostPrinted = 1
$5 = "IP-addr-in-hex"; $6 = "Host-mask"
}
else next
}
/pipe cmd=/ { $4 = "FD"; $5 = "FD" }
{ print }' \
| sed -e '/^pmcd 2 A_PID /s/ A_PID .*/ A_PID .../'
}
CONFIG=$PCP_PMCDCONF_PATH
TMP_CONFIG=$tmp/conf.tmp
SAVE_CONFIG=$tmp/pmcd.conf.save
[ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
PCP_PMLOGGERCONTROL_PATH="$PCP_SYSCONF_DIR/pmlogger/control"
LOGCONTROL="$PCP_PMLOGGERCONTROL_PATH"
SAVE_LOGCONTROL=$tmp/control.save
signal=$PCP_BINADM_DIR/pmsignal
_needclean=true
rm -rf $tmp $tmp.*
mkdir $tmp
chmod ugo+rwx $tmp
cd $tmp
SAVE_LOGGER=`_get_config pmlogger`
[ -f $LOGCONTROL ] && $sudo mv $LOGCONTROL $SAVE_LOGCONTROL
cleanup()
{
echo >>$here/$seq.full
echo "pmcd.log at cleanup" >>$here/$seq.full
cat pmcd.log >>$here/$seq.full
cd $here
if $_needclean
then
_needclean=false
$sudo $signal -a -s TERM pmcd
[ -f $SAVE_CONFIG ] && $sudo mv $SAVE_CONFIG $CONFIG
echo "=== restored $CONFIG ===" >>$here/$seq.full
cat $CONFIG >>$here/$seq.full
[ -f $SAVE_LOGCONTROL ] && $sudo mv $SAVE_LOGCONTROL $LOGCONTROL
echo "=== restored $LOGCONTROL ===" >>$here/$seq.full
cat $LOGCONTROL >>$here/$seq.full
[ ! -z "$SAVE_LOGGER" ] && _change_config pmlogger $SAVE_LOGGER
echo "Restart and ping pmcd ..."
unset PMCD_PORT # don't worry about preserving just get rid of it
unset PMCD_SOCKET
$sudo $PCP_RC_DIR/pcp restart \
| tee -a $here/$seq.full \
| _filterall_pcp_start \
| sed -e '/Waiting for pmcd to terminate/d'
_wait_for_pmcd
_wait_for_pmlogger
pmprobe pmcd.control.debug
sleepers=`ps $PCP_PS_ALL_FLAGS | grep '[d]umb_pmda' | $PCP_AWK_PROG '$3 == 1 { print $2 }'`
[ ! -z "$sleepers" ] && $sudo $signal -s TERM $sleepers
fi
rm -rf $tmp $tmp.*
}
trap "cleanup; exit \$status" 0 1 2 3 15
rm -f $here/$seq.full
# real QA test starts here
# Get a domain number for the 'fake_kernel' pmda
FAKE_DOM=`pminfo -m hinv.ncpu | $PCP_AWK_PROG '{split ($3,d,"."); print d[1];}'`
# pick a tcp port that is not in use
#
port=`_get_port tcp 4340 4350`
if [ -z "$port" ]
then
echo "Arrgh ... no free TCP port in the range 4340 ... 4350"
exit 1
fi
$sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
_change_config pmlogger off
$sudo $signal -a -s TERM pmie 2>/dev/null
$sudo $signal -a -s TERM pmlogger 2>/dev/null
# Create a fake namespace to force pminfo to query the fake agent
FAKE_NS=$tmp/$seq.fake_ns
echo 'root { hinv } ' > $FAKE_NS
echo 'hinv { ncpu 1:0:1 }' >> $FAKE_NS
# Make our own version of pmcd.conf with dummy agents that will time out.
# Copy the pmcd PMDA from the original pmcd.conf so that we can check pmcd's
# timeouts by storing into pmcd.control.timeout
# NOTE: none of the domains should clash with the pmcd PMDA (domain 2) or the
# sample agent (domain 254). These agents will be appended to the file.
#
cat <<EOF >$TMP_CONFIG
# Created by QA $seq
fake_irix 1 pipe binary $here/src/dumb_pmda -d 1 fake_irix
fake_proc 3 pipe binary $here/src/dumb_pmda -d 3 fake_proc
fake_cisco 5 pipe binary $here/src/dumb_pmda -d 5 fake_cisco
fake_six 6 pipe binary $here/src/dumb_pmda -d 6 fake_six
EOF
sed -n <$CONFIG >>$TMP_CONFIG \
-e '/^#/d' \
-e '/pmda_pmcd/s/[ ][ ]*/ /gp' \
-e '/pmdapmcd/s/[ ][ ]*/ /gp'
cat <<EOF >>$TMP_CONFIG
[access]
allow localhost : all;
disallow * : all;
EOF
$sudo mv $CONFIG $SAVE_CONFIG
$sudo mv $TMP_CONFIG $CONFIG
# very odd inode update problem on kenj-pc with one variant of the Linux
# 2.6.11 kernel ... this should be 100% benign for everyone else
#
sync
echo '$PCP_PMCDCONF_PATH contains:' | sed -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;"
echo '<BEGIN>'
sed <$CONFIG \
-e '/^pmcd 2 /s/2 .*/2 .../' \
-e "s;$here/src/;;"
echo '<END>'
# Note: start pmcd with -f so that its PID stays the same (no daemon)
#
PMCD_PORT=$port
PATH=$PATH:$here/src
PMCD_SOCKET=$tmp/pmcd.socket
export PMCD_PORT PATH PMCD_SOCKET
$PCP_PMCD_PROG -f -t 2 &
pmcd=$!
if [ -d $PCP_RUN_DIR ]
then
echo "$pmcd" >$tmp.tmp
$sudo cp $tmp.tmp $PCP_RUN_DIR/pmcd.pid
fi
# Sleep 3 sec for each fake pmda
sleep 15
_wait_for_pmcd
_filter_log
echo "pmcd.log after pmcd first started" >>$here/$seq.full
cat pmcd.log >>$here/$seq.full
# Get pmcd to stop the fake_kernel PMDA by asking for a metric from it.
# Sleep won't do anything, so it'll be timed out returning an IPC protocol
# failure. The next fetch for the domain will return a "No agent for
# domain..." error.
#
echo
echo "Restart dead agent test"
echo "Expect \"IPC protocol failure\" then \"No agent for domain...\":"
pminfo -n $FAKE_NS -d hinv.ncpu
pminfo -n $FAKE_NS -d hinv.ncpu
pminfo -f pmcd.agent.status
echo
# Check the functionality of pmcd.control.timeout. agenttimeout sets the pmcd
# agenttimeout for a specified domain to a given timeout, then fetches from
# the domain, expecting the agent to timeout and finally checks the timeout
# against the elapsed time for the fetch.
# Usage: agenttimeout domain timeout
#
echo
echo "pmcd.control.timeout tests"
$here/src/agenttimeout 5 3
$here/src/agenttimeout 6 8
#
# Be nice and set it back to 2 so that subsequent timeouts happen more quickly
#
pmstore pmcd.control.timeout 2
pminfo -f pmcd.agent.status
echo
# Get PMCD to restart any deceased agents. (The config file hasn't changed)
#
sleep 1
$signal -s HUP $pmcd
# Sleep 3 sec for each fake pmda in the config
sleep 15
_wait_for_pmcd
_filter_log
echo >>$here/$seq.full
echo "pmcd.log after pmcd SIGHUP" >>$here/$seq.full
cat pmcd.log >>$here/$seq.full
pminfo -f pmcd.agent.status
echo
# If agent not restarted then both messages will be "no agent for domain..."
#
echo "Expect \"IPC protocol failure\" then \"No PMCD agent...\":"
pminfo -n $FAKE_NS -d hinv.ncpu
pminfo -n $FAKE_NS -d hinv.ncpu
pminfo -f pmcd.agent.status
echo
status=0
|