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
|
#! /bin/sh
# PCP QA Test No. 107
# Check pmlc "query" command against the primary pmlogger
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_filter()
{
# Note
# ... already using all instances ... line comes from dynamic PMNS
# support where sample.secret.foo.bar.max.redirect and
# sampledso.secret.foo.bar.max.redirect are aliases (i.e. have the
# same PMID) for pmcd.agent.status ... so the Warning is expected
#
echo "Checking for errors in pmlc output ..."
sed <$1 \
-e '/Warning: already using all instances for pmcd.agent.status/d' \
-e '/^$/d' \
-e '/^disk[^:]*$/d' \
-e '/^network[^:]*$/d' \
-e '/^kernel[^:]*$/d' \
-e '/^pmcd[^:]*$/d' \
-e '/^sample[^:]*$/d' \
-e '/^sampledso[^:]*$/d' \
-e '/^ mand on /d' \
-e '/^ mand off /d' \
-e '/^ adv off /d' \
-e '/^ adv on /d' \
-e '/^ (no instances)/d' \
-e '=' \
-e 's/^/ /' \
| sed -e '/^[0-9][0-9]*$/s//line &:/'
}
trap "rm -f $tmp.*; exit" 0 1 2 3 15
# don't need to regenerate config.default with pmlogconf
#
PMLOGGER_CHECK_SKIP_LOGCONF=yes; export PMLOGGER_CHECK_SKIP_LOGCONF
# Need healthy pmlogger connected to pmcd ... force this
#
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmcd || _exit 1
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmlogger || _exit 1
sleep 5
# real QA test starts here
pmlc <<End-of-File >>$tmp.tmp 2>&1
connect primary
query { disk network kernel pmcd sample sampledso }
End-of-File
cat $tmp.tmp >>$seq_full
$PCP_ECHO_PROG $PCP_ECHO_N "Expect at least one metric with logging state \"on\" ...""$PCP_ECHO_C"
if grep -E '^ (mand on )|(adv on )' $tmp.tmp >/dev/null
then
echo " PASS"
else
echo " FAIL"
fi
$PCP_ECHO_PROG $PCP_ECHO_N "Expect at least 250 metrics to be reported ...""$PCP_ECHO_C"
num=`grep -E '^(disk|network|kernel|pmcd|sample|sampledso)\.' $tmp.tmp | wc -l | sed -e 's/ //g'`
if [ $num -ge 250 ]
then
echo " PASS"
else
echo " FAIL (found $num)"
fi
_filter $tmp.tmp
|