3 # Check PMCD state change notification, aka PMCD reset
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
6 # Copyright (c) 2016 Red Hat, Inc.
10 echo "QA output created by $seq"
12 # get standard filters
17 signal
=$PCP_BINADM_DIR/pmsignal
29 echo "Restore pmcd.conf and restart PMCD ..."
30 if [ -f $tmp.pmcd.conf
]
32 $sudo cp $tmp.pmcd.conf
$PCP_PMCDCONF_PATH
35 _restore_primary_logger
36 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
45 $sudo rm -rf $tmp.
* $seq.full
46 trap "_cleanup" 0 1 2 3 15
47 timezone
=`pmprobe -v pmcd.timezone | $PCP_AWK_PROG '{print $3}'`
51 # filter this, as we now fetch pmcd.hostname, sneakily
53 -e "/ value \"$REALHOST\"/d" \
54 -e "/ value \"$LOCALHOST\"/d"
60 -e '1,/^interval:/d' \
61 -e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g' \
63 /No values available/ { print; next }
64 0 <= $2 && $2 < 1.1 { $2 = "non-negative number, less than 1.1" }
69 trap "_cleanup" 0 1 2 3 15
73 # real QA test starts here
74 PMDA_PMCD_PATH
=$PCP_PMDAS_DIR/pmcd
/pmda_pmcd.
$DSO_SUFFIX
76 # copy the pmcd config file to restore state later.
77 cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
79 # start from a known starting point
80 $sudo $PCP_RC_DIR/pcp stop
>/dev
/null
2>&1
82 cat <<End-of-File >$tmp.tmp
83 # temporary for qa/$seq
84 pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
85 sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
87 $sudo cp $tmp.tmp
$PCP_PMCDCONF_PATH
89 _writable_primary_logger
90 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
92 if [ -d $PCP_LOG_DIR/pmlogger
]
94 LOGGING_DIR
=$PCP_LOG_DIR/pmlogger
96 LOGGING_DIR
=$PCP_LOG_DIR
98 _wait_for_pmlogger
-P $LOGGING_DIR/$LOCALHOST/pmlogger.log
100 echo 'connect primary
101 log mandatory on 500 msec { pmcd.numagents sample.milliseconds }' \
105 pmval
-s 40 -t 0.5 -Z "$timezone" -D fetch pmcd.numagents
>$tmp.pmval
2>&1 &
109 echo "=== kill sample PMDA process ==="
110 $sudo $signal -a -s TERM pmdasample
111 sleep 2 # enough time for pmcd to restart it - once only
112 $sudo $signal -a -s TERM pmdasample
113 pminfo
-v sample
>/dev
/null
2>&1
116 echo "=== SIGHUP PMCD ==="
117 $sudo $signal -a -s HUP pmcd
120 echo "=== drop sample PMDA, like Remove ==="
121 cat <<End-of-File >$tmp.tmp
122 # temporary for qa/$seq
123 pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
125 $sudo cp $tmp.tmp
$PCP_PMCDCONF_PATH
126 $sudo $signal -a -s HUP pmcd
129 echo "=== add sample PMDA, like Install ==="
130 cat <<End-of-File >$tmp.tmp
131 # temporary for qa/$seq
132 pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
133 sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
135 $sudo cp $tmp.tmp
$PCP_PMCDCONF_PATH
136 $sudo $signal -a -s HUP pmcd
142 echo "pmcd log ..." >>$seq.full
143 cat $PCP_PMCDLOG_PATH >>$seq.full
146 echo "Trace of observed state changes and PMDA count ..."
147 egrep '(state changes)|( value )' $tmp.pmval \
152 echo "primary logger ..."
153 echo 'connect primary
154 log mandatory off { pmcd.numagents sample.milliseconds }
160 echo "pmlogger log ..." >>$seq.full
161 cat $LOGGING_DIR/$LOCALHOST/pmlogger.log
>>$seq.full
163 echo "archive contents ..."
164 pmafm
$LOGGING_DIR/$LOCALHOST/Latest pmdumplog
>$tmp.out
2>&1
165 egrep '(<mark>)|(pmcd.numagents)' $tmp.out \
166 | _filter_pmdumplog \
169 # note clip after 4 filtered lines to avoid extra values that sometimes
170 # appear due to non-determinism in pmlogger fetch samples
173 echo "sanity check with pmval | filter ..."
174 pmafm
$LOGGING_DIR/$LOCALHOST/Latest pmval
-t 1 sample.milliseconds
2>&1 \
179 echo "unfiltered pmval live output" >>$seq.full
180 cat $tmp.pmval
>>$seq.full
183 echo "unfiltered pmval archive output" >>$seq.full
184 pmafm
$LOGGING_DIR/$LOCALHOST/Latest pmval
-t 1 sample.milliseconds
>>$seq.full
2>&1