blob: 56dfd9251e78a605b0d9b9dcbe678eebf131fae5 (
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#! /bin/sh
# PCP QA Test No. 381
# pmlc with new -p port and "connect port <n>" options
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
rem_host=`./getpmcdhosts -L -n 1 -P -a sample 2>$seq.notrun`
[ -z "$rem_host" ] && _notrun `cat $seq.notrun`
rm -f $seq.notrun
_filter()
{
sed \
-e '/Performance Co-Pilot Logger/,/ <instance> /d' \
-e '/^PMCD host/d' \
-e "s/ $pid / QA-PMLOGGER-PID /" \
-e "s/\[$pid\]/[QA-PMLOGGER-PID]/" \
-e "s/_logger_id=$pid/_logger_id=QA-PMLOGGER-PID/" \
-e 's/connect [0-9][0-9]* /connect PID /' \
-e "s/\[[0-9][0-9]*\]/[PMLOGGER-PID]/" \
-e "s/_logger_id=[0-9][0-9]*/_logger_id=PMLOGGER-PID/" \
-e "s/$rem_host/REMOTE-HOST/" \
-e "s/$myhost/LOCAL-HOST/" \
-e "s/local:/LOCAL-HOST/" \
-e "s/port $port /port QA-PMLOGGER-PORT /" \
-e 's/logging metrics from host .*/logging metrics from host .../' \
-e '/^log started/d' \
-e '/^last log entry/d' \
-e '/^current time/d' \
-e '/^log volume/d' \
-e '/^log size/s/.*/... status output .../'
}
# _speak_to_me <host> <pid>
#
_speak_to_me()
{
echo
echo "=== _host=$1 _logger_id=$2 ===" >$tmp.out
echo >>$seq.full
echo "=== _host=$1 _logger_id=$2 ===" >>$seq.full
# allow pmlogger socket to be closed and ready to accept()
#
sleep 2
cat <<End-of-File | pmlc $DEBUG -ei >>$tmp.out 2>&1
connect primary $1
status
query sample.drift
connect port 4330 $1
status
flush
connect $2 $1
status
flush
End-of-File
cat $tmp.out >>$seq.full
_filter <$tmp.out
}
_cleanup()
{
if $need_clean
then
if [ ! -z "$pid" ]
then
$sudo $signal -s TERM $pid
sleep 1
pid=''
fi
echo
_filter_pmlogger_log <$tmp.log
echo
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
need_clean=false
fi
$sudo rm -f $tmp.*
exit
}
need_clean=true
signal=$PCP_BINADM_DIR/pmsignal
status=1 # failure is the default!
DEBUG=''
trap "_cleanup; exit \$status" 0 1 2 3 15
myhost=`hostname`
pid=''
$sudo rm -f $tmp.*
rem_pid=`pminfo -f -h $rem_host pmcd.pmlogger.port \
| sed -n -e '/primary/d' -e '/ value 4330 *$/{
s/.* "//
s/".*//p
}'`
if [ -z "$rem_pid" ]
then
pminfo -f -h $rem_host pmcd.pmlogger.port
echo "Error: cannot find pid for remote primary logger!"
exit
fi
_start_up_pmlogger -h $rem_host -L -c /dev/null -l $tmp.log $tmp >/dev/null 2>&1
_wait_for_pmlogger $pid $tmp.log
port=`pminfo -f pmcd.pmlogger.port \
| sed -n -e '/primary/d' -e '/\['$pid' /{
s/.* value //p
}'`
rm -f $seq.full
echo "Remote host: $rem_host [pid: $rem_pid]" >>$seq.full
echo "Local host: $myhost [pid: $pid port: $port]" >>$seq.full
# real QA test starts here
_speak_to_me "" $pid
_speak_to_me "" "port $port"
_speak_to_me @$myhost $pid
_speak_to_me @$myhost "port $port"
_speak_to_me @$rem_host $rem_pid
# make sure the primary logger is terminated and stop pmcd
#
prim_pid=`ps $PCP_PS_ALL_FLAGS | grep pmlogger | grep ' -P' | $PCP_AWK_PROG '{ print $2 }'`
[ ! -z "$prim_pid" ] && $sudo $signal -s TERM $prim_pid
$sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
echo
_speak_to_me "" $pid
_speak_to_me "" "port $port"
#debug# DEBUG="-D all"
_speak_to_me @$rem_host $rem_pid
# success, all done
status=0
exit
|