pmrep: update TODO, man page
[pcp.git] / qa / 964
blob9783215bd056bfecfd28a9b9db72e44e204cbeac
1 #!/bin/sh
2 # PCP QA Test No. 964
3 # Ensure pmlogger not started via PMDA Install if it is
4 # not chkconfig'd on.
6 # Copyright (c) 2015 Red Hat.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=1 # failure is the default!
18 LOCALHOST=`hostname`
19 _needclean=true
20 $sudo rm -rf $tmp $tmp.* $seq.full
22 _interrupt()
24 status=1
27 _cleanup()
29 cd $here
30 if $_needclean
31 then
32 echo "Resetting system state"
33 _restore_loggers
34 _change_config pmlogger on
35 _restore_pmda_install simple
36 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
37 && $sudo sh $tmp.cmd
38 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
39 _wait_for_pmcd
40 _wait_for_pmlogger
41 _needclean=false
43 $sudo rm -f $tmp.*
44 exit $status
47 trap "_cleanup" 0
48 trap "_interrupt; _cleanup" 1 2 3 15
50 _count_pmloggers()
52 count=0
53 if [ -d $PCP_TMP_DIR/pmlogger ]
54 then cd $PCP_TMP_DIR/pmlogger
55 else return 0
58 ls -l >>$here/$seq.full
59 plist=`ls -1`
60 cd $here
62 for process in $plist
64 [ "$process" = "primary" ] && continue
65 ps -p $process >/dev/null 2>&1
66 if [ $? = 1 ]
67 then
68 echo "urk, $PCP_TMP_DIR/pmlogger/$process has no running pmlogger instance"
69 else
70 count=`expr $count + 1`
72 done
74 return $count
77 _filter_root_install()
79 _filter_pmda_install | $PCP_AWK_PROG '
80 /Check containers metrics have appeared/ { if ($7 >= 0) $7 = "X"
81 if ($10 >= 0) $10 = "Y"
83 { print }'
86 # real QA test starts here
87 _prepare_pmda_install root
88 _disable_loggers
89 _change_config pmlogger off
90 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
91 && $sudo sh $tmp.cmd
92 $sudo rm -f $PCP_TMP_DIR/pmlogger/*
94 _count_pmloggers
95 echo "pmlogger count at start of QA testing: $?" | tee -a $here/$seq.full
96 echo
98 # switch off pmcd and pmlogger
99 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
101 # install a PMDA, which should restart only pmcd
102 cd $PCP_PMDAS_DIR/root
103 $sudo ./Install < /dev/null 2>&1 | _filter_root_install
105 # verify no pmloggers running
106 _count_pmloggers
107 echo "pmlogger count at end of Install (expect 0): $?" | tee -a $here/$seq.full
108 echo
110 # switch default pmlogger on once more
111 _restore_loggers
112 _change_config pmlogger on
114 # install a PMDA, should restart both pmcd and pmlogger
115 cd $PCP_PMDAS_DIR/root
116 $sudo ./Install < /dev/null 2>&1 | _filter_root_install
118 # verify pmlogger is running
119 _count_pmloggers
120 echo "pmlogger count at end of Install (expect 1): $?" | tee -a $here/$seq.full
121 echo
123 # success, all done
124 status=0
125 exit