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