pmrep: update TODO, man page
[pcp.git] / qa / 796
blob05fd8ea78e78db8ca43e0c440df9234483955bb2
1 #!/bin/sh
2 # PCP QA Test No. 796
3 # Exercise elasticsearch PMDA - install, remove and values.
5 # Copyright (c) 2015 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 [ -f $PCP_PMDAS_DIR/elasticsearch/pmdaelasticsearch.pl ] || \
17 _notrun "elasticsearch pmda not installed"
19 port=9200
20 $PCP_BINADM_DIR/telnet-probe -c localhost $port || \
21 _notrun "Noones home on the default elasticsearch port $port"
23 status=1 # failure is the default!
24 $sudo rm -rf $tmp $tmp.* $seq.full
26 _filter_elasticsearch()
28 # cull message resulting from no running httpd
29 grep -v 'Information not currently available'
32 _filter_colour()
34 sed \
35 -e 's/"red"/COLOUR/g' \
36 -e 's/"green"/COLOUR/g' \
37 -e 's/"yellow"/COLOUR/g' \
38 #end
41 _filter_code()
43 sed -e 's/[0-2]$/CODE/g'
46 pmdaelasticsearch_remove()
48 echo
49 echo "=== remove elasticsearch agent ==="
50 $sudo ./Remove >$tmp.out 2>&1
51 _filter_pmda_remove <$tmp.out
54 pmdaelasticsearch_install()
56 # start from known starting points
57 cd $PCP_PMDAS_DIR/elasticsearch
58 $sudo ./Remove >/dev/null 2>&1
59 $sudo $PCP_RC_DIR/pmcd stop 2>&1 | _filter_pcp_stop
61 echo
62 echo "=== elasticsearch agent installation ==="
63 $sudo ./Install </dev/null >$tmp.out 2>&1
64 cat $tmp.out >>$here/$seq.full
65 # Check elasticsearch metrics have appeared ... X metrics and Y values
66 _filter_pmda_install <$tmp.out \
67 | sed \
68 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
69 -e 's/[0-9][0-9]* warnings, //' \
70 | $PCP_AWK_PROG '
71 /Check elasticsearch metrics have appeared/ { if ($7 >= 90 && $7 <= 250) $7 = "X"
72 if ($10 >= 0 && $10 <= 500) $10 = "Y"
74 { print }'
77 _prepare_pmda elasticsearch
78 trap "_cleanup_pmda elasticsearch; exit \$status" 0 1 2 3 15
80 # real QA test starts here
81 pmdaelasticsearch_install
83 # pmcd should have been started by the Install process - check
84 # a sub-tree that is known-good for all elasticsearch versions
85 # and setup states.
86 if pminfo -v elasticsearch.cluster > $tmp.info 2> $tmp.err
87 then
88 echo "Checking cluster state values"
89 pmprobe -v elasticsearch.cluster.status.code | _filter_code
90 pmprobe -v elasticsearch.cluster.status.colour | _filter_colour
91 else
92 echo "... failed! ... here is the Install log ..."
93 cat $tmp.out
95 cat $tmp.info $tmp.err | _filter_elasticsearch
97 pmdaelasticsearch_remove
98 status=0
99 exit