3 # pmlogrewrite - multiple -c options and -c dir 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
26 -e "s;/$seq-$$\.;/SEQ-PID.;g" \
27 -e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
28 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
35 echo "Arrgh ... $1.0 missing" | _filter
40 echo "Arrgh ... $2.0 missing" | _filter
43 pmdumplog
-z -a $1 |
tee -a $seq.full
>$tmp.
in
44 pmdumplog
-z -a $2 |
tee -a $seq.full
>$tmp.out
45 diff -u $tmp.
in $tmp.out | _filter
48 cat <<End-of-File >$tmp.conf.1
49 metric sample.ulong.bin_ctr {
50 indom -> NULL output MIN
52 units -> 1,0,0,BYTE,0,0
54 metric sample.ulonglong.bin_ctr {
55 indom -> NULL output MAX
57 units -> 1,0,0,BYTE,0,0
60 cat <<End-of-File >$tmp.conf.2
61 metric sampledso.double.bin_ctr {
62 indom -> NULL output AVG
65 metric sample.float.bin_ctr {
66 indom -> NULL output SUM
69 metric sample.longlong.bin_ctr {
70 indom -> NULL output FIRST
72 units -> 1,-1,0,KBYTE,SEC,0
75 cat <<End-of-File >$tmp.conf.3
76 indom 29.2 { inst 200 -> DELETE }
77 indom 30.2 { inst 800 -> DELETE }
80 cat $tmp.conf.?
>$tmp.conf.all
82 # real QA test starts here
84 # Note - correctness of this archive and config is established in QA 493
86 echo "=== baseline ==="
88 pmlogrewrite
-ws -c $tmp.conf.all archives
/rewrite
$tmp.baseline
2>&1 | _filter
91 echo "=== one config file ==="
93 pmlogrewrite
-ws -c $tmp.conf.all archives
/rewrite
$tmp.new
2>&1 | _filter
94 _cmp
$tmp.baseline
$tmp.new
97 echo "=== three config files ==="
99 pmlogrewrite
-ws -c $tmp.conf
.1 -c $tmp.conf
.2 -c $tmp.conf
.3 archives
/rewrite
$tmp.new
2>&1 | _filter
100 _cmp
$tmp.baseline
$tmp.new
103 echo "=== config dir with regular files ==="
105 cp $tmp.conf.
[123] $tmp.conf.dir
107 pmlogrewrite
-ws -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 | _filter
108 _cmp
$tmp.baseline
$tmp.new
111 echo "=== config dir with symlinks files and hidden files ==="
112 rm -f $tmp.conf.dir
/*
115 ln -s $tmp.conf.
$i $tmp.conf.dir
117 echo "metric sampledso.ulong.hundred { type -> U32 }" >$tmp.conf.dir
/.
$seq-$$.conf
.4
119 pmlogrewrite
-ws -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 | _filter
120 _cmp
$tmp.baseline
$tmp.new
123 echo "=== config dir unhide bad file ==="
124 mv $tmp.conf.dir
/.
$seq-$$.conf
.4 $tmp.conf.dir
/$seq-$$.conf
.4
126 # need to sort here because the order in which the files are processed
127 # depends in readdir() and is not deterministic
128 pmlogrewrite
-ws -c $tmp.conf.dir archives
/rewrite
$tmp.new
2>&1 \
129 | LC_COLLATE
=POSIX
sort \
131 _cmp
$tmp.baseline
$tmp.new