pmrep: update TODO, man page
[pcp.git] / qa / 374
blob6ad745fb94b5652b5118a5da28e15fde424116c0
1 #! /bin/sh
2 # PCP QA Test No. 374
3 # pmlogger (assorted) and pmlc (PCP 2.0) version compatibility
5 # 64-bit host version ... see 322 for 32-bit host version ... this
6 # one is optionally not run if you can't find a 64-bit host running
7 # pcp
9 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
12 seq=`basename $0`
13 echo "QA output created by $seq"
15 # get standard filters
16 . ./common.product
17 . ./common.filter
18 . ./common.check
20 rm -f $seq.full
21 rm -f $seq.out
22 if [ $PCP_VER -lt 30800 ]
23 then
24 ln $seq.out.1 $seq.out || exit 1
25 else
26 ln $seq.out.2 $seq.out || exit 1
29 _filter()
31 _filter_pmdumplog \
32 | sed \
33 -e '/^pmlogger .* on host .* is logging metrics from host .*/d' \
34 -e '/^PMCD host/d' \
35 -e '/^TIMESTAMP started/d' \
36 | $PCP_AWK_PROG '
37 /datax/ { skip = 3 }
38 skip > 0 { skip--; next }
39 $1 == "log" && $2 == "size" { if ($3 > 100 && $3 <= 200) $3 = "more than 100"
40 else if ($3 > 200 && $3 <= 300) $3 = "more than 200"
42 { print }'
45 _remote_signal()
47 host="$1"
48 pid="$2"
49 base="$3"
51 cat <<end-of-file >$tmp.cmd
52 . \$PCP_DIR/etc/pcp.env
53 \$PCP_BINADM_DIR/pmsignal -s TERM $pid
54 sleep 1
55 \$PCP_BINADM_DIR/pmsignal -s KILL $pid
56 test -k \$PCP_TMP_DIR/pmlogger || /usr/bin/sudo chmod o-w \$PCP_TMP_DIR/pmlogger 2>/dev/null
57 rm -f /tmp/$base.*
58 end-of-file
59 scp -q $tmp.cmd pcpqa@$host:$tmp.cmd
60 ssh -q pcpqa@$host /bin/sh $tmp.cmd >/dev/null 2>&1
61 ssh -q pcpqa@$host "rm -f $tmp.cmd"
64 _speak_to_me()
66 host=$1
67 pid=''
68 base=''
69 cat <<'End-of-File' | ssh -q pcpqa@$host sh >$tmp.tmp 2>&1
70 if [ -r $PCP_DIR/etc/pcp.env ]
71 then
72 . $PCP_DIR/etc/pcp.env
73 else
74 echo "Error: unable to read $PCP_DIR/etc/pcp.env!" >&2
75 exit 1
77 rm -f /tmp/$$.*
78 test -k $PCP_TMP_DIR/pmlogger || /usr/bin/sudo chmod o+w $PCP_TMP_DIR/pmlogger 2>/dev/null
79 ( pmlogger -T5min -L -c /dev/null -l /tmp/$$.log /tmp/$$ </dev/null >/dev/null 2>&1 ) &
80 echo pid=$! base=$$
81 End-of-File
83 echo >>$seq.full
84 echo "From ssh to $host ..." >>$seq.full
85 cat $tmp.tmp >>$seq.full
87 eval `cat $tmp.tmp`
89 if [ -z "$pid" ]
90 then
91 echo "Arrgh ... failed to get remote pmlogger pid for host $host"
92 exit
95 if [ -z "$base" ]
96 then
97 echo "Arrgh ... failed to get remote archive basename for host $host"
98 exit
101 for i in 1 2 3 4 5 6 7 8 9 10
103 if echo quit | pmlc -h $host $pid 2>&1 | grep 'Connected to' >/dev/null
104 then
105 break
106 else
107 if [ $i = 10 ]
108 then
109 echo "Arrgh ... pmlogger (pid=$pid) on host $host failed to start after 20 seconds"
110 exit 1
113 sleep 2
114 done
116 # the success cases
118 cat <<End-of-File | pmlc 2>&1 | _filter
119 connect $pid@$host
120 status
121 new volume
122 status
123 flush
124 # singular, all instances
125 query { pmcd.simabi pmcd.control.register }
126 # some instances
127 query pmcd.agent.type ["sample" "pmcd" "sampledso"]
128 # non-leaf
129 query pmcd.pdu_in
130 # logging
131 log mandatory on once pmcd.agent.type ["sample" "pmcd"]
132 End-of-File
134 # stopping and starting again should be enough to allow pmlogger
135 # to have logged the metrics from the last request ... except the
136 # pmlc control port socket may not have been ripped down, so
137 # sleep some
139 sleep 2
141 cat <<End-of-File | pmlc 2>&1 | _filter
142 connect $pid@$host
143 log mandatory off pmcd.agent.type ["sampledso"]
144 query pmcd.agent.type ["sample" "pmcd" "sampledso"]
145 End-of-File
147 # the failures
149 # echo "log mandatory on once proc" | pmlc -h $host $pid -D1
150 echo "connect 0@$host" | pmlc 2>&1 | _filter
152 # cleanup
154 if [ ! -z "$host" ]
155 then
156 _remote_signal $host $pid $base
157 pid=''
158 base=''
162 _cleanup()
164 if $need_clean
165 then
166 if [ ! -z "$pid" -a ! -z "$base" -a ! -z "$host" ]
167 then
168 _remote_signal $host $pid $base
169 pid=''
170 base=''
172 need_clean=false
174 rm -f $tmp.*
177 need_clean=true
178 status=1 # failure is the default!
179 trap "_cleanup; exit \$status" 0 1 2 3 15
181 host=''
182 pid=''
183 base=''
185 # the v1 host may be on the other side of the planet
187 PMCD_CONNECT_TIMEOUT=30
188 PMCD_REQUEST_TIMEOUT=30
189 export PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT
191 # real QA test starts here
193 for type in '-b 64 -v pcp\>=2'
195 cmd="./getpmcdhosts -L -n 1 $type 2>/dev/null"
196 host=`eval $cmd`
197 if [ -z "$host" ]
198 then
199 echo "Cannot find a 64-bit host running PCP" >$seq.notrun
200 need_clean=false
201 exit
202 else
203 echo
204 echo "=== pmlogger host type: $type ===" | sed 's/\\>//'
205 echo "$type => $host" >>$seq.full
206 _speak_to_me $host
208 done
210 # success, all done
211 status=0
212 exit