pmrep: really drop non-ascii
[pcp.git] / qa / 364
blobf9cf28e07857fdbc8fceb10125550ac76bf87ebb
1 #!/bin/sh
2 # PCP QA Test No. 364
3 # pmlogconf metric accessibility
5 # Copyright (c) 2010 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 # see if unix domain sockets are available (permissions)
17 _get_libpcp_config
18 target="-h localhost"
19 $unix_domain_sockets && target="-h unix:"
21 status=0 # success is the default!
22 $sudo rm -rf $tmp.* $seq.full
23 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
25 _filter_solaris()
27 if [ $PCP_PLATFORM != solaris ]
28 then
29 cat
30 else
31 sed \
32 -e '/^disk.dev.avactive .* Unknown metric name/d' \
33 -e '/^network.icmp.* Unknown metric name/d' \
34 -e '/^network.igmp.* Unknown metric name/d' \
35 -e '/^network.ip.* Unknown metric name/d' \
36 -e '/^network.tcp.* Unknown metric name/d' \
37 -e '/^network.udp.* Unknown metric name/d' \
38 -e '/^filesys.* Unknown metric name/d' \
39 -e '/^swap .* Unknown metric name/d' \
40 -e '/^swap.pages.* Unknown metric name/d' \
41 -e '/^swapdev .* Unknown metric name/d' \
42 # solaris
46 _filter_darwin()
48 if [ $PCP_PLATFORM != darwin ]
49 then
50 cat
51 else
52 sed \
53 -e '/^disk\.dev\.avactive .* Unknown metric name/d' \
54 -e '/^disk\.all\.avactive .* Unknown metric name/d' \
55 -e '/^disk\.partitions\..* Unknown metric name/d' \
56 -e '/^hinv\.nnode .* Unknown metric name/d' \
57 -e '/^network\.icmp .* Unknown metric name/d' \
58 -e '/^network\.igmp .* Unknown metric name/d' \
59 -e '/^network\.ip .* Unknown metric name/d' \
60 -e '/^network\.tcp .* Unknown metric name/d' \
61 -e '/^network\.udp .* Unknown metric name/d' \
62 -e '/^network\.udplite .* Unknown metric name/d' \
63 -e '/^swap .* Unknown metric name/d' \
64 -e '/^swap\..* .* Unknown metric name/d' \
65 -e '/^swapdev .* Unknown metric name/d' \
66 -e '/^proc\..* Unknown metric name/d' \
67 -e '/^kernel\.all\.intr .* Unknown metric name/d' \
68 -e '/^kernel\.all\.nusers .* Unknown metric name/d' \
69 -e '/^kernel\.all\.pswitch .* Unknown metric name/d' \
70 -e '/^mem\.util\.bufmem .* Unknown metric name/d' \
71 -e '/^mem\.util\.cached .* Unknown metric name/d' \
72 # darwin
76 _filter_linux()
78 # pcp-atop uses metrics not supported on some kernels
79 if [ $PCP_PLATFORM != linux ]
80 then
81 cat
82 else
83 sed \
84 -e '/^network.softnet.* Metric not supported/d' \
85 -e '/^proc.namespaces.* Metric not supported/d' \
86 # linux
90 # remove all known platform-dependencies from output
91 # (ideally leaving any genuine failures behind)
93 _filter()
95 # these are always-on in older oss versions of pcp
96 sed \
97 -e '/^disk.dev.avg_disk.active .* metric name/d' \
98 -e '/^disk.all.avg_disk.active .* metric name/d' \
99 -e '/^disk.dev.bytes .* Unknown metric name/d' \
100 -e '/^disk.all.bytes .* Unknown metric name/d' \
101 -e '/^network.igmp .* Unknown metric name/d' \
102 -e '/^nfs.* Unknown metric name/d' \
103 -e '/^rpc.* Unknown metric name/d' \
104 -e '/^nfsclient.* Unknown metric name/d' \
105 -e '/^elasticsearch.search.all.* Metric not supported/d' \
106 -e '/^oracle.* Information not currently available/d' \
107 -e '/^swap.in .* Metric not supported/d' \
108 -e '/^swap.out .* Metric not supported/d' \
109 | _filter_linux | _filter_solaris | _filter_darwin
112 # real QA test starts here
113 pmlogconf $tmp.conf >$tmp.out 2>&1
114 cat $tmp.out >$seq.full
116 sed -e 's/:n:/:y:/' <$tmp.conf >$tmp.tmp
117 mv $tmp.tmp $tmp.conf
119 yes '' | pmlogconf $tmp.conf >$tmp.out
120 ( echo && echo "== TMP.OUT" ) >>$seq.full
121 cat $tmp.out >>$seq.full
122 ( echo && echo "== TMP.CONF") >>$seq.full
123 cat $tmp.conf >>$seq.full
124 ( echo && echo "== FILTERED") >>$seq.full
126 sed -n <$tmp.conf \
127 -e '/^[ ]/{
128 s/^[ ]*//
129 s/[ ].*//
130 /^#/d
132 }' \
133 | LC_COLLATE=POSIX sort \
134 | uniq \
135 | tee -a $seq.full \
136 | xargs pmprobe $target \
137 | _filter \
138 | $PCP_AWK_PROG '
139 $2 >= 0 { next }
140 { print }'
142 echo Silence is golden
143 # success, all done
144 exit