Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 805
blob200379c7047f935b72b79a172b0275babd407a44
1 #!/bin/sh
2 # PCP QA Test No. 805
3 # Exercise the postfix PMDA.
5 # Copyright (c) 2015 Red Hat. All Rights Reserved.
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/postfix/pmdapostfix.pl" ] || _notrun "No postfix PMDA"
18 if which qshape >/dev/null 2>&1
19 then
21 else
22 # not on the $PATH, but qshape is hiding on SuSE platforms
24 [ -f /usr/share/doc/packages/postfix-doc/auxiliary/qshape/qshape.pl ] \
25 || _notrun "No qshape binary installed"
28 status=1 # failure is the default!
29 $sudo rm -rf $tmp.* $seq.full
31 # prepare the PMDAs test environment
32 cp $here/postfix/qshape.sh $tmp.qshape
33 grp=root
34 case $PCP_PLATFORM
36 freebsd|netbsd|openbsd)
37 grp=wheel
39 esac
40 $sudo chown root:$grp $tmp.qshape
41 $sudo chmod 755 $tmp.qshape
42 touch $tmp.logfile
44 export PMDA_POSTFIX_LOG=$tmp.logfile
45 export PMDA_POSTFIX_REFRESH=1
46 export PMDA_POSTFIX_QSHAPE=$tmp.qshape
48 pmdapostfix_remove()
50 echo | tee -a $here/$seq.full
51 echo "=== remove postfix agent ===" | tee -a $here/$seq.full
52 $sudo ./Remove >$tmp.out 2>&1
53 cat $tmp.out >>$here/$seq.full
54 _filter_pmda_remove <$tmp.out
57 pmdapostfix_install()
59 # start from known starting points
60 cd $PCP_PMDAS_DIR/postfix
61 $sudo ./Remove >/dev/null 2>&1
62 $sudo $PCP_RC_DIR/pmcd stop 2>&1 | _filter_pcp_stop
64 echo | tee -a $here/$seq.full
65 echo "=== postfix agent installation ===" | tee -a $here/$seq.full
66 $sudo ./Install </dev/null >$tmp.out 2>&1
67 cat $tmp.out >>$here/$seq.full
68 # Check postfix metrics have appeared ... X metrics and Y values
69 _filter_pmda_install <$tmp.out \
70 | sed \
71 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
72 -e 's/[0-9][0-9]* warnings, //' \
73 | $PCP_AWK_PROG '
74 /Check postfix metrics have appeared/ { if ($7 >= 7) $7 = "X"
75 if ($10 >= 50) $10 = "Y"
77 { print }'
80 _prepare_pmda postfix
81 trap "_cleanup_pmda postfix; exit \$status" 0 1 2 3 15
83 # real QA test starts here
84 pmdapostfix_install
86 metrics=`pminfo postfix | LC_COLLATE=POSIX sort`
88 for file in $here/postfix/*-log-*gz
90 pmsleep 1.25
91 logfile=`basename $file`
92 gunzip < $file > $tmp.logfile
94 echo "=== verify postfix values - $logfile ===" | tee -a $here/$seq.full
95 pminfo -f $metrics
96 echo "=== done ===" | tee -a $here/$seq.full
97 echo | tee -a $here/$seq.full
98 done
99 $sudo rm -f $tmp.logfile $tmp.qshape
101 echo "PMDA log file ..." >>$here/$seq.full
102 $sudo cat $PCP_LOG_DIR/pmcd/postfix.log >>$here/$seq.full
104 pmdapostfix_remove
105 status=0
106 exit