summaryrefslogtreecommitdiff
path: root/qa/362
blob: 9cfedef00c88334fff0448b418a35e44a6a36e9d (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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#!/bin/sh
# PCP QA Test No. 362
#
# pmlogconf-setup exerciser
#
# 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

if [ -f $PCP_BINADM_DIR/pmlogconf-setup ]
then
    :
else
    echo "pmlogconf-setup not installed" >$seq.notrun
    echo "$seq: [not run] `cat $seq.notrun`"
    exit 0
fi

status=0	# success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

_doit()
{
    echo
    echo "--- group file ---"
    cat $tmp.grp
    $PCP_BINADM_DIR/pmlogconf-setup $tmp.grp 2>$tmp.err >$tmp.out
    xsts=$?
    echo "--- pmlogconf-setup stdout ---"
    sed -e "s;$tmp;TMP;" <$tmp.out
    echo "--- exit status=$xsts ---"
    if [ -s $tmp.err ]
    then
	echo "--- pmlogconf-setup stderr ---"
	sed -e "s;$tmp;TMP;" <$tmp.err
    fi
}

# real QA test starts here
cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad metric name
probe	no.such.metric
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - default everything
probe	sample.secret.foo.bar.three
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - no values
probe	sample.noinst values
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - has values
probe	sample.secret.foo.bar.three values
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - exists and non-default rules
probe	sample.secret.foo.bar.three exists ? available : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - exists and explicit default rules
probe	sample.secret.foo.bar.three values ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - exists and regex
probe	sample.secret.foo.bar.three ~ 3
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good metric name - exists and regex and non-default rules
probe	sample.secret.foo.bar.three ~ 3 ? available : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric name exists and regex - missing operand
probe	sample.secret.foo.bar.three ~ 
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - not ? as expected
probe	hinv.ncpu exists foobar
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - state rule missing an argument
probe	hinv.ncpu exists ? include :
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - state rule extra arguments
probe	hinv.ncpu exists ? include : exclude foo
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - state rule not : where expected
probe	hinv.ncpu exists ? include foo exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - state rule illegal success state
probe	hinv.ncpu exists ? foo : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Bad: metric exists - state rule illegal failure state
probe	hinv.ncpu exists ? available : foo
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - force available
force	available
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - regex match and include
probe	sample.string.hullo ~ ^h[eu]llo.world!$
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - notregex nomatch and exclude
probe	sample.bin !~ [1-9]00 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - if bazillions of CPUs include, else available
probe	hinv.ncpu > 1000 ? include : available
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin < 101 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin <= 100 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin == 400 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin != 100 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin >= 900 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#pmlogconf-setup 2.0
ident	Good - include
probe	sample.bin > 899 ? include : exclude
End-of-File
_doit

cat <<'End-of-File' >$tmp.grp
#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
_doit

# success, all done
exit