3 # Exercise pmrep configuration and various reporting modes.
5 # Copyright (c) 2015-2016 Red Hat.
9 echo "QA output created by $seq"
13 $python -c "from pcp import pmapi" >/dev
/null
2>&1
14 [ $?
-eq 0 ] || _notrun
"python pcp pmapi module not installed"
15 $python -c "from collections import OrderedDict" >/dev
/null
2>&1
16 [ $?
-eq 0 ] || _notrun
"python collections OrderedDict module not installed"
18 which pmrep
>/dev
/null
2>&1 || _notrun
"pmrep not installed"
20 status
=1 # failure is the default!
21 $sudo rm -rf $tmp $tmp.
* $seq.full
22 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
27 -e "s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/HH:MM:SS/g" \
34 -e "s#$here#QAPATH#g" \
38 log
="--archive $here/archives/sample-secs -z"
39 log2
="--archive $here/archives/20130706 -z -O 30m"
41 # real QA test starts here
42 echo "== basic live mode reporting"
43 pmrep
-p -s 2 -t 0.25 sample.long.one | _live_filter
44 pmrep
-p -T 2sec
-t 1 sample.long.one | _live_filter
45 pmrep
-p -T 2sec
-t 0.8 sample.long.one | _live_filter
47 echo "== basic archive mode reporting"
48 pmrep
-z -p -s 5 -t 2 -P 2 --archive $here/archives
/sample-secs \
49 sample.seconds sample.milliseconds
51 echo "== basic configuration file handling"
52 echo > $tmp.config
<<EOF
55 source = www.example.com
59 pmrep
-s 5 -t 2 $log -c $tmp.config sample
61 echo "== exercise various output options"
62 pmrep
-s 5 -t 2 $log -c $tmp.config
-o stdout
-p -w 20 sample
64 pmrep
-s 5 -t 2 $log -c $tmp.config
-C -x sample | _path_filter
66 pmrep
-s 5 -t 2 $log -c $tmp.config
-G -H -U sample
68 echo "== exercise raw counter mode"
69 pmrep
-s 5 -t 2 $log -c $tmp.config
-r sample
71 echo "== exercise timezone setting"
72 pmrep
-s 5 -t 2 --archive $here/archives
/sample-secs
-p -Z UTC sample
74 echo "== exercise CSV and alternate delimiters"
75 pmrep
-s 5 -t 2 $log -c $tmp.config
-o csv
-p -P 1 sample
76 pmrep
-s 5 -t 2 $log -c $tmp.config
-o csv
--delimiter '|' sample | \
78 echo "== compare output-to-file versus stdout"
79 pmrep
-s 5 -t 2 $log -c $tmp.config
-o csv
--delimiter '|' -F $tmp.out2 sample
80 diff $tmp.out1
$tmp.out2
81 test $?
-eq 0 && echo ok
83 echo "== exercise repeated headers option"
84 pmrep
-s 5 -t 2 $log -E 2 sample.seconds
86 echo "== exercise units conversion options"
87 pmrep
-s 5 -t 2 $log2 -p -b MB
-P 0 mem.util.free mem.util.used
88 pmrep
-s 5 -t 2 $log2 -p -q "count x 10^-2" -P 0 -w 15 disk.dev.
read
89 pmrep
-s 5 -t 2 $log -p -y microsec sample
91 echo "== derived metrics configuration file"
92 cat > $tmp.derived
<<EOF
93 sample.combo = sample.seconds + (sample.milliseconds / 1000)
95 pmrep
-s 5 -t 2 $log -e $tmp.derived sample.combo
97 echo "== derived metrics directly on command line"
98 combo
="sample.combo = sample.seconds + (sample.milliseconds / 1000)"
99 pmrep
-s 5 -t 2 $log -e "$combo" sample.combo
101 echo "== extended existing sample configuration"
102 cp $tmp.config
$tmp.dconfig
103 cat >> $tmp.dconfig
<<EOF
107 pmrep
-s 5 -t 2 $log -e $tmp.derived
-c $tmp.dconfig sample
109 echo "== exercise good config version"
110 echo '[options]' > $tmp.vconfig
111 echo 'version = 1' >> $tmp.vconfig
112 cat $tmp.config
>> $tmp.vconfig
113 pmrep
-s 5 -t 2 $log -c $tmp.vconfig sample
114 echo "== exercise bad config version"
115 echo '[options]' > $tmp.vconfig
116 echo 'version = 99' >> $tmp.vconfig
117 cat $tmp.config
>> $tmp.vconfig
118 pmrep
-s 5 -t 2 $log -c $tmp.vconfig sample
120 echo "== un/interpolated archive mode reporting"
121 pmrep
-s 5 -t 2 $log2 -p mem.util.free
122 pmrep
-s 5 -t 2 $log2 -p -u mem.util.free
124 echo "== basic string value reporting"
125 # sets variable named $pcp_version
126 eval `pmprobe -v pmcd.version | sed -e 's/ 1 /=/g' -e 's/pmcd./pcp_/g'`
127 pmrep
-s 1 pmcd.version |
sed -e "s/$pcp_version/PCP_VERSION/g"