/var/lib/pcp/testsuite/499 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 | #!/bin/sh
# PCP QA Test No. 499
# pmlogrewrite - -q option
#
# 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 -rf $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
tee -a $seq.full \
| sed \
-e "s;$tmp;TMP;g" \
-e "s;/$$\.;/PID.;g" \
-e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}
_cmp()
{
ok=true
for ext in 0 index meta
do
if [ ! -f "$1.$ext" ]
then
echo "Arrgh ... $1.$ext missing" | _filter
ok=false
fi
if [ ! -f "$2.$ext" ]
then
echo "Warning: $2.$ext missing" | _filter
ok=false
fi
done
$ok || return
pmdumplog -z -dilmst $1 | tee -a $seq.full >$tmp.in
pmdumplog -z -dilmst $2 | tee -a $seq.full >$tmp.out
diff -u $tmp.in $tmp.out | _filter
}
mkdir $tmp.conf.dir
i=0
# real QA test starts here
echo "=== metric not in archive ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric kernel.all.load { pmid -> 1.2.3 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + indom not in archive ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
indom 1.2 { inst 0 -> 1 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + empty global clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + no-change global hostname clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { hostname -> bozo-laptop }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + no-change global time clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { time -> 00:00:00.000000 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + no-change global timezone clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
global { tz -> "EST-10" }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + no-change indom clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
indom 29.2 {
# no change ones
indom -> 29.2
iname "bin-300" -> "bin-300"
inst 800 -> 800
# no match ones
iname "bin-999" -> "bin-998"
inst 123 -> 456
}
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + no-change metric clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric sample.ulonglong.hundred {
indom -> NULL
name -> sample.ulonglong.hundred
pmid -> 29.0.100
sem -> instant
type -> u64
units -> 0,0,0,0,0,0
}
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
echo
echo "=== + change pmid clause ==="
cat <<'End-of-File' >$tmp.conf.dir/conf.$i
metric sample.longlong.bin_ctr { pmid -> 1.2.3 }
End-of-File
i=`expr $i + 1`
rm -f $tmp.new.*
pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
| _filter \
| LC_COLLATE=POSIX sort
_cmp archives/rewrite $tmp.new
# success, all done
exit
|