summaryrefslogtreecommitdiff
path: root/qa/211
blob: 5bbd33997abb77fc482e256ebd47536c0df59200 (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
#! /bin/sh
# PCP QA Test No. 211
# Check dynamic metrics work with PMAPI clients - DAEMON PMDA version
# See also 468 for the related tests using pmdumptext
#
# Copyright (c) 2009 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 grep -q ' RESERVED_DO_NOT_USE[ 	]*511' $PCP_VAR_DIR/pmns/stdpmid
then
    :
else
    echo "No support for dynamic PMNS entries" >$seq.notrun
    echo "$seq: [not run] `cat $seq.notrun`"
    exit 0
fi

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

_filter_probe()
{
    $PCP_AWK_PROG '
# sample ... sample.secret.foo.bar.max.redirect 8 0 0 0 0 0 0 4 0
/secret\.foo\.bar\.max\.redirect/	{ if ($2 > 3 )
					    print $1,"> 3 values ..."
					  else
					    print
					  next
					}
					{ print }'
}

_do() {
    echo
    echo "== $* =="
    pminfo $* | LC_COLLATE=POSIX sort
    pmprobe -v $* | _filter_probe | LC_COLLATE=POSIX sort 
}

# real QA test starts here

echo "PMNS traversal tests ..."
pminfo sample | grep '\.secret\.' | LC_COLLATE=POSIX sort
_do sample.secret
_do sample.secret.bar sample.secret.foo
_do sample.secret.foo.bar.grunt

echo
echo "pmval ..."
pmval -s 3 -t 0.1 sample.secret.foo.bar.grunt.five \
| sed -e '/^host:.*$/s/.*/HOST/' \

echo
echo "pmie ..."
echo 'sample.secret.foo.bar.four == 4 -> print "Bingo!"' \
| pmie -t 0.1 -T 0.3 2>&1 \
| _filter_pmie_log \
| sed -e '/.* Info: evaluator exiting/d' \
| sort -u

echo
echo "pmlogger ..."
cat <<'End-of-File' >$tmp.config
log mandatory on 100 msec {
    sample.secret.bar
    sample.secret.foo.one
    sample.secret.foo.two
    sample.secret.foo.bar.three
    sample.secret.foo.bar.four
    sample.secret.foo.bar.grunt
}
End-of-File
pmlogger -T 0.3 -c $tmp.config -l $tmp.log $tmp
cat $tmp.log >>$seq.full
pmdumplog $tmp 2>&1 \
| tee -a $seq.full \
| _filter_pmdumplog \
| sed -e 1,4d


exit