3 # Metrics class error handling, instance matching etc.
6 echo "QA output created by $seq"
8 status
=1 # failure is the default!
10 trap "_cleanup_qt; exit \$status" 0 1 2 3 15
12 which pmdumptext
>/dev
/null
2>&1 || _notrun
"pmdumptext not installed"
14 # real QA test starts here
16 otherhost
=no.such.
host.pcp.io
17 dump
="pmdumptext -s 1"
18 tz
=`pmprobe -v pmcd.timezone | sed -e 's/.* "//' -e 's/"//'`
23 -e "s/$otherhost[\.a-zA-Z0-9\-]*/OTHER_HOST/g" \
24 -e "s/$localhost[\.a-zA-Z0-9\-]*/THIS_HOST/g" \
28 echo "--- bogus host ---"
29 $dump -h bogus.
host.i.hope hinv.ncpu
2>&1 | _filter
30 $dump bogus.
host.i.hope
:hinv.ncpu
2>&1 | _filter
32 echo "--- bogus archive ---"
33 $dump -a bogus_archive_i_hope
2>&1 | _filter
34 $dump bogus_archive_i_hope
/hinv.ncpu
2>&1 | _filter
36 echo "--- bogus metric ---"
37 $dump go.faster
2>&1 | _filter
39 echo "--- bogus instance ---"
40 $dump "kernel.percpu.cpu.user[cpu999999]" 2>&1 | _filter
42 echo "--- metric has no instances ---"
43 $dump "hinv.ncpu[cpu0]" 2>&1 | _filter
45 echo "--- matching instances up to leading space ---"
46 $dump -imC "kernel.all.load[15,5,1]" 2>&1 | _filter
48 echo "--- two archives from the same host ---"
49 $dump -a archives
/gap
,archives
/gap2 hinv.ncpu
50 $dump -a archives
/gap2 archives
/gap
/hinv.ncpu
52 echo "--- no matching archive for host ---"
53 $dump -a archives
/gap
${otherhost}:hinv.ncpu
2>&1 | _filter
55 echo "--- live and archive contexts ---"
56 $dump -h $localhost archives
/gap
/hinv.ncpu
2>&1 | _filter
58 echo "--- handle a string or aggregate metric ---"
59 $dump -f "TIME:" pmcd.timezone sample.sysinfo
2>&1 | _filter