blob: e460efde3befe62223b9c70647c96e98346bc75d (
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
#! /bin/sh
# PCP QA Test No. 326
# Check PMCD state change notification, aka PMCD reset
#
# 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
signal=$PCP_BINADM_DIR/pmsignal
status=1
done_clean=false
LOCALHOST=`hostname`
[ $PCP_VER -lt 3806 ] && LOCALHOST=`echo $LOCALHOST | sed -e 's/\..*//'`
_cleanup()
{
if $done_clean
then
:
else
echo
echo "Restore pmcd.conf and restart PMCD ..."
[ -f $tmp.pmcd.conf ] && $sudo mv $tmp.pmcd.conf $PCP_PMCDCONF_PATH
_restore_primary_logger
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
rm -f $tmp.*
_wait_for_pmcd
_wait_for_pmlogger
done_clean=true
fi
exit $status
}
$sudo rm -rf $tmp.* $seq.full
trap "_cleanup" 0 1 2 3 15
timezone=`pmprobe -v pmcd.timezone | $PCP_AWK_PROG '{print $3}'`
_filter_host()
{
# filter this, as we now fetch pmcd.hostname, sneakily
sed \
-e "/ value \"$REALHOST\"/d" \
-e "/ value \"$LOCALHOST\"/d"
}
_filter_pmval()
{
sed \
-e '1,/^interval:/d' \
-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g' \
| $PCP_AWK_PROG '
/No values available/ { print; next }
0 <= $2 && $2 < 1.1 { $2 = "non-negative number, less than 1.1" }
{ print }' \
| uniq
}
trap "_cleanup" 0 1 2 3 15
rm -f $seq.full
# real QA test starts here
PMDA_PMCD_PATH=$PCP_PMDAS_DIR/pmcd/pmda_pmcd.$DSO_SUFFIX
# copy the pmcd config file to restore state later.
cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
# start from a known starting point
$sudo $PCP_RC_DIR/pcp stop >/dev/null 2>&1
cat <<End-of-File >$tmp.tmp
# temporary for qa/$seq
pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
End-of-File
$sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
_writable_primary_logger
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
_wait_for_pmlogger -P $LOGGING_DIR/$LOCALHOST/pmlogger.log
echo 'connect primary
log mandatory on 500 msec { pmcd.numagents sample.milliseconds }' \
| pmlc
# run for 20 seconds
pmval -s 40 -t 0.5 -Z "$timezone" -D fetch pmcd.numagents >$tmp.pmval 2>&1 &
sleep 3
echo "=== kill sample PMDA process ==="
$sudo $signal -a -s TERM pmdasample
pminfo -v sample >/dev/null 2>&1
sleep 3
echo "=== SIGHUP PMCD ==="
$sudo $signal -a -s HUP pmcd
sleep 3
echo "=== drop sample PMDA, like Remove ==="
cat <<End-of-File >$tmp.tmp
# temporary for qa/$seq
pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
End-of-File
$sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
$sudo $signal -a -s HUP pmcd
sleep 3
echo "=== add sample PMDA, like Install ==="
cat <<End-of-File >$tmp.tmp
# temporary for qa/$seq
pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
End-of-File
$sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
$sudo $signal -a -s HUP pmcd
sleep 3
wait
# if desperate!
#echo >>$seq.full
#cat $PCP_PMCDLOG_PATH >>$seq.full
echo
echo "Trace of observed state changes and PMDA count ..."
egrep '(state changes)|( value )' $tmp.pmval \
| _filter_host \
| uniq
echo
echo "primary logger ..."
echo 'connect primary
log mandatory off { pmcd.numagents sample.milliseconds }
flush' \
| pmlc
sleep 2
# if desperate!
#echo >>$seq.full
#echo "pmlogger log ..." >>$seq.full
#_filter_pmlogger_log <$LOGGING_DIR/$LOCALHOST/pmlogger.log >>$seq.full
echo "archive contents ..."
pmafm $LOGGING_DIR/$LOCALHOST/Latest pmdumplog >$tmp.out 2>&1
egrep '(<mark>)|(pmcd.numagents)' $tmp.out \
| _filter_pmdumplog \
| uniq
# note clip after 4 filtered lines to avoid extra values that sometimes
# appear due to non-determinism in pmlogger fetch samples
#
echo
echo "sanity check with pmval | filter ..."
pmafm $LOGGING_DIR/$LOCALHOST/Latest pmval -t 1 sample.milliseconds 2>&1 \
| _filter_pmval \
| sed -e 4q
# if desperate!
#echo >>$seq.full
#echo "unfiltered pmval live output" >>$seq.full
#cat $tmp.pmval >>$seq.full
# if desperate!
#echo >>$seq.full
#echo "unfiltered pmval archive output" >>$seq.full
#pmafm $LOGGING_DIR/$LOCALHOST/Latest pmval -t 1 sample.milliseconds >>$seq.full 2>&1
status=0
exit
|