File: 1211

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (265 lines) | stat: -rwxr-xr-x 6,933 bytes parent folder | download
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/bin/sh
# PCP QA Test No. 1211
# Exercise basic pmseries loading and querying.
#
# Copyright (c) 2018-2019,2022 Red Hat.
#

seq=`basename $0`
echo "QA output created by $seq"
path=""

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
. ./common.keys

_check_series

_cleanup()
{
    [ -n "$options" ] && $keys_cli $options shutdown
    _restore_config $PCP_SYSCONF_DIR/pmseries
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=1	# failure is the default!
hostname=`hostname`
key_server_port=`_find_free_port`
options="-p $key_server_port"

trap "_cleanup; exit \$status" 0 1 2 3 15

_filter_source()
{
    sed \
	-e "s,$here,PATH,g" \
    #end
}

_sort_context()
{
    sed -e 's/    Context: //g' -e 's/, /\n/g' | \
    LC_COLLATE=POSIX sort | \
    $PCP_AWK_PROG 'BEGIN { printf "    Context: " } {
	if (count == 0) {printf("%s", $0)} else {printf(", %s", $0)};
	count++
    } END { print out }'
}

# real QA test starts here
_save_config $PCP_SYSCONF_DIR/pmseries
$sudo rm -f $PCP_SYSCONF_DIR/pmseries/*

echo "Start test key server ..."
$key_server --port $key_server_port --save "" > $tmp.keys 2>&1 &
_check_key_server_ping "$key_server_port"
_check_key_server $key_server_port
echo

_check_key_server_version $key_server_port

echo "Verify basic load from proc archive"
pmseries $options --load "{source.path: \"$here/archives/proc\"}" | _filter_source
echo

echo "Error handling - load from bad absolute path"
pmseries $options --load "{source.path: \"/no/such/archive\"}"
echo

echo "Error handling - load from bad relative path"
pmseries $options --load "{source.path: \"no/such/archive\"}"
echo

echo "Verify pminfo and pmseries source and series match"
echo "=> pminfo"
pminfo -smd --archive $here/archives/proc kernel.all.load
echo "=> pmseries"
loaded=`pmseries $options "kernel.all.load{source.name:\"$here/archives/proc\"}"`
series=fecd5a4b4c6e1273eaa001287a6dd57b7bbd19f7
second=d51624d12da45900bfee2fd73f1e23f3ccabb784
source=2cd6a38f9339f2dd1f0b4775bda89a9e7244def6
if [ "$loaded" != "$series" ]
then
    echo "Series identifier mismatch - loaded $loaded, expected $series"
    exit 1
fi
pmseries $options -smd $series
echo

echo "List all metric names ..."
pmseries $options -m | LC_COLLATE=POSIX sort
echo

echo "List some metric names ..."
pmseries $options -m -g 'hinv*' | LC_COLLATE=POSIX sort
echo

echo "List all label names ..."
pmseries $options -l | LC_COLLATE=POSIX sort
echo

echo "List some label names ..."
pmseries $options -l -g 'h*' | LC_COLLATE=POSIX sort
echo

echo "List all context names ..."
pmseries $options -S | _filter_source | LC_COLLATE=POSIX sort
echo

echo "List some context names ..."
pmseries $options -S -g 'bozo*' | _filter_source | LC_COLLATE=POSIX sort
echo

echo "List all instance names ..."
pmseries $options -i | LC_COLLATE=POSIX sort
echo

echo "List some instance names ..."
pmseries $options -i -g 'sda*' | LC_COLLATE=POSIX sort
echo

echo "Perform simple name-based query ..."
pmseries $options kernel.all.pswitch | LC_COLLATE=POSIX sort
echo

echo "Perform simple label-based query ..."
pmseries $options 'kernel.all.load{hostname:"bozo-laptop"}' | LC_COLLATE=POSIX sort
echo

echo "Perform 40-character non-SeriesID query ..."
pmseries $options 'kernel.all.load{hostname: "bozo-laptop"}' | LC_COLLATE=POSIX sort
echo

echo "Perform simple instance-based query ..."
pmseries $options 'kernel.all.load{instance.name:"1 minute"}'
echo

echo "Perform globbing name-based query (1) ..."
pmseries $options 'kernel.all.ps*' | LC_COLLATE=POSIX sort
echo

echo "Perform globbing name-based query (2) ..."
pmseries $options 'kernel*pswitch' | LC_COLLATE=POSIX sort
echo

echo "Perform globbing name-based query (3) ..."
pmseries $options 'kernel.all.l*d' | LC_COLLATE=POSIX sort
echo

echo "Perform globbing name-based query (4) ..."
pmseries $options 'disk.partitions.blk*' | LC_COLLATE=POSIX sort
echo

echo "Perform globbing instance-based query (1) ..."
pmseries $options 'kernel.all.load{instance.name:"1*"}'
echo

echo "Perform globbing instance-based query (2) ... no result"
pmseries $options 'kernel.all.load{instance.name:"1\*"}'
echo "(expect no result)"
echo

echo "Perform globbing instance-based query (3) ..."
pmseries $options 'kernel.all.load{instance.name:"*1*"}'
echo

echo "Perform regex instance-based query (1) ..."
pmseries $options 'kernel.all.load{instance.name=~"1.*"}'
echo

echo "Perform regex instance-based query (2) ... no result"
pmseries $options 'kernel.all.load{instance.name=~"1\*"}'
echo "(expect no result)"
echo

# kernel.all.load from proc archive (host:bozo-laptop)
echo "Descriptor lookup for a given SeriesID ..."
pmseries $options --desc $series
echo

echo "Full InDom only for a given SeriesID ..."
pmseries $options --fullindom $series
echo

echo "Full PMID only for a given SeriesID ..."
pmseries $options --fullpmid $series
echo

echo "All three lookups for a given SeriesID ..."
pmseries $options -dIM $series
echo

echo "SourceID lookup for a given SeriesID ..."
pmseries $options --sources $source | _filter_source | _sort_context
echo

echo "Instances lookup for a given SeriesID ..."
pmseries $options --instances $series
echo

echo "Labels lookup for a given SeriesID ..."
pmseries $options --labels $series
echo

echo "All lookups for a given SeriesID ..."
pmseries $options --all $series
echo

echo "Labels lookup for two given SeriesIDs ..."
pmseries $options --labels $second $series
echo

echo "Values fetch for a single-valued query ..."
pmseries $options -Z UTC 'kernel.all.pswitch[count: 30]'
echo

echo "Values fetch with a one-second interval ..."
pmseries $options -Z UTC 'kernel.all.pswitch[delta: "1sec"]'
echo

echo "Values fetch with a two-second interval ..."
pmseries $options -Z UTC 'kernel.all.pswitch[delta: "2sec"]'
echo

echo "Values fetch for a multi-valued query ..."
pmseries $options -Z UTC 'kernel.all.load[count: 30]'
echo

echo "Multi-series lookups from a multi-series query ..."
pmseries $options 'disk.partitions.blk*' | \
	LC_COLLATE=POSIX sort | \
	tee -a $tmp.series
pmseries $options -a `cat $tmp.series`

echo "Time windowed values from a multi-series query ..."
pmseries $options -ZUTC -v -w 'count: 2' `cat $tmp.series`

echo "Perform simple source-based query ..."
pmseries $options 'kernel.all.pswitch{source.name:"bozo-laptop"}'
echo

echo "Error handling - descriptor for bad series identifier"
pmseries $options -d no.such.identifier
echo

echo "Error handling - metric name for bad series identifier"
pmseries $options -m no.such.identifier
echo

echo "Error handling - instance names for bad series identifier"
pmseries $options -i no.such.identifier
echo

echo "Error handling - label names for bad series identifier"
pmseries $options -l no.such.identifier
echo

echo "Error handling - query with no matching instance name"
pmseries $options 'kernel.all.load{instance.name == "5 mi*"}'

# success, all done
status=0
exit