3 # Check PMCD state change notification, aka PMCD_ADD_AGENT
5 # Copyright (c) 2016 Red Hat, Inc.
9 echo "QA output created by $seq"
11 # get standard filters
16 signal
=$PCP_BINADM_DIR/pmsignal
27 echo "Restore pmcd.conf and restart PMCD ..."
28 if [ -f $tmp.pmcd.conf
]
30 $sudo cp $tmp.pmcd.conf
$PCP_PMCDCONF_PATH
33 _restore_primary_logger
34 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
43 $sudo rm -rf $tmp.
* $seq.full
44 trap "_cleanup" 0 1 2 3 15
46 # real QA test starts here
47 PMDA_PMCD_PATH
=$PCP_PMDAS_DIR/pmcd
/pmda_pmcd.
$DSO_SUFFIX
49 # copy the pmcd config file to restore state later.
50 cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
52 # start from a known starting point
53 $sudo $PCP_RC_DIR/pcp stop
>/dev
/null
2>&1
55 cat <<End-of-File >$tmp.tmp
56 # temporary for qa/$seq
57 pmcd 2 dso pmcd_init $PMDA_PMCD_PATH
58 sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
59 simple 253 pipe binary /var/lib/pcp/pmdas/simple/pmdasimple -d 253
61 $sudo cp $tmp.tmp
$PCP_PMCDCONF_PATH
63 _writable_primary_logger
64 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
66 if [ -d $PCP_LOG_DIR/pmlogger
]
68 LOGGING_DIR
=$PCP_LOG_DIR/pmlogger
70 LOGGING_DIR
=$PCP_LOG_DIR
72 _wait_for_pmlogger
-P $LOGGING_DIR/$LOCALHOST/pmlogger.log
75 echo "log sample.dynamic.meta.metric"
76 # Log the sample pmda's sample.dynamic.meta.metric
78 log mandatory on 500 msec { sample.dynamic.meta.metric }' \
84 echo "archive contents before pmda simple restart..."
85 echo "expect no <mark> record"
86 echo "---------------------------------------------------------------"
87 pmafm
$LOGGING_DIR/$LOCALHOST/Latest pmdumplog
>$tmp.out
2>&1
88 egrep '(<mark>)|(sample.dynamic.meta.metric)' $tmp.out \
91 echo "---------------------------------------------------------------"
93 # Get the instance domain of sample.dynamic.meta.metric by fetching
94 # sample.dynamic.meta.pmdesc.indom using pminfo.
95 echo "pminfo -f sample.dynamic.meta.pmdesc.indom" |
tee -a $seq.full
96 indom
=`pminfo -f sample.dynamic.meta.pmdesc.indom | tee -a $seq.full \
97 | awk '/value/ { print $2 }'`
99 # Change the instance domain of sample.dynamic.meta.metric by using pmstore to store into
100 # sample.dynamic.meta.pmdesc.indom
101 echo "changing instance domain from $indom to $((indom - 1))"
102 pmstore sample.dynamic.meta.pmdesc.indom $
((indom
- 1))
104 # Restart the simple pmda by killing it and the getting pmcd to restart it (HUP).
105 # pmlogger should receive PMCD_ADD_AGENT, which should cause it to re-check
106 # all of it's configured metrics. It should then flag the change to
107 # sample.dynamic.meta.pmdesc.indom and exit.
108 echo "restart the simple pmda"
109 $sudo $signal -a -s TERM pmdasimple
110 sleep 1 # let the signal arrive and let pmdasimple exit
111 $sudo $signal -a -s HUP pmcd
# ensure pmcd restarts the PMDA
112 sleep 1 # let the signal arrive and pmcd think about it
114 echo "archive contents after pmda simple restart..."
115 echo "expect no <mark> record"
116 echo "---------------------------------------------------------------"
117 pmafm
$LOGGING_DIR/$LOCALHOST/Latest pmdumplog
>$tmp.out
2>&1
118 egrep '(<mark>)|(sample.dynamic.meta.metric)' $tmp.out \
119 | _filter_pmdumplog \
121 echo "---------------------------------------------------------------"
123 # pmlogger should have stopped. Check for the messages indicating that
124 # the re-check of the configured metrics failed and that it stopped.
126 echo "pmlogger log ..." >>$seq.full
127 cat $LOGGING_DIR/$LOCALHOST/pmlogger.log |
tee -a $seq.full | \
129 -e 'Instance domain of metric "sample.dynamic.meta.metric" has changed from PM_INDOM_NULL to 511.4194302' \
130 -e 'One or more configured metrics have changed after pmcd state change. Exiting'