3 # Exercise the JSON PMDA Install/Remove, as well as the
4 # mechanism by which a PMDA can be installed with no pmcd
7 # Copyright (c) 2015 Red Hat.
11 echo "QA output created by $seq"
15 pmda_path
="$PCP_PMDAS_DIR/json"
16 pmda_config
="${pmda_path}/config.json"
18 [ -f $PCP_PMDAS_DIR/json
/pmdajson.python
] || _notrun
"JSON pmda not installed"
19 $python -c "from pcp import pmda" >/dev
/null
2>&1
20 [ $?
-eq 0 ] || _notrun
"python pcp pmda module not installed"
21 $python -c "import jsonpointer" >/dev
/null
2>&1
22 [ $?
-eq 0 ] || _notrun
"python jsonpointer module not installed"
23 $python -c "import six" >/dev
/null
2>&1
24 [ $?
-eq 0 ] || _notrun
"python six module not installed"
26 status
=1 # failure is the default!
27 $sudo rm -rf $tmp.
* $seq.full
32 echo "=== remove json agent ==="
33 $sudo .
/Remove
>$tmp.out
2>&1
34 _filter_pmda_remove
<$tmp.out
39 # start from known starting points
40 cd $PCP_PMDAS_DIR/json
41 $sudo .
/Remove
>/dev
/null
2>&1
42 $sudo $PCP_RC_DIR/pmcd stop
2>&1 | _filter_pcp_stop
45 echo "=== json agent installation ==="
46 $sudo .
/Install
</dev
/null
>$tmp.out
2>&1
47 cat $tmp.out
>>$here/$seq.full
48 # Check json metrics have appeared ... X metrics and Y values
49 _filter_pmda_install
<$tmp.out \
51 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
52 -e 's/[0-9][0-9]* warnings, //' \
54 /Check json metrics have appeared/ { if ($7 >= 20 && $7 <= 80) $7 = "X"
55 if ($10 >= 0 && $10 <= 80) $10 = "Y"
62 if [ -f ${pmda_config}.
$seq ]; then
63 _restore_config
${pmda_config}
69 trap "cleanup; exit \$status" 0 1 2 3 15
71 # Save the JSON pmda config.
72 if [ -f ${pmda_config} ]; then
73 _save_config
${pmda_config}
75 # Create a new empty JSOM pmda config file and install it
76 cat > $tmp.pmda_config
<< EOF
82 $sudo mv $tmp.pmda_config
${pmda_config}
84 # real QA test starts here
87 # there may be a race if the pmda has a bit of a slow start ... pause
91 # pmcd should have been started by the Install process - check
92 if pminfo
-v json
> $tmp.info
2> $tmp.err
96 echo "... failed! ... here is the Install log ..."
99 cat $tmp.info
$tmp.err