4 # Derived metrics and PMNS operations
6 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
17 # For this test, don't load any global derived metric configs by default.
18 # So the PCP_DERIVED_CONFIG environment variable is set to an empty string.
19 export PCP_DERIVED_CONFIG
=""
21 status
=0 # success is the default!
22 $sudo rm -rf $tmp.
* $seq.full
23 trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15
25 # Derived metric expr dump from 0x8513a48...
26 # expr node 0x867eb68 type=PLUS left=0x867eb98 right=0x867ed28
29 cat $tmp.out
>>$seq.full
30 awk <$tmp.out
>$tmp.
sed '
32 $1 == "expr" && $2 == "node" && $3 ~ /^0x/ { print "s/" $3 "/<addr-" n ">/"; n++ }
34 echo "=== sed ===" >>$seq.full
35 cat $tmp.
sed >>$seq.full
36 echo "=== end sed ===" >>$seq.full
37 sed -f $tmp.
sed <$tmp.out \
39 -e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
40 -e 's/=0x0 /=(nil) /g' \
42 # -e 's/ val=[0-9][0-9]*/ val=<number>/g'
45 # expr node <addr-6> type=NAME left=(nil) right=(nil) save_last=1 [sample.pdu] master=0
47 # [0] inst=-1, val=49794
50 sed <$tmp.out
-e 's/val=/val /' \
53 /expr.*sample\./ { want=1; next }
54 want == 1 && $3 == "val" { if (seen[$4] != "y") {
55 print "s/ val=" $4 "$/ val=<value-" n ">/"
60 $1 == "expr" { want = 0 }'
61 echo "=== sed2 ===" >>$seq.full
62 cat $tmp.sed2
>>$seq.full
63 echo "=== end sed2 ===" >>$seq.full
66 -e '/pmGetChildren(name="")/s/ [0-9][0-9]* regular/ N regular/' \
67 -e '/pmGetChildren/s/returns [0-9][0-9]/returns N/'
70 # real QA test starts here
72 echo "HOST context ..." |
tee -a $seq.full
73 cat <<End-of-File >$tmp.config
74 myname.one = sample.long.one
75 myname.suba.two = 2*sample.long.one
76 myname.suba.three = 3*sample.long.one
77 myname.suba.subb.four = 4*sample.long.one
78 myname.suba.subb.subc.subd.five = 5*sample.long.one
79 myname.suba.subb.subc.subd.six = 6*sample.long.one
81 echo |
tee -a $seq.full
82 cat $tmp.config |
tee -a $seq.full
84 for args
in myname.suba.subb.subc.subd.six myname.suba.subb myname \
85 myname.one.bad myname.suba.subb.subc.bad
87 echo |
tee -a $seq.full
88 echo "=== -h localhost $args ===" |
tee -a $seq.full
89 pminfo
-h localhost
-c $tmp.config
$args >$tmp.out
2>&1
91 echo "=== -h localhost -f $args ===" |
tee -a $seq.full
92 pminfo
-h localhost
-c $tmp.config
-f $args >$tmp.out
2>&1
96 echo |
tee -a $seq.full
97 echo "ARCHIVE context ..." |
tee -a $seq.full
98 cat <<End-of-File >$tmp.config
99 sample.one = sample.longlong.one
100 sample.suba.two = 2*sample.longlong.one
101 sample.suba.three = 3*sample.longlong.one
102 sample.suba.subb.four = 4*sample.longlong.one
103 sample.suba.subb.subc.subd.five = 5*sample.longlong.one
104 sample.suba.subb.subc.subd.six = 6*sample.longlong.one
106 echo |
tee -a $seq.full
107 cat $tmp.config |
tee -a $seq.full
109 for args
in sample.suba.subb.subc.subd.six sample.suba.subb sample \
110 sample.one.bad sample.suba.subb.subc.bad
112 echo |
tee -a $seq.full
113 echo "=== -a archives/reduce-1 $args ===" |
tee -a $seq.full
114 pminfo
-a archives
/reduce-1
-c $tmp.config
$args >$tmp.out
2>&1
116 echo "=== -a archives/reduce-1 -f $args ===" |
tee -a $seq.full
117 pminfo
-a archives
/reduce-1
-c $tmp.config
-f $args >$tmp.out
2>&1
121 echo |
tee -a $seq.full
122 echo "LOCAL context ..." |
tee -a $seq.full
123 cat <<End-of-File >$tmp.config
124 sampledso.one = sampledso.longlong.one
125 sampledso.suba.two = 2*sampledso.longlong.one
126 sampledso.suba.three = 3*sampledso.longlong.one
127 sampledso.suba.subb.four = 4*sampledso.longlong.one
128 sampledso.suba.subb.subc.subd.five = 5*sampledso.longlong.one
129 sampledso.suba.subb.subc.subd.six = 6*sampledso.longlong.one
131 echo |
tee -a $seq.full
132 cat $tmp.config |
tee -a $seq.full
133 export PMDA_LOCAL_SAMPLE
=yes
135 for args
in sampledso.suba.subb.subc.subd.six sampledso.suba.subb sampledso \
136 sampledso.one.bad sampledso.suba.subb.subc.bad
138 echo |
tee -a $seq.full
139 echo "=== -L $args ===" |
tee -a $seq.full
140 $sudo_local_ctx pminfo
-L -c $tmp.config
$args >$tmp.out
2>&1
142 echo "=== -L -f $args ===" |
tee -a $seq.full
143 $sudo_local_ctx pminfo
-L -c $tmp.config
-f $args >$tmp.out
2>&1
146 NF == 0 { want = 0; next }
147 $1 == "sampledso.one" { print ""; want = 1 }
148 $1 ~ /^sampledso\.suba\./ { print ""; want = 1 }
150 echo "=== -n .../root -L ===" |
tee -a $seq.full
151 $sudo_local_ctx pminfo
-L -c $tmp.config
-n $PCP_VAR_DIR/pmns
/root
$args >$tmp.out
2>&1
153 echo "=== -n .../root ===" |
tee -a $seq.full
154 export PCP_DERIVED_CONFIG
=$tmp.config
155 src
/nameall
-n $PCP_VAR_DIR/pmns
/root
$args >$tmp.out
2>&1
156 _filter |
sed -e '/Name space load:/s/[0-9.]* msec/N.NN msec/'
157 unset PCP_DERIVED_CONFIG
160 echo |
tee -a $seq.full
161 echo "Splice-n-dice into existing PMNS ..." |
tee -a $seq.full
162 cat <<End-of-File >$tmp.config
163 derived = sample.long.one
164 derived_tree.ten = sample.long.ten
165 derived_tree.hundred = sample.long.hundred
166 derived_tree.sample.long.million = sample.long.million
167 sample.long.derived = sample.long.one
168 sample.long.foo.bar.derived = sample.long.one
170 echo |
tee -a $seq.full
171 cat $tmp.config |
tee -a $seq.full
175 # look for metric names containing "derived", apply a blacklist
178 -e '/perfevent.derived/d' \
182 for args
in "" derived derived_tree sample
184 echo |
tee -a $seq.full
185 echo "=== $args ===" |
tee -a $seq.full
186 pminfo
-c $tmp.config
$args 2>&1 | _filter_derived
189 echo |
tee -a $seq.full
190 echo "Check diags ..." |
tee -a $seq.full
191 cat <<End-of-File >$tmp.config
192 derived.tree.one = sample.long.one
193 derived.tree.ten = sample.long.ten
194 derived.tree.hundred = sample.long.hundred
195 derived.tree.a.million = sample.long.million
196 derived.tree.b.million = sample.long.million
197 derived.tree.b.cmillion = sample.long.million
198 sample.long.derived = sample.long.one
199 sample.long.foo.bar.derived = sample.long.one
202 export PCP_DERIVED_CONFIG
=$tmp.config
203 #debug# src/torture_pmns -Dall -h localhost derived.tree >$tmp.out 2>&1
204 src
/torture_pmns
-Dderive,appl1
-h localhost derived.tree
>$tmp.out
2>&1