3 # Exercise the Nginx PMDA Install/Remove.
5 # Copyright (c) 2015-2016 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 [ -f $PCP_PMDAS_DIR/nginx
/pmdanginx.pl
] || _notrun
"nginx pmda not installed"
18 perl
-e "use PCP::PMDA" >/dev
/null
2>&1
19 [ $?
-eq 0 ] || _notrun
"perl PCP::PMDA module not installed"
21 status
=1 # failure is the default!
22 $sudo rm -rf $tmp.
* $seq.full
23 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
25 # real QA test starts here
28 # cull message resulting from no running nginx daemon
29 grep -v 'Information not currently available'
35 echo "=== remove nginx agent ==="
36 $sudo .
/Remove
>$tmp.out
2>&1
37 _filter_pmda_remove
<$tmp.out
42 # start from known starting points
43 cd $PCP_PMDAS_DIR/nginx
44 $sudo .
/Remove
>/dev
/null
2>&1
47 echo "=== nginx agent installation ==="
48 $sudo .
/Install
</dev
/null
>$tmp.out
2>&1
49 cat $tmp.out
>>$here/$seq.full
50 # Check nginx metrics have appeared ... X metrics and Y values
51 _filter_pmda_install
<$tmp.out \
53 -e 's/[0-9][0-9]* warnings, //' \
55 /Check nginx metrics have appeared/ { if ($7 >= 7) $7 = "X"
56 if ($10 >= 7 || $10 == 0) $10 = "Y"
62 # note: _restore_auto_restart pmcd done in _cleanup_pmda()
63 trap "_cleanup_pmda nginx; exit \$status" 0 1 2 3 15
65 _stop_auto_restart pmcd
67 # real QA test starts here
70 # there may be a race if the pmda has a bit of a slow start ... pause
73 # pmcd should have been started by the Install process - check
74 if pminfo
-v nginx
> $tmp.info
2> $tmp.err
78 echo "... failed! ... here is the Install log ..."
81 cat $tmp.info
$tmp.err | _filter_nginx