qa: revert some change to expected 244 outputs (from pmda-restart)
[pcp.git] / qa / 427
blob809fe054c88f9aa9fb0df70c3fa3c0fa2082bf11
1 #! /bin/sh
2 # PCP QA Test No. 427
3 # bogus pmda entries in pmcd.conf
4 # #564017
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard filters
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 if [ -z "$PCP_PMCDCONF_PATH" ] ; then
18 echo eek; exit 1;
21 if [ -z "$PCP_PMCDLOG_PATH" ] ; then
22 echo yuk; exit 1;
24 status=1 # failure is the default!
25 needclean=true
27 [ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
28 PCP_PMLOGGERCONTROL_PATH="$PCP_SYSCONF_DIR/pmlogger/control"
29 PCP_PMDAROOT_LOG="$PCP_LOG_DIR/pmcd/root.log"
31 $sudo rm -f $tmp.* $seq.full
32 trap "_cleanup" 0 1 2 3 15
34 _cleanup()
36 if $needclean
37 then
38 _restore_config $PCP_PMCDCONF_PATH
39 _restore_config $PCP_PMLOGGERCONTROL_PATH
40 needclean=false
41 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
42 _wait_for_pmcd
44 # make sure bogus has gone away
45 echo
46 echo "Anything below here may indicate that bogus has not gone away:"
47 grep bogus $PCP_PMCDCONF_PATH
48 pminfo -f pmcd.agent | grep bogus
50 $sudo rm -f $tmp.*
51 exit $status
54 _filter()
56 grep bogus | \
57 sed \
58 -e 's/^pmdaroot:/PMCD:/g' \
59 -e 's/^pmcd:/PMCD:/g' \
60 -e "s#$tmp\.##" \
61 #end
64 # real QA test starts here
66 # disable all pmloggers ...
67 _save_config $PCP_PMLOGGERCONTROL_PATH
68 cat <<End-of-File >$tmp.tmp
69 # dummy file created by qa/$seq on `date`
70 # the goal here is to have a controlled primary logger that does
71 # not make requests to pmcd!
72 \$version=1.1
73 LOCALHOSTNAME y n $PCP_LOG_DIR/pmlogger/LOCALHOSTNAME -c /dev/null
74 End-of-File
75 $sudo cp $tmp.tmp $PCP_PMLOGGERCONTROL_PATH
77 # backup $PCP_PMCDCONF_PATH
78 _save_config $PCP_PMCDCONF_PATH
80 # add bogus entry
81 $PCP_AWK_PROG < $PCP_PMCDCONF_PATH > $tmp.pmcd.new -v seq="$seq" -v path="$tmp.bogus.pmda" '
82 function printline()
84 printf("# Added by QA test %s\n", seq);
85 printf("bogus 169 pipe binary %s\n", path);
88 BEGIN { flag = 0 }
89 $1 == "[access]" { printline(); print; flag = 1; next }
90 { print }
91 END { if (flag == 0) printline(); }'
93 # copy the new config
94 $sudo cp $tmp.pmcd.new $PCP_PMCDCONF_PATH
96 # restart pmcd
97 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
98 _wait_for_pmcd
100 echo == $PCP_PMCDCONF_PATH >> $seq.full
101 cat $PCP_PMCDCONF_PATH >> $seq.full
102 echo == $PCP_PMDAROOT_LOG >> $seq.full
103 cat $PCP_PMDAROOT_LOG >> $seq.full
104 echo == $PCP_PMCDLOG_PATH >> $seq.full
105 cat $PCP_PMCDLOG_PATH >> $seq.full
107 # check that pmcd reported the agent as an error
108 echo
109 echo "errors for bogus in pmcd related log file(s):"
110 [ -f $PCP_PMDAROOT_LOG ] && \
111 egrep "^pmdaroot:" $PCP_PMDAROOT_LOG | _filter
112 egrep "^pmcd:" $PCP_PMCDLOG_PATH | _filter
114 # check that the pmcd.agent.status metric is correct
115 echo
116 echo "pmcd agent metrics for bogus:"
117 pminfo -f pmcd.agent.type | egrep '^pmcd|bogus'
118 pminfo -f pmcd.agent.status | egrep '^pmcd|bogus'
119 echo
121 # success, all done
122 status=0
123 exit