3 # pmlogrewrite - -q option
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 which pmlogrewrite
>/dev
/null
2>&1 || _notrun
"pmlogrewrite not installed"
18 status
=0 # success is the default!
19 $sudo rm -rf $tmp.
* $seq.full
20 trap "rm -rf $tmp.*; exit \$status" 0 1 2 3 15
27 -e "s;/$$\.;/PID.;g" \
28 -e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
29 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
35 for ext
in 0 index meta
39 echo "Arrgh ... $1.$ext missing" | _filter
44 echo "Warning: $2.$ext missing" | _filter
49 pmdumplog
-z -a $1 |
tee -a $seq.full
>$tmp.
in
50 pmdumplog
-z -a $2 |
tee -a $seq.full
>$tmp.out
51 diff -u $tmp.
in $tmp.out | _filter
57 # real QA test starts here
59 echo "=== metric not in archive ==="
60 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
61 metric kernel.all.load { pmid -> 1.2.3 }
65 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
67 | LC_COLLATE
=POSIX
sort
68 _cmp archives
/rewrite
$tmp.new
71 echo "=== + indom not in archive ==="
72 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
73 indom 1.2 { inst 0 -> 1 }
77 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
79 | LC_COLLATE
=POSIX
sort
80 _cmp archives
/rewrite
$tmp.new
83 echo "=== + empty global clause ==="
84 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
89 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
91 | LC_COLLATE
=POSIX
sort
92 _cmp archives
/rewrite
$tmp.new
95 echo "=== + no-change global hostname clause ==="
96 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
97 global { hostname -> bozo-laptop }
101 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
103 | LC_COLLATE
=POSIX
sort
104 _cmp archives
/rewrite
$tmp.new
107 echo "=== + no-change global time clause ==="
108 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
109 global { time -> 00:00:00.000000 }
113 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
115 | LC_COLLATE
=POSIX
sort
116 _cmp archives
/rewrite
$tmp.new
119 echo "=== + no-change global timezone clause ==="
120 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
121 global { tz -> "EST-10" }
125 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
127 | LC_COLLATE
=POSIX
sort
128 _cmp archives
/rewrite
$tmp.new
131 echo "=== + no-change indom clause ==="
132 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
136 iname "bin-300" -> "bin-300"
139 iname "bin-999" -> "bin-998"
145 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
147 | LC_COLLATE
=POSIX
sort
148 _cmp archives
/rewrite
$tmp.new
151 echo "=== + no-change metric clause ==="
152 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
153 metric sample.ulonglong.hundred {
155 name -> sample.ulonglong.hundred
164 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
166 | LC_COLLATE
=POSIX
sort
167 _cmp archives
/rewrite
$tmp.new
170 echo "=== + change pmid clause ==="
171 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
172 metric sample.longlong.bin_ctr { pmid -> 1.2.3 }
176 pmlogrewrite
-qsvw -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
178 | LC_COLLATE
=POSIX
sort
179 _cmp archives
/rewrite
$tmp.new