File: 1008

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 (67 lines) | stat: -rwxr-xr-x 1,747 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
# PCP QA Test No. 1008
# Metrics class error handling, instance matching etc.
#
seq=`basename $0`
echo "QA output created by $seq"

status=1	# failure is the default!
. ./common.qt
host=`hostname`

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

which pmdumptext >/dev/null 2>&1 || _notrun "pmdumptext not installed"


# real QA test starts here
localhost=$host
otherhost=no.such.host.pcp.io
dump="pmdumptext -s 1"
tz=`pmprobe -v pmcd.timezone | sed -e 's/.* "//' -e 's/"//'`

_filter()
{
    sed \
    	-e "s/$otherhost[\.a-zA-Z0-9\-]*/OTHER_HOST/g" \
    	-e "s/local:/THIS_HOST/g" \
    	-e "s/$localhost[\.a-zA-Z0-9\-]*/THIS_HOST/g" \
	-e "s#$tz#TZ#"
}

echo "--- bogus host ---"
$dump -h bogus.host.i.hope hinv.ncpu 2>&1 | _filter
$dump bogus.host.i.hope:hinv.ncpu 2>&1 | _filter

echo "--- bogus archive ---"
$dump -a bogus_archive_i_hope 2>&1 | _filter
$dump bogus_archive_i_hope/hinv.ncpu 2>&1 | _filter

echo "--- bogus metric ---"
$dump go.faster 2>&1 | _filter

echo "--- bogus instance ---"
$dump "kernel.percpu.cpu.user[cpu999999]" 2>&1 | _filter

echo "--- metric has no instances ---"
$dump "hinv.ncpu[cpu0]" 2>&1 | _filter

echo "--- matching instances up to leading space ---"
$dump -imC "kernel.all.load[15,5,1]" 2>&1 | _filter

echo "--- two archives from the same host ---"
$dump -a archives/gap,archives/gap2 hinv.ncpu
$dump -a archives/gap2 archives/gap/hinv.ncpu

echo "--- no matching archive for host ---"
$dump -a archives/gap ${otherhost}:hinv.ncpu 2>&1 | _filter

echo "--- live and archive contexts ---"
$dump -h $localhost archives/gap/hinv.ncpu 2>&1 | _filter

echo "--- handle a string or aggregate metric ---"
$dump -f "TIME:" pmcd.timezone sample.sysinfo 2>&1 | _filter

# success, all done
status=0
exit