/var/lib/pcp/testsuite/256 is in pcp-testsuite 4.0.1-1.
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 | #!/bin/sh
# PCP QA Test No. 256
#
# Derived metrics and PMNS operations
#
# Copyright (c) 2009 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
# For this test, don't load any global derived metric configs by default.
# So the PCP_DERIVED_CONFIG environment variable is set to an empty string.
export PCP_DERIVED_CONFIG=""
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15
# Derived metric expr dump from 0x8513a48...
# expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
_filter()
{
cat $tmp.out >>$seq.full
awk <$tmp.out >$tmp.sed '
BEGIN { n = 0 }
$1 == "expr" && $2 == "node" && $3 ~ /^0x/ { print "s/" $3 "/<addr-" n ">/"; n++ }
{ next }'
echo "=== sed ===" >>$seq.full
cat $tmp.sed >>$seq.full
echo "=== end sed ===" >>$seq.full
sed -f $tmp.sed <$tmp.out \
| sed \
-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
-e 's/=0x0 /=(nil) /g' \
-e "s;$tmp;TMP;"
# -e 's/ val=[0-9][0-9]*/ val=<number>/g'
}
# expr node <addr-6> type=NAME left=(nil) right=(nil) save_last=1 [sample.pdu] master=0
# ...
# [0] inst=-1, val=49794
_filter2()
{
sed <$tmp.out -e 's/val=/val /' \
| awk >$tmp.sed2 '
BEGIN { n = 0 }
/expr.*sample\./ { want=1; next }
want == 1 && $3 == "val" { if (seen[$4] != "y") {
print "s/ val=" $4 "$/ val=<value-" n ">/"
n++
seen[$4] = "y"
}
}
$1 == "expr" { want = 0 }'
echo "=== sed2 ===" >>$seq.full
cat $tmp.sed2 >>$seq.full
echo "=== end sed2 ===" >>$seq.full
sed -f $tmp.sed2 \
| sed \
-e '/pmGetChildren(name="")/s/ [0-9][0-9]* regular/ N regular/' \
-e '/pmGetChildren/s/returns [0-9][0-9]/returns N/'
}
# real QA test starts here
echo "HOST context ..." | tee -a $seq.full
cat <<End-of-File >$tmp.config
myname.one = sample.long.one
myname.suba.two = 2*sample.long.one
myname.suba.three = 3*sample.long.one
myname.suba.subb.four = 4*sample.long.one
myname.suba.subb.subc.subd.five = 5*sample.long.one
myname.suba.subb.subc.subd.six = 6*sample.long.one
End-of-File
echo | tee -a $seq.full
cat $tmp.config | tee -a $seq.full
for args in myname.suba.subb.subc.subd.six myname.suba.subb myname \
myname.one.bad myname.suba.subb.subc.bad
do
echo | tee -a $seq.full
echo "=== -h localhost $args ===" | tee -a $seq.full
pminfo -h localhost -c $tmp.config $args >$tmp.out 2>&1
_filter
echo "=== -h localhost -f $args ===" | tee -a $seq.full
pminfo -h localhost -c $tmp.config -f $args >$tmp.out 2>&1
_filter
done
echo | tee -a $seq.full
echo "ARCHIVE context ..." | tee -a $seq.full
cat <<End-of-File >$tmp.config
sample.one = sample.longlong.one
sample.suba.two = 2*sample.longlong.one
sample.suba.three = 3*sample.longlong.one
sample.suba.subb.four = 4*sample.longlong.one
sample.suba.subb.subc.subd.five = 5*sample.longlong.one
sample.suba.subb.subc.subd.six = 6*sample.longlong.one
End-of-File
echo | tee -a $seq.full
cat $tmp.config | tee -a $seq.full
for args in sample.suba.subb.subc.subd.six sample.suba.subb sample \
sample.one.bad sample.suba.subb.subc.bad
do
echo | tee -a $seq.full
echo "=== -a archives/reduce-1 $args ===" | tee -a $seq.full
pminfo -a archives/reduce-1 -c $tmp.config $args >$tmp.out 2>&1
_filter
echo "=== -a archives/reduce-1 -f $args ===" | tee -a $seq.full
pminfo -a archives/reduce-1 -c $tmp.config -f $args >$tmp.out 2>&1
_filter
done
echo | tee -a $seq.full
echo "LOCAL context ..." | tee -a $seq.full
cat <<End-of-File >$tmp.config
sampledso.one = sampledso.longlong.one
sampledso.suba.two = 2*sampledso.longlong.one
sampledso.suba.three = 3*sampledso.longlong.one
sampledso.suba.subb.four = 4*sampledso.longlong.one
sampledso.suba.subb.subc.subd.five = 5*sampledso.longlong.one
sampledso.suba.subb.subc.subd.six = 6*sampledso.longlong.one
End-of-File
echo | tee -a $seq.full
cat $tmp.config | tee -a $seq.full
export PMDA_LOCAL_SAMPLE=yes
for args in sampledso.suba.subb.subc.subd.six sampledso.suba.subb sampledso \
sampledso.one.bad sampledso.suba.subb.subc.bad
do
echo | tee -a $seq.full
echo "=== -L $args ===" | tee -a $seq.full
$sudo_local_ctx pminfo -L -c $tmp.config $args >$tmp.out 2>&1
_filter
echo "=== -L -f $args ===" | tee -a $seq.full
$sudo_local_ctx pminfo -L -c $tmp.config -f $args >$tmp.out 2>&1
_filter \
| $PCP_AWK_PROG '
NF == 0 { want = 0; next }
$1 == "sampledso.one" { print ""; want = 1 }
$1 ~ /^sampledso\.suba\./ { print ""; want = 1 }
want == 1 { print }'
echo "=== -n .../root -L ===" | tee -a $seq.full
$sudo_local_ctx pminfo -L -c $tmp.config -n $PCP_VAR_DIR/pmns/root $args >$tmp.out 2>&1
_filter
echo "=== -n .../root ===" | tee -a $seq.full
export PCP_DERIVED_CONFIG=$tmp.config
src/nameall -n $PCP_VAR_DIR/pmns/root $args >$tmp.out 2>&1
_filter | sed -e '/Name space load:/s/[0-9.]* msec/N.NN msec/'
unset PCP_DERIVED_CONFIG
done
echo | tee -a $seq.full
echo "Splice-n-dice into existing PMNS ..." | tee -a $seq.full
cat <<End-of-File >$tmp.config
derived = sample.long.one
derived_tree.ten = sample.long.ten
derived_tree.hundred = sample.long.hundred
derived_tree.sample.long.million = sample.long.million
sample.long.derived = sample.long.one
sample.long.foo.bar.derived = sample.long.one
End-of-File
echo | tee -a $seq.full
cat $tmp.config | tee -a $seq.full
_filter_derived()
{
# look for metric names containing "derived", apply a blacklist
grep derived | \
sed \
-e '/perfevent.derived/d' \
#end
}
for args in "" derived derived_tree sample
do
echo | tee -a $seq.full
echo "=== $args ===" | tee -a $seq.full
pminfo -c $tmp.config $args 2>&1 | _filter_derived
done
echo | tee -a $seq.full
echo "Check diags ..." | tee -a $seq.full
cat <<End-of-File >$tmp.config
derived.tree.one = sample.long.one
derived.tree.ten = sample.long.ten
derived.tree.hundred = sample.long.hundred
derived.tree.a.million = sample.long.million
derived.tree.b.million = sample.long.million
derived.tree.b.cmillion = sample.long.million
sample.long.derived = sample.long.one
sample.long.foo.bar.derived = sample.long.one
End-of-File
cat $tmp.config
export PCP_DERIVED_CONFIG=$tmp.config
#debug# src/torture_pmns -Dall -h localhost derived.tree >$tmp.out 2>&1
src/torture_pmns -Dderive,appl1,appl2 -h localhost derived.tree >$tmp.out 2>&1
_filter | _filter2
# success, all done
exit
|