3 # pmlc with new -p port and "connect port <n>" options
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
16 rem_host
=`./getpmcdhosts -L -n 1 -P -a sample 2>$seq.notrun`
17 [ -z "$rem_host" ] && _notrun
`cat $seq.notrun`
18 rm -f $seq.notrun
$seq.full
23 -e '/Performance Co-Pilot Logger/,/ <instance> /d' \
25 -e "s/ $pid / QA-PMLOGGER-PID /" \
26 -e "s/\[$pid\]/[QA-PMLOGGER-PID]/" \
27 -e "s/_logger_id=$pid/_logger_id=QA-PMLOGGER-PID/" \
28 -e 's/connect [0-9][0-9]* /connect PID /' \
29 -e "s/\[[0-9][0-9]*\]/[PMLOGGER-PID]/" \
30 -e "s/_logger_id=[0-9][0-9]*/_logger_id=PMLOGGER-PID/" \
31 -e "s/$rem_host/REMOTE-HOST/" \
32 -e "s/$myhost/LOCAL-HOST/" \
33 -e "s/local:/LOCAL-HOST/" \
34 -e "s/port $port /port PORT /" \
35 -e 's/logging metrics from host .*/logging metrics from host .../' \
36 -e '/^log started/d' \
37 -e '/^last log entry/d' \
38 -e '/^current time/d' \
40 -e '/^log size/s/.*/... status output .../'
43 # _speak_to_me <host> <pid> [<port>]
50 [ -n "$3" ] && _port
="$3"
51 echo "=== _host=$1 _logger_id=$2 ===" >$tmp.out
52 echo >>$here/$seq.full
53 echo "=== _host=$1 _logger_id=$2 _port=$_port ===" >>$here/$seq.full
56 pminfo
-f pmcd.pmlogger.port
>>$here/$seq.full
2>&1
58 pminfo
-h `echo $1 | sed -e 's/@//'` -f pmcd.pmlogger.port
>>$here/$seq.full
2>&1
60 # allow pmlogger socket to be closed and ready to accept()
63 cat <<End-of-File | pmlc $DEBUG -ei >>$tmp.out 2>&1
67 connect port $_port $1
74 cat $tmp.out
>>$here/$seq.full
76 |
sed -e "s/port $_port/port PORT/g"
81 echo "Remote host: $rem_host [pid: $rem_pid port: $rem_port]" >>$here/$seq.full
82 pminfo
-f -h $rem_host pmcd.pmlogger.port
>>$here/$seq.full
2>&1
83 ssh $rem_host '. /etc/pcp.env; $PCP_PS_PROG $PCP_PS_ALL_FLAGS' \
84 |
egrep "PID|pmlogger" >>$here/$seq.full
85 echo >>$here/$seq.full
86 echo "Local host: $myhost [pid: $pid port: $port]" >>$here/$seq.full
87 pminfo
-f -h $myhost pmcd.pmlogger.port
>>$here/$seq.full
2>&1
88 $PCP_PS_PROG $PCP_PS_ALL_FLAGS \
89 |
egrep "PID|pmlogger" \
90 |
grep -v grep >>$here/$seq.full
99 $sudo $signal -s TERM
$pid
102 cat $tmp.log
>>$here/$seq.full
107 _filter_pmlogger_log
<$tmp.log
109 echo "Warning: $tmp.log missing"
112 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
122 signal
=$PCP_BINADM_DIR/pmsignal
123 status
=1 # failure is the default!
125 trap "_cleanup; exit \$status" 0 1 2 3 15
132 _start_up_pmlogger
-h $rem_host -L -c /dev
/null
-l $tmp.log
$tmp >/dev
/null
2>&1
133 _wait_for_pmlogger
$pid $tmp.log
135 pminfo
-f -h $rem_host pmcd.pmlogger.port
>$tmp.tmp
136 rem_port
=`cat $tmp.tmp | sed -n -e '/"primary"/{
141 if [ -z "$rem_port" ]
144 echo "Error: cannot find port for remote primary logger!"
148 rem_pid
=`cat $tmp.tmp | sed -n -e '/"primary"/d' -e '/ value '$rem_port' *$/{
155 echo "Error: cannot find pid for remote primary logger on port $rem_port!"
159 port
=`pminfo -f pmcd.pmlogger.port \
160 | sed -n -e '/"primary"/d' -e '/\['$pid' /{
164 echo "=== ping @ start ===" >>$here/$seq.full
167 # real QA test starts here
170 _speak_to_me
"" "port $port"
172 _speak_to_me @
$myhost $pid
173 _speak_to_me @
$myhost "port $port"
175 _speak_to_me @
$rem_host $rem_pid $rem_port
177 # make sure the primary logger is terminated and stop pmcd
179 prim_pid
=`$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep pmlogger | grep ' -P' | $PCP_AWK_PROG '{ print $2 }'`
180 if [ ! -z "$prim_pid" ]
182 $sudo $signal -s TERM
$prim_pid
183 _wait_pmlogger_end
$prim_pid
185 echo "Eh? primary pmlogger not running?"
188 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
190 echo >>$here/$seq.full
191 echo "=== ping after stopping local pcp and pmcd ===" >>$here/$seq.full
196 _speak_to_me
"" "port $port"
197 #debug# DEBUG="-D all"
198 _speak_to_me @
$rem_host $rem_pid $rem_port
200 echo >>$here/$seq.full
201 echo "=== ping @ end ===" >>$here/$seq.full