pmrep: update TODO, man page
[pcp.git] / qa / 1045
blobfd6faab2b2dd2126ccef4fc441d1872afab21599
1 #! /bin/sh
2 # PCP QA Test No. 1045 (formerly 526)
3 # exercise pmieconf version control (pmie config/rules)
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 which pmieconf >/dev/null 2>&1 || _notrun "No pmieconf binary installed"
19 _filter_date()
21 # ctime format: Thu Dec 17 15:26:15 1998
22 sed -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]/[DATE]/g' \
23 -e "s@$PCP_BINADM_DIR/pmpost@pmpost@"
26 _filter_pmie()
28 if [ $PCP_PLATFORM = darwin ]
29 then
30 sed \
31 -e '/metric swap.pagesout not in namespace/d' \
32 -e '/pmLookupName failed: Unknown metric name/d'
33 elif [ $PCP_PLATFORM = solaris ]
34 then
35 sed \
36 -e '/metric swap.pagesout not in namespace/d' \
37 -e '/metric filesys.used not in namespace/d' \
38 -e '/metric filesys.capacity not in namespace/d' \
39 -e '/metric filesys.used not in namespace/d' \
40 -e '/pmLookupName failed: Unknown metric name/d'
41 else
42 cat
46 status=1 # failure is the default!
47 $sudo rm -f $tmp.* $seq.full
48 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
50 # real QA test starts here
51 cat > $tmp.pmie <<EOF
52 // pmieconf-pmie 0 ./pconf
53 // end
54 EOF
55 echo
56 echo "=== check unsupported pmie config version"
57 pmieconf -F -r ./pconf -f $tmp.pmie 2>$tmp.stderr
58 sed -e "s/$seq-$$/[SEQ-PID]/g" $tmp.stderr
59 echo status=$?
61 cat > $tmp.pmie <<EOF
62 // pmieconf-pmie 1 ./pconf
63 // 1 filesys.buffer_cache threshold = 81.500%
64 // 1 filesys.buffer_cache hosts = "moomba wobbly"
65 // 1 filesys.buffer_cache sss_action = yes
66 // 1 filesys.buffer_cache user_command = "$PCP_BINADM_DIR/pmpost \$rule\$^ %v@%h"
67 // 1 filesys.buffer_cache holdoff = 20
68 // 2 filesys.buffer_cache holdoff = 20
69 // 2 filesys.buffer_cache delta = 1908
70 // 3 filesys.buffer_cache enabled = yes
71 // 1 filesys.capacity delta = 60
72 // 1 network.interface_bytes holdoff = 30
73 // 1 network.tcp_dropped_conns holdoff = 30
74 // 1 network.tcp_retransmit holdoff = 30
75 // end
77 // 1 cpu.aggregate_util
78 sample.float.one;
80 // 1 cpu.load_average
81 sample.float.ten;
83 // 1 filesys.buffer_cache
84 sample.float.hundred;
85 EOF
86 cp $tmp.pmie $tmp.pmie1
88 echo
89 echo "=== check that unneeded changes for unsupported versions are dumped"
90 pmieconf -r ./pconf -f $tmp.pmie1 m filesys.buffer_cache sss_action no >/dev/null
91 echo status=$?
92 pmie -C $tmp.pmie1 >$tmp.out 2>&1
93 sts=$?
94 _filter_pmie <$tmp.out
95 echo status=$sts
96 _filter_date < $tmp.pmie1
98 # APPEND this to the above file
99 cat >> $tmp.pmie <<EOF
100 // 2 filesys.buffer_cache
101 sample.drift;
103 sample.double.one;
105 cp $tmp.pmie $tmp.pmie2
107 echo
108 echo "=== check that changes for unsupported versions are moved to end"
109 pmieconf -r ./pconf -f $tmp.pmie2 m network.interface_bytes holdoff 40 >/dev/null
110 echo status=$?
111 pmie -C $tmp.pmie2 >$tmp.out 2>&1
112 sts=$?
113 _filter_pmie <$tmp.out
114 echo status=$sts
115 _filter_date < $tmp.pmie2
117 cp $tmp.pmie $tmp.pmie3
118 ( echo "before pmieconf"; ( [ -f ./pconf/cpu/load_average ] && ls -l ./pconf/cpu/load_average ) ) >>$seq.full
119 $sudo mv ./pconf/cpu/load_average $tmp.load
120 echo
121 echo "=== check that changes for unsupported rules are moved to end"
122 pmieconf -r ./pconf -f $tmp.pmie3 m filesys.buffer_cache holdoff 120 >/dev/null
123 ( echo "after pmieconf"; ( [ -f ./pconf/cpu/load_average ] && ls -l ./pconf/cpu/load_average ) ) >>$seq.full
124 $sudo mv $tmp.load ./pconf/cpu/load_average
125 ( echo "after restore"; ( [ -f ./pconf/cpu/load_average ] && ls -l ./pconf/cpu/load_average ) ) >>$seq.full
126 echo status=$?
127 pmie -C $tmp.pmie3 >$tmp.out 2>&1
128 sts=$?
129 _filter_pmie <$tmp.out
130 echo status=$sts
131 _filter_date < $tmp.pmie3
133 # debug check ... someone's clobbering pconf
135 if `which git >/dev/null 2>&1`
136 then
137 if git config --get remote.origin.url >/dev/null
138 then
139 # assume we're in a git repository, but may be older version of
140 # git (so -s does not work)
141 git status | grep pconf
145 # success, all done
146 status=0
147 exit