docs: tweak formatting in pmrep(1) archive folio example
[pcp.git] / qa / 427
blobc412494be4f8fe9ac7d4b53306a61ac1db4dc77a
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"
30 trap "_cleanup" 0 1 2 3 15
32 _cleanup()
34 if $needclean
35 then
36 _restore_config $PCP_PMCDCONF_PATH
37 _restore_config $PCP_PMLOGGERCONTROL_PATH
38 needclean=false
39 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
40 _wait_for_pmcd
42 # make sure bogus has gone away
43 echo
44 echo "Anything below here may indicate that bogus has not gone away:"
45 grep bogus $PCP_PMCDCONF_PATH
46 pminfo -f pmcd.agent | grep bogus
48 $sudo rm -f $tmp.*
49 exit $status
52 # real QA test starts here
54 # disable all pmloggers ...
55 _save_config $PCP_PMLOGGERCONTROL_PATH
56 cat <<End-of-File >$tmp.tmp
57 # dummy file created by qa/$seq on `date`
58 # the goal here is to have a controlled primary logger that does
59 # not make requests to pmcd!
60 \$version=1.1
61 LOCALHOSTNAME y n $PCP_LOG_DIR/pmlogger/LOCALHOSTNAME -c /dev/null
62 End-of-File
63 $sudo cp $tmp.tmp $PCP_PMLOGGERCONTROL_PATH
65 # backup $PCP_PMCDCONF_PATH
66 _save_config $PCP_PMCDCONF_PATH
68 # add bogus entry
69 $PCP_AWK_PROG < $PCP_PMCDCONF_PATH > $tmp.pmcd.new -v seq="$seq" -v path="$tmp.bogus.pmda" '
70 function printline()
72 printf("# Added by QA test %s\n", seq);
73 printf("bogus 169 pipe binary %s\n", path);
76 BEGIN { flag = 0 }
77 $1 == "[access]" { printline(); print; flag = 1; next }
78 { print }
79 END { if (flag == 0) printline(); }'
81 # copy the new config
82 $sudo cp $tmp.pmcd.new $PCP_PMCDCONF_PATH
84 # restart pmcd
85 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
86 _wait_for_pmcd
88 # check that pmcd reported the agent as an error
89 echo
90 echo "errors for bogus in $PCP_PMCDLOG_PATH:" \
91 | sed -e"s|$PCP_PMCDLOG_PATH|/var/adm/pcplog/pmcd.log|"
92 egrep "^pmcd:" $PCP_PMCDLOG_PATH \
93 | grep bogus \
94 | sed -e "s#$tmp\.##"
96 # check that the pmcd.agent.status metric is correct
97 echo
98 echo "pmcd agent metrics for bogus:"
99 pminfo -f pmcd.agent.type | egrep '^pmcd|bogus'
100 pminfo -f pmcd.agent.status | egrep '^pmcd|bogus'
101 echo
103 # success, all done
104 status=0
105 exit