pmrep: fix archive end time reporting
[pcp.git] / qa / 1053
blob5def81ebadeca1341dfbab5383638ba51287e40a
1 #!/bin/sh
2 # PCP QA Test No. 1053
3 # Exercise the JSON PMDA Install/Remove, as well as the
4 # mechanism by which a PMDA can be installed with no pmcd
5 # process running.
7 # Copyright (c) 2015 Red Hat.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 . ./common.python
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
29 pmdajson_remove()
31 echo
32 echo "=== remove json agent ==="
33 $sudo ./Remove >$tmp.out 2>&1
34 _filter_pmda_remove <$tmp.out
37 pmdajson_install()
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
44 echo
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 \
50 | sed \
51 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
52 -e 's/[0-9][0-9]* warnings, //' \
53 | $PCP_AWK_PROG '
54 /Check json metrics have appeared/ { if ($7 >= 20 && $7 <= 80) $7 = "X"
55 if ($10 >= 0 && $10 <= 80) $10 = "Y"
57 { print }'
60 cleanup()
62 if [ -f ${pmda_config}.$seq ]; then
63 _restore_config ${pmda_config}
65 _cleanup_pmda json
68 _prepare_pmda json
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
78 "directory_list" : [
81 EOF
82 $sudo mv $tmp.pmda_config ${pmda_config}
84 # real QA test starts here
85 pmdajson_install
87 # there may be a race if the pmda has a bit of a slow start ... pause
89 sleep 3
91 # pmcd should have been started by the Install process - check
92 if pminfo -v json > $tmp.info 2> $tmp.err
93 then
95 else
96 echo "... failed! ... here is the Install log ..."
97 cat $tmp.out
99 cat $tmp.info $tmp.err
101 pmdajson_remove
102 status=0
103 exit