qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 788
blob61236d6e24f2f6ab51b3c5ff792b4dd22c7913d9
1 #!/bin/sh
2 # PCP QA Test No. 788
3 # Exercise the Nginx 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 # get standard environment, filters and checks
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 perl -e "use PCP::PMDA" >/dev/null 2>&1
19 [ $? -eq 0 ] || _notrun "perl PCP::PMDA module not installed"
21 [ -f $PCP_PMDAS_DIR/nginx/pmdanginx.pl ] || _notrun "nginx pmda not installed"
23 status=1 # failure is the default!
24 $sudo rm -rf $tmp.* $seq.full
25 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
27 # real QA test starts here
28 _filter_nginx()
30 # cull message resulting from no running nginx daemon
31 grep -v 'Information not currently available'
34 pmdanginx_remove()
36 echo
37 echo "=== remove nginx agent ==="
38 $sudo ./Remove >$tmp.out 2>&1
39 _filter_pmda_remove <$tmp.out
42 pmdanginx_install()
44 # start from known starting points
45 cd $PCP_PMDAS_DIR/nginx
46 $sudo ./Remove >/dev/null 2>&1
47 $sudo $PCP_RC_DIR/pmcd stop 2>&1 | _filter_pcp_stop
49 echo
50 echo "=== nginx agent installation ==="
51 $sudo ./Install </dev/null >$tmp.out 2>&1
52 cat $tmp.out >>$here/$seq.full
53 # Check nginx metrics have appeared ... X metrics and Y values
54 _filter_pmda_install <$tmp.out \
55 | sed \
56 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
57 -e 's/[0-9][0-9]* warnings, //' \
58 | $PCP_AWK_PROG '
59 /Check nginx metrics have appeared/ { if ($7 >= 7) $7 = "X"
60 if ($10 >= 7 || $10 == 0) $10 = "Y"
62 { print }'
65 _prepare_pmda nginx
66 trap "_cleanup_pmda nginx; exit \$status" 0 1 2 3 15
68 # real QA test starts here
69 pmdanginx_install
71 # there may be a race if the pmda has a bit of a slow start ... pause
73 sleep 3
75 # pmcd should have been started by the Install process - check
76 if pminfo -v nginx > $tmp.info 2> $tmp.err
77 then
79 else
80 echo "... failed! ... here is the Install log ..."
81 cat $tmp.out
83 cat $tmp.info $tmp.err | _filter_nginx
85 pmdanginx_remove
86 status=0
87 exit