/var/lib/pcp/testsuite/494 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 | #!/bin/sh
# PCP QA Test No. 494
# pmlogrewrite man page examples
#
# Copyright (c) 2011 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
which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s;$tmp;TMP;g" \
-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}
_cmp()
{
if [ ! -f $1.0 ]
then
echo "Arrgh ... cannot find $1.0" | _filter
return
fi
if [ ! -f $2.0 ]
then
echo "Arrgh ... cannot find $2.0" | _filter
return
fi
pmdumplog -z -a $1 | tee -a $seq.full >$tmp.in
pmdumplog -z -a $2 | tee -a $seq.full >$tmp.out
echo "pmdumplog diffs ..."
diff -u $tmp.in $tmp.out | _filter
}
_cmp2()
{
if [ ! -f $1.0 ]
then
echo "Arrgh ... cannot find $1.0" | _filter
return
fi
if [ ! -f $2.0 ]
then
echo "Arrgh ... cannot find $2.0" | _filter
return
fi
echo "--- input metadata ---"
pminfo -d -a $1 $3
echo "--- output metadata ---"
pminfo -d -a $2 $3
pmval -zr -f 1 -w 12 -U $1 $3 | tee -a $seq.full >$tmp.in
pmval -zr -f 1 -w 12 -U $2 $3 | tee -a $seq.full >$tmp.out
echo "pmval diffs ..."
diff -u $tmp.in $tmp.out | _filter
}
# real QA test starts here
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] spec
# double ->
src/rewrite global { time -> 30 }
src/rewrite global { time -> -23:59:59.999 }
src/rewrite indom 29.* { indom -> 109.* }
src/rewrite metric 30.*.* { pmid -> 123.*.* }
src/rewrite indom 29.* { indom -> 109.* } metric sample.bin { indom -> 109.2 }
src/rewrite indom 29.* { indom -> 109.* } metric sample.bin { indom -> 123.2 }
src/proc indom 60.2 { inst 1 -> 60 iname "1 minute" -> "60 second" inst 5 -> 300 iname "5 minute" -> "300 second" inst 15 -> 900 iname "15 minute" -> "900 second" }
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
_cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] spec|metric...
# double ->
src/babylon.pmview_v2 metric disk.dev.read { type -> U64 } metric disk.dev.write { type -> U64 } metric disk.dev.total { type -> U64 }|disk.dev.read disk.dev.write disk.dev.total
End-of-File
do
echo | tee -a $seq.full
metrics=`echo "$spec" | sed -e 's/.*|//'`
spec=`echo "$spec" | sed -e 's/|.*//'`
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
for m in $metrics
do
_cmp2 `echo $arch_args | sed -e 's/|.*//'` $tmp.new $m
done
done
echo | tee -a $seq.full
echo "=== proc metrics migration ===" | tee -a $seq.full
cat <<End-of-File >$tmp.config
# proc metrics are all in 7 clusters
metric 60.8.* { pmid -> 123.*.* }
metric 60.9.* { pmid -> 123.*.* }
metric 60.13.* { pmid -> 123.*.* }
metric 60.24.* { pmid -> 123.*.* }
metric 60.31.* { pmid -> 123.*.* }
metric 60.32.* { pmid -> 123.*.* }
metric 60.51.* { pmid -> 123.*.* }
# only one instance domain for Linux proc metrics
indom 60.9 { indom -> 123.0 }
End-of-File
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config src/proc $tmp.new 2>&1 | _filter
pminfo -m -a src/proc | LC_COLLATE=POSIX sort >$tmp.in
pminfo -m -a $tmp.new | LC_COLLATE=POSIX sort >$tmp.out
echo
echo "pmns diffs ..."
diff -u $tmp.in $tmp.out | _filter
for arg in -i -m
do
pmdumplog -z $arg src/proc >$tmp.in 2>$tmp.err
if [ -s $tmp.err ]
then
echo "stderr from pmdumplog -z $arg src/proc ..."
cat $tmp.err
fi
pmdumplog -z $arg $tmp.new >$tmp.out 2>$tmp.err
if [ -s $tmp.err ]
then
echo "stderr from pmdumplog -z $arg $tmp.new ..." | _filter
cat $tmp.err
fi
echo
echo "pmdumplog $arg diffs ..."
diff -u $tmp.in $tmp.out | _filter
done
# success, all done
exit
|