pmrep: update TODO, man page
[pcp.git] / qa / 368
blob5e39ca03cc79f0966bd42e1464c0f7fa6914eac8
1 #!/bin/sh
2 # PCP QA Test No. 368
4 # pmlogconf - handle changes in installed group files
6 # Copyright (c) 2014 Red Hat.
7 # Copyright (c) 2010 Ken McDonell. All Rights Reserved.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 # get standard environment, filters and checks
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 [ -f $PCP_BINADM_DIR/pmlogconf-setup ] || _notrun pmlogconf-setup not installed
19 postgres=`pmprobe postgresql.stat.all_tables.seq_scan | awk '{ print $2 }'`
20 [ "$postgres" -ge 0 ] && _notrun "Test $seq sensitive to local postgres install"
22 rm -f $seq.out
23 if [ $PCP_PLATFORM = darwin ]
24 then
25 ln $seq.darwin $seq.out || exit 1
26 else
27 ln $seq.other $seq.out || exit 1
30 status=0 # success is the default!
31 $sudo rm -rf $tmp.* $seq.full
32 trap "rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
33 mkdir $tmp
35 # need to handle diff-c lines like this
36 # *** TMP.conf 2010-06-17 06:36:00.000000000 +1000
37 # --- /var/tmp/pcp.[a0Sg619P4/]ctl 2012-11-16 13:37:29.000000000 +0000
39 _filter()
41 sed \
42 -e "s;$tmp;TMP;g" \
43 -e '/^\*\*\* TMP\.conf/s/\.conf.*/.orig .../' \
44 -e '/^--- .*\/ctl/s/ .*/ TMP.new .../' \
45 -e '/^--- .*\.ctl/s/ .*/ TMP.new .../'
48 cat <<End-of-File >$tmp/01
49 #pmlogconf-setup 2.0
50 probe sample.long.ten == 10 ? include : exclude
51 ident qa group one
52 sample.long.ten
53 sample.long.hundred
54 sample.long.million
55 End-of-File
57 cat <<End-of-File >$tmp/02
58 #pmlogconf-setup 2.0
59 probe sample.ulong.ten != 10 ? include : exclude
60 ident qa group two
61 sample.ulong.ten
62 End-of-File
64 cat <<End-of-File >$tmp/03
65 #pmlogconf-setup 2.0
66 probe sample.longlong.ten >= 10 ? include : available
67 ident qa group three
68 sample.longlong.ten
69 End-of-File
71 cat <<End-of-File >$tmp/04
72 #pmlogconf-setup 2.0
73 probe sample.ulonglong.ten < 10 ? include : available
74 ident qa group four
75 sample.ulonglong.ten
76 End-of-File
78 # real QA test starts here
80 pmlogconf -d $tmp $tmp.conf \
81 | _filter
83 echo "--- start initial config file ---"
84 cat $tmp.conf | _filter
85 echo "--- end initial config file ---"
87 cat <<End-of-File >$tmp/00
88 #pmlogconf-setup 2.0
89 force include
90 ident qa group zero
91 sample.float.ten
92 End-of-File
94 cat <<End-of-File >$tmp/05
95 #pmlogconf-setup 2.0
96 force available
97 ident qa group five
98 sample.double.ten
99 End-of-File
101 rm $tmp/03
103 ( echo q ; echo '') | pmlogconf -v -d $tmp $tmp.conf \
104 | _filter
106 # reverse the condition
108 cat <<End-of-File >$tmp/02
109 #pmlogconf-setup 2.0
110 probe sample.ulong.ten <= 10 ? include : exclude
111 ident qa group two
112 sample.ulong.ten
113 End-of-File
115 # reverse the condition
117 cat <<End-of-File >$tmp/03
118 #pmlogconf-setup 2.0
119 probe sample.longlong.ten > 10 ? include : available
120 ident qa group three
121 sample.longlong.ten
122 End-of-File
124 ( echo q ; echo '') | pmlogconf -r -d $tmp $tmp.conf \
125 | _filter
127 # drop a metric
129 cat <<End-of-File >$tmp/01
130 #pmlogconf-setup 2.0
131 probe sample.long.ten ~ ^10$ ? include : exclude
132 ident qa group one
133 sample.long.ten
134 sample.long.million
135 End-of-File
137 # add a metric
139 cat <<End-of-File >$tmp/02
140 #pmlogconf-setup 2.0
141 probe sample.ulong.ten ~ 10 ? include : exclude
142 ident qa group two
143 sample.ulong.ten
144 sample.ulong.million
145 End-of-File
147 cat <<'End-of-File' >$tmp/98
148 #pmlogconf-setup 2.0
149 ident postgresql summary information
150 probe postgresql.stat.all_tables.seq_scan ? include : available
151 postgresql.stat.database
152 postgresql.stat.all_tables
153 postgresql.stat.all_indexes
154 postgresql.statio.all_tables
155 postgresql.statio.all_indexes
156 End-of-File
158 cat <<'End-of-File' >$tmp/99
159 #pmlogconf-setup 2.0
160 ident Example from pmlogconf(1) man page
161 ident ... more descripton
162 delta 1 minute
163 probe sample.secret.foo.one values ? include : exclude
164 sample.secret.foo.one
165 sample.secret.foo.bar # non-leaf in the PMNS
166 sample.colour [ red green ]
167 End-of-File
169 ( echo q ; echo '') | pmlogconf -d $tmp $tmp.conf \
170 | _filter
172 echo "--- start final config file ---"
173 cat $tmp.conf | _filter
174 echo "--- end final config file ---"
176 # success, all done
177 exit