/var/lib/pcp/testsuite/chk.setup 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 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 | #! /bin/sh
#
# check PCP QA setup
#
# Copyright (c) 1997-2002 Silicon Graphics, Inc. All Rights Reserved.
#
tmp=/var/tmp/$$
trap "rm -f $tmp.*; exit 0" 0 1 2 3 15
PMCD_CONNECT_TIMEOUT=10
export PMCD_CONNECT_TIMEOUT
_fail_check()
{
echo "... check failed!"
exit 1
}
_check_pmcd()
{
# 5 seconds default seems like a reasonble max time to establish
# contact
rm -f $tmp.ok
_can_wait=5
_host=$1
_i=0
_dead=true
while [ $_i -lt $_can_wait ]
do
_sts=`pmprobe -n $PCP_VAR_DIR/pmns/root_pmcd -h $_host pmcd.numclients 2>/dev/null | $PCP_AWK_PROG '{print $2}'`
if [ "${_sts:-0}" -gt 0 ]
then
# numval really > 0, we're done
#
_dead=false
break
fi
sleep 1
_i=`expr $_i + 1`
done
if $_dead
then
:
else
touch $tmp.ok
fi
}
_check_pmlogger()
{
$PCP_ECHO_PROG $PCP_ECHO_N "Contacting primary logger at $host ... ""$PCP_ECHO_C"
if pmlc -P -h $1 </dev/null 2>/dev/null | grep 'Connected to primary pmlogger' >/dev/null
then
echo "OK"
else
echo "not running"
fi
}
_check_pmdas()
{
rm -f $tmp.bad
$PCP_ECHO_PROG $PCP_ECHO_N "Checking installed PMDAS at $host ... ""$PCP_ECHO_C"
pminfo -f -h $1 pmcd.agent.type >$tmp.tmp
for pmda in sample simple
do
if grep '"'$pmda'"' $tmp.tmp >/dev/null
then
:
else
echo $pmda >>$tmp.bad
fi
done
if [ -f $tmp.bad ]
then
echo "missing - `cat $tmp.bad`"
else
echo "OK"
fi
}
# files in the PCP distribution
#
fail=false
for file in $PCP_DIR/etc/pcp.env
do
if [ ! -f "$file" ]
then
echo "$0: Error: cannot file \"$file\" from the PCP distribution"
fail=true
fi
done
# files in the PCP QA distribution
#
for file in mk.localconfig common.rc common.setup common.product \
common.check common.config
do
if [ ! -f "$file" ]
then
echo "$0: Error: cannot file \"$file\" from the PCP QA distribution"
fail=true
fi
done
# no point proceeding if any of these files are missing
#
$fail && _fail_check
if [ ! -f localconfig ]
then
# need localconfig
#
if ./mk.localconfig
then
if [ -f GNUmakefile.install ]
then
# running QA in the tree
${MAKE:-make} -f GNUmakefile.install setup | egrep -v 'Entering|Leaving|Nothing'
else
${MAKE:-make} setup | egrep -v 'Entering|Leaving|Nothing'
fi
else
echo "$0: Error: need to fix failure in mk.localconfig"
_fail_check
fi
if [ ! -f localconfig ]
then
echo "$0: Error: mk.localconfig failed to create the file \"localconfig\""
_fail_check
fi
fi
# source hierarchy
#
# common.product
# common.setup
# common.rc
# $PCP_DIR/etc/pcp.env
# localconfig
# common.check
# common.config
# localconfig
#
. ./common.product
. ./common.check
. ./common.config
# things we care about from $PCP_DIR/etc/pcp.env
#
# files
#
for var in PCP_PMCDCONF_PATH PCP_PMCDOPTIONS_PATH
do
eval file=\$$var
if [ -z "$file" ]
then
echo "$0: Error: variable \$$var is not set from $PCP_DIR/etc/pcp.env"
fail=true
else
if [ ! -f "$file" ]
then
echo "$0: Error: cannot find file \"$file\" (\$$var from $PCP_DIR/etc/pcp.env)"
fail=true
fi
fi
done
# programs
#
for var in PCP_AWK_PROG
do
eval prog=\$$var
# strip args if any
prog=`echo $prog | sed -e 's/ .*//'`
if [ -z "$prog" ]
then
echo "$0: Error: variable \$$var is not set from $PCP_DIR/etc/pcp.env"
fail=true
else
if which $prog >/dev/null 2>&1
then
:
else
echo "$0: Error: cannot find executable program \"$prog\" (\$$var from $PCP_DIR/etc/pcp.env)"
fail=true
fi
fi
done
# directories
#
# these ones should be in $PCP_DIR/etc/pcp.conf but are not currently used in
# the QA scripts, but are tested here for completeness
#
xtra="PCP_LIB_DIR PCP_INC_DIR PCP_MAN_DIR"
#
for var in PCP_RC_DIR PCP_PMDAS_DIR PCP_VAR_DIR PCP_DEMOS_DIR PCP_LOG_DIR \
PCP_BIN_DIR PCP_BINADM_DIR PCP_TMP_DIR PCP_SHARE_DIR PCP_DOC_DIR \
$xtra
do
eval dir=\$$var
if [ -z "$dir" ]
then
echo "$0: Warning: variable \$$var is not set from $PCP_DIR/etc/pcp.env"
else
if [ ! -d "$dir" ]
then
echo "$0: Warning: cannot find directory \"$prog\" (\$$var from $PCP_DIR/etc/pcp.env)"
fi
fi
done
# common.rc will unconditionally set these ones, else fail ... so no need to
# check
# $PCP_PMCD_PROG
# $PCP_PMCDLOG_PATH
# localconfig will unconditionally set these ones ... no real sane checking
# I can do here!
# $PCP_PLATFORM (redundant, copied from $PCP_DIR/etc/pcp.conf)
# $PCP_VER
# $PCP_EOE_VER
# files from common.product
#
for var in PCP_PMCD_PATH
do
eval file=\$$var
if [ -z "$file" ]
then
echo "$0: Error: variable \$$var is not set from common.product"
fail=true
else
if [ ! -f "$file" ]
then
echo "$0: Error: cannot find file \"$file\" (\$$var from common.product)"
fail=true
fi
fi
done
# no point proceeding if any of these files are missing
#
$fail && _fail_check
if [ $# -eq 0 ]
then
# down to the common.config things ... these are the most contentious
# and the ones that need local tuning ...
#
# $PCPQA_CLOSE_X_SERVER is set here, but is hard to check so skip that one.
#
for var in PCPQA_FAR_PMCD PCPQA_HYPHEN_HOST
do
eval host=\$$var
if [ -z "$host" ]
then
echo "$0: Warning: variable \$$var is not set from common.config"
elif [ "$host" = "some-host" -o "$host" = "far_away_pmcd" ]
then
echo "$0: Warning: variable \$$var using bogus default from common.config"
else
# try to contact pmcd ...
#
$PCP_ECHO_PROG $PCP_ECHO_N "Contacting pmcd at $host ... ""$PCP_ECHO_C"
_check_pmcd $host
if [ -f $tmp.ok ]
then
echo "OK"
_check_pmlogger $host
_check_pmdas $host
else
echo "no response (warning)"
fi
fi
done
fi
# no point proceeding if any of these variables are not set
#
$fail && _fail_check
# the other pmcd's we think we can talk to ...
#
if [ -f GNUmakefile.install ]
then
# running QA in the tree
${MAKE:-make} -f GNUmakefile.instll qa_hosts >/dev/null 2>&1
else
${MAKE:-make} qa_hosts >/dev/null 2>&1
fi
if [ ! -f qa_hosts ]
then
echo "$0: Error: ${MAKE:-make} failed to create the file \"qa_hosts\""
_fail_check
fi
# failures here are not fatal ... some of the hosts may be off with the
# pixies
#
echo "hullo world" >$tmp.hullo
[ $# -eq 0 ] && set -- `cat qa_hosts`
for host
do
# try to contact remote pmcd ...
#
$PCP_ECHO_PROG $PCP_ECHO_N "Contacting remote pmcd at $host ... ""$PCP_ECHO_C"
_check_pmcd $host
if [ -f $tmp.ok ]
then
echo "OK"
# pmcd there, check primary pmlogger
_check_pmlogger $host
# and the installed pmdas
_check_pmdas $host
# if the host is there, then the login for pcpqa needs to be
# setup and and ssh/scp working without passwords
$PCP_ECHO_PROG $PCP_ECHO_N "Trying scp/ssh for login pcpqa at $host ... ""$PCP_ECHO_C"
echo "== ssh 1st rm ==" >$tmp.out
ssh pcpqa@$host rm -f chk.hullo >>$tmp.out 2>&1
echo "== scp -> $host ==" >>$tmp.out
scp $tmp.hullo pcpqa@$host:chk.hullo >>$tmp.out 2>&1
echo "== ssh cat ==" >>$tmp.out
ssh pcpqa@$host cat chk.hullo >$tmp.ans 2>>$tmp.out
echo "== ssh 2nd rm ==" >>$tmp.out
ssh pcpqa@$host rm -f chk.hullo >>$tmp.out 2>&1
if [ "`cat $tmp.ans`" = "`cat $tmp.hullo`" ]
then
echo "OK"
else
echo "failed"
fail=true
echo "Expected output: \"`cat $tmp.hullo`\""
echo "Actual output: \"`cat $tmp.ans`\""
echo "Diagnostic Log:"
cat $tmp.out
fi
# check remote shell's path includes the PCP binary directories
#
$PCP_ECHO_PROG $PCP_ECHO_N "Trying shell's path for login pcpqa at $host ... ""$PCP_ECHO_C"
echo "== ssh $host pmhostname ==" >$tmp.out
if ssh pcpqa@$host pmhostname >>$tmp.out 2>&1
then
echo "OK"
else
echo "failed"
fail=true
cat $tmp.out
fi
else
echo "no response (warning)"
fi
done
# down to pmcd on the local host
#
for host in localhost `hostname | sed -e 's/\..*//'` `_get_fqdn`
do
# try to contact pmcd ...
#
$PCP_ECHO_PROG $PCP_ECHO_N "Contacting local pmcd at $host ... ""$PCP_ECHO_C"
_check_pmcd $host
if [ -f $tmp.ok ]
then
echo "OK"
else
echo "no response (fatal)"
fail=true
fi
done
# no point proceeding if any of these cannot be contacted
#
$fail && _fail_check
echo "Check the sanity of these:"
$PCP_ECHO_PROG $PCP_ECHO_N " \$PCP_PLATFORM=$PCP_PLATFORM [y] ? ""$PCP_ECHO_C"
read ans
[ ! -z "$ans" -a "$ans" != y ] && _fail_check
$PCP_ECHO_PROG $PCP_ECHO_N " \$PCP_VERSION=$PCP_VERSION [y] ? ""$PCP_ECHO_C"
read ans
[ ! -z "$ans" -a "$ans" != y ] && _fail_check
exit 0
|