3 # Test pmlogrewrite use with pmlogger_daily
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 "$sudo rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 hostname
=`hostname | sed -e 's/\..*//'`
28 -e "s/for host $hostname/for host HOSTNAME/g" \
29 -e "s/for host localhost/for host HOSTNAME/g" \
30 -e "s/for host localhost\.localdomain/for host HOSTNAME/g" \
31 -e "s/for host local:/for host HOSTNAME/g" \
32 -e "s/for host \"localhost\"/for host \"HOSTNAME\"/g" \
33 -e "s/for host \"localhost\.localdomain\"/for host \"HOSTNAME\"/g" \
34 -e "s/for host \"local:\"/for host \"HOSTNAME\"/g" \
35 -e "s/for host \"$hostname\"/for host \"HOSTNAME\"/g" \
37 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/" \
38 -e '/^-rw-r--r--/s/-rw-r--r--.* 2011/-rw-r--r-- ... 2011/' \
39 -e `echo $PCP_LOG_DIR | sed -e 's/\//\\\\\//g'`'\/NOTICES/d'
47 cp archives
/rewrite.
$x $tmp.arch
/20111001.21.10.
$x
48 cp archives
/rewrite.
$x $tmp.arch
/20111001.22.10.
$x
50 echo "global { time -> +1:00:00 }" >$tmp.conf.
time
51 pmlogrewrite
-c $tmp.conf.
time -i $tmp.arch
/20111001.22.10
57 for ext
in 0 index meta
61 echo "Arrgh ... $1.$ext missing" | _filter
66 echo "Warning: $2.$ext missing" | _filter
73 |
sed -e '/^\[[0-9][0-9]* bytes]/d' >$tmp.
in
77 |
sed -e '/^\[[0-9][0-9]* bytes]/d' >$tmp.out
78 diff -u $tmp.
in $tmp.out | _filter
81 # take explicit control of the umask
87 # metrics in play from archives/rewrite archive
89 # sample.bin PMID: 29.0.6
90 # Data Type: 32-bit int InDom: 29.2 0x7400002
91 # Semantics: instant Units: none
92 # inst [100 or "bin-100"] value 100
93 # inst [200 or "bin-200"] value 200
94 # inst [300 or "bin-300"] value 300
95 # inst [400 or "bin-400"] value 400
96 # inst [500 or "bin-500"] value 500
97 # inst [600 or "bin-600"] value 600
98 # inst [700 or "bin-700"] value 700
99 # inst [800 or "bin-800"] value 800
100 # inst [900 or "bin-900"] value 900
102 # sampledso.double.hundred PMID: 30.0.27
103 # Data Type: double InDom: PM_INDOM_NULL 0xffffffff
104 # Semantics: instant Units: none
107 # Log Label (Log Format Version 2)
108 # Performance metrics from host bozo-laptop
109 # commencing Sat Oct 1 21:10:11.751 2011
110 # ending Sat Oct 1 21:10:12.128 2011
111 # Archive timezone: EST-10
114 cat <<End-of-File >$tmp.control
116 LOCALHOSTNAME n n $tmp.arch -c $tmp.pmlogger
119 cat <<End-of-File >$tmp.pmlogger
120 log mandatory on once { sample.bin }
123 # real QA test starts here
124 echo "+++ should just work ... +++" |
tee -a $seq.full
126 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
127 $sudo cat $tmp.log | _filter
129 mv $tmp.arch
/20111001.
* $tmp.ok
131 cat <<'End-of-File' | while read conf
132 global { hostname -> dreaming }
133 metric sampledso.double.hundred { type -> float }
136 echo "$conf" >$tmp.conf
137 echo |
tee -a $seq.full
138 echo "!!! $conf !!!" |
tee -a $seq.full
140 echo |
tee -a $seq.full
141 echo "+++ expect mismatch +++" |
tee -a $seq.full
143 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
144 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
145 $sudo cat $tmp.log | _filter
147 echo |
tee -a $seq.full
148 echo "+++ expect fix via local config file +++" |
tee -a $seq.full
150 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
151 cp $tmp.conf
$tmp.arch
/pmlogrewrite
152 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
153 $sudo cat $tmp.log | _filter
154 _cmp
$tmp.ok
/20111001 $tmp.arch
/20111001
156 echo |
tee -a $seq.full
157 echo "+++ expect fix via local symlink config file +++" |
tee -a $seq.full
159 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
160 ln -s $tmp.conf
$tmp.arch
/pmlogrewrite
161 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
162 $sudo cat $tmp.log | _filter
163 _cmp
$tmp.ok
/20111001 $tmp.arch
/20111001
165 echo |
tee -a $seq.full
166 echo "+++ expect fix via global config dir +++" |
tee -a $seq.full
168 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
169 $sudo mkdir
-p $PCP_VAR_DIR/config
/pmlogrewrite
170 $sudo cp $tmp.conf
$PCP_VAR_DIR/config
/pmlogrewrite
/qa.
$seq
171 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
172 $sudo cat $tmp.log | _filter
173 _cmp
$tmp.ok
/20111001 $tmp.arch
/20111001
174 $sudo rm -f $PCP_VAR_DIR/config
/pmlogrewrite
/qa.
$seq
176 echo |
tee -a $seq.full
177 echo "+++ expect fix via symlink to global config dir +++" |
tee -a $seq.full
179 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
180 $sudo mkdir
-p $PCP_VAR_DIR/config
/pmlogrewrite
181 $sudo cp $tmp.conf
$PCP_VAR_DIR/config
/pmlogrewrite
/qa.
$seq
182 ln -s $PCP_VAR_DIR/config
/pmlogrewrite
$tmp.arch
/pmlogrewrite
183 $sudo $PCP_BINADM_DIR/pmlogger_daily
-c $tmp.control
-V -l $tmp.log
184 $sudo cat $tmp.log | _filter
185 _cmp
$tmp.ok
/20111001 $tmp.arch
/20111001
186 $sudo rm -f $PCP_VAR_DIR/config
/pmlogrewrite
/qa.
$seq
190 echo |
tee -a $seq.full
191 echo "+++ expect fail when -r used and local config file present +++" |
tee -a $seq.full
193 pmlogrewrite
-c $tmp.conf
-i $tmp.arch
/20111001.22.10
194 cp $tmp.conf
$tmp.arch
/pmlogrewrite
195 $sudo $PCP_BINADM_DIR/pmlogger_daily
-r -c $tmp.control
-V -l $tmp.log
196 $sudo cat $tmp.log | _filter