summaryrefslogtreecommitdiff
path: root/qa/364
blob: 14f780b940f6ab0576356aff34ab9c5fc5b65d53 (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
#!/bin/sh
# PCP QA Test No. 364
# pmlogconf metric accessibility
#
# 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

# see if unix domain sockets are available (permissions)
_get_libpcp_config
target="-h localhost"
$unix_domain_sockets && target="-h unix:"

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

_filter_solaris()
{
    if [ $PCP_PLATFORM != solaris ]
    then
	cat
    else
	sed \
	    -e '/disk.dev.avactive .* Unknown metric name/d' \
	    -e '/network.icmp.* Unknown metric name/d' \
	    -e '/network.igmp.* Unknown metric name/d' \
	    -e '/network.ip.* Unknown metric name/d' \
	    -e '/network.tcp.* Unknown metric name/d' \
	    -e '/network.udp.* Unknown metric name/d' \
	    -e '/filesys.* Unknown metric name/d' \
	    -e '/nfs.* Unknown metric name/d' \
	    -e '/rpc.* Unknown metric name/d' \
	    -e '/swap .* Unknown metric name/d' \
	    -e '/swap.pages.* Unknown metric name/d' \
	    -e '/swapdev .* Unknown metric name/d' \
	# solaris
    fi
}

_filter_darwin()
{
    if [ $PCP_PLATFORM != darwin ]
    then
	cat
    else
	sed \
	    -e '/disk.dev.avactive .* Unknown metric name/d' \
	    -e '/network.icmp.* Unknown metric name/d' \
	    -e '/network.igmp.* Unknown metric name/d' \
	    -e '/network.ip.* Unknown metric name/d' \
	    -e '/network.tcp.* Unknown metric name/d' \
	    -e '/network.udp.* Unknown metric name/d' \
	    -e '/nfs.* Unknown metric name/d' \
	    -e '/swap .* Unknown metric name/d' \
	    -e '/swap.pages.* Unknown metric name/d' \
	    -e '/swapdev .* Unknown metric name/d' \
	# darwin
    fi
}

_filter_irix()
{
    # these are always-on in older oss versions of pcp
    sed \
	-e '/disk.dev.avg_disk.active .* metric name/d' \
	-e '/disk.all.avg_disk.active .* metric name/d' \
	-e '/disk.dev.bytes .* Unknown metric name/d' \
	-e '/disk.all.bytes .* Unknown metric name/d' \
	-e '/network.igmp .* Unknown metric name/d' \
	-e '/swap.in .* Metric not supported/d' \
	-e '/swap.out .* Metric not supported/d'
}

# remove all known platform-dependencies from output
# (ideally leaving any genuine failures behind)
#
_filter()
{
    _filter_irix | _filter_solaris | _filter_darwin
}

# real QA test starts here
pmlogconf $tmp.conf >$tmp.out 2>&1
cat $tmp.out >$seq.full

sed -e 's/:n:/:y:/' <$tmp.conf >$tmp.tmp
mv $tmp.tmp $tmp.conf

yes '' | pmlogconf $tmp.conf >$tmp.out
( echo && echo "== TMP.OUT" ) >>$seq.full
cat $tmp.out >>$seq.full
( echo && echo "== TMP.CONF") >>$seq.full
cat $tmp.conf >>$seq.full
( echo && echo "== FILTERED") >>$seq.full

sed -n <$tmp.conf \
    -e '/^[ 	]/{
s/^[ 	]*//
s/[ 	].*//
/^#/d
p
}' \
| LC_COLLATE=POSIX sort \
| uniq \
| tee -a $seq.full \
| xargs pmprobe $target \
| _filter \
| $PCP_AWK_PROG '
$2 >= 0		{ next }
		{ print }'

echo Silence is golden
# success, all done
exit