3 # Exercise pmcd attribute PDU handling after agent failure.
5 # Copyright (c) 2015 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
17 $unix_domain_sockets || _notrun
"No unix domain socket support available"
21 sed -e 's/\.\.\.*/\.\.\./g'
26 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
28 _restore_config
$PCP_PMCDOPTIONS_PATH
29 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
33 if pmprobe
-I pmcd.agent.status |
grep '"dynamic"' >/dev
/null
35 cd $here/pmdas
/dynamic
36 $sudo .
/Remove
>>$here/$seq.full
2>&1
42 status
=1 # failure is the default!
43 $sudo rm -rf $tmp.
* $seq.full
44 signal
=$PCP_BINADM_DIR/pmsignal
45 trap "_cleanup; exit \$status" 0 1 2 3 15
47 port
=`_get_port tcp 6060 6070`
50 echo "Arrggh ... no free TCP port in the range 6060 ... 6070"
54 echo "port=$port" >>$seq.full
55 _save_config
$PCP_PMCDOPTIONS_PATH
56 cat <<End-of-File >$tmp.newoptions
57 # New pmcd.options file created by QA $seq
61 $sudo cp $tmp.newoptions
$PCP_PMCDOPTIONS_PATH
63 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
64 export PMCD_PORT
=$port
65 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
69 cd $here/pmdas
/dynamic
70 if [ -f GNUmakefile.
install ]
72 $PCP_MAKE_PROG -f GNUmakefile.
install clean
>>$here/$seq.full
2>&1
73 $PCP_MAKE_PROG -f GNUmakefile.
install >>$here/$seq.full
2>&1
75 $PCP_MAKE_PROG clean
>>$here/$seq.full
2>&1
76 $PCP_MAKE_PROG >>$here/$seq.full
2>&1
78 $sudo .
/Install
< /dev
/null
>$tmp.out
2>&1
79 cat $tmp.out |
tee -a $here/$seq.full | _filter_pmda_install | _filter
82 # real QA test starts here
83 echo "Initial check of some metric access"
84 pmprobe
-h unix
:$tmp.socket
-i hinv.ncpu
88 echo "Terminate a PMDA needing attributes" |
tee -a $here/$seq.full
89 date >>$here/$seq.full
90 $sudo $signal -a pmdadynamic
>> $here/$seq.full
2>&1
92 # wait up to 2 seconds for dynamic PMDA to die
96 $PCP_PS_PROG $PCP_PS_ALL_FLAGS >$tmp.tmp
97 echo "ps probe #$i" >>$here/$seq.full
98 egrep '[P]ID|[p]mdadynamic' $tmp.tmp
>>$here/$seq.full
99 if egrep '(pmdadynamic.*defunct)|( Z .*pmdadynamic)' $tmp.tmp
>/dev
/null
103 elif grep "pmdadynamic" $tmp.tmp
>/dev
/null
115 echo "Arrgh ... dynamic PMDA won't die"
116 egrep '[P]ID|[p]mdadynamic' $tmp.tmp
119 date >>$here/$seq.full
121 # and a bit more for pmcd to notice the PMDA has exited
124 echo "Tickle access to the failed PMDA, must see 'Try Again'"
125 pmprobe
-h unix
:$tmp.socket
-i hinv.ncpu |
tee $tmp.tmp
126 nval
=`$PCP_AWK_PROG <$tmp.tmp '{print $2}'`
129 # this is not expected
131 echo "Error: nval=$nval not as expected ... see $seq.full"
132 echo "+++ Tickle failed `date` +++" >>$here/$seq.full
133 cat $PCP_LOG_DIR/pmcd
/pmcd.log
>>$here/$seq.full
134 cat $PCP_LOG_DIR/pmcd
/dynamic.log
>>$here/$seq.full
137 echo "Verify subsequent return to healthy state"
138 pmprobe
-h unix
:$tmp.socket
-i hinv.ncpu