pmrep: update TODO, man page
[pcp.git] / qa / 172
blob6704676bfbf21786c8cdaa31f5f5981710cb4203
1 #! /bin/sh
2 # PCP QA Test No. 172
3 # Exercise $PMCD_PORT and $PMLOGGER_PORT mechanisms
5 # Copyright (c) 2014 Red Hat.
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 which netstat >/dev/null 2>&1 || _notrun "netstat not installed"
19 rm -f $seq.out
20 _get_libpcp_config
21 if $ipv6 ; then
22 ln $seq.out.ipv6 $seq.out || exit 1
23 else
24 ln $seq.out.nonipv6 $seq.out || exit 1
27 LOCALHOST=`hostname`
28 _needclean=true
29 status=0
31 _interrupt()
33 status=1
36 if [ -d $PCP_LOG_DIR/pmlogger ]
37 then
38 LOGGING_DIR=$PCP_LOG_DIR/pmlogger
39 else
40 LOGGING_DIR=$PCP_LOG_DIR
43 _cleanup()
45 if $_needclean
46 then
47 unset PMCD_PORT
48 unset PMLOGGER_PORT
49 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
50 && $sudo sh $tmp.cmd
51 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
52 _wait_for_pmcd
53 _wait_for_pmlogger
54 _needclean=false
56 rm -f $tmp.*
57 exit $status
60 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
61 && $sudo sh $tmp.cmd
63 trap "_cleanup" 0
64 trap "_interrupt; _cleanup" 1 2 3 15
66 rm -f $seq.full
68 # real QA test starts here
69 PMCD_PORT=42000
70 PMLOGGER_PORT=43000
71 export PMCD_PORT PMLOGGER_PORT
73 echo "pmcd with PMCD_PORT=$PMCD_PORT, pmlogger with PMLOGGER_PORT=$PMLOGGER_PORT"
74 # need to do this indirectly because system sudo cleanses the environment
76 echo "export PMCD_PORT=$PMCD_PORT" >$tmp.start
77 echo "export PMLOGGER_PORT=$PMLOGGER_PORT" >>$tmp.start
78 echo "$PCP_RC_DIR/pcp restart" >>$tmp.start
80 $sudo sh $tmp.start | _filter_pcp_start
81 _wait_for_pmlogger -P $LOGGING_DIR/$LOCALHOST/pmlogger.log
83 echo
84 echo "pminfo with PMCD_PORT=$PMCD_PORT"
85 pminfo -v pmcd \
86 | sed -e '/^pmcd\.pmie/d'
88 echo
89 echo "pmlc with PMLOGGER_PORT=$PMLOGGER_PORT"
90 echo "show loggers" | pmlc \
91 | sed \
92 -e '/primary/s/([0-9][0-9]*)/(LOGGER_PID) .../' \
93 -e "s/on `hostname`/on HOST/" \
94 -e "s/on local:/on HOST/" \
95 -e 's/ *[0-9][0-9]*//g'
97 echo
98 echo 'port from $PCP_TMP_DIR/pmlogger/primary'
99 sed -e 1q $PCP_TMP_DIR/pmlogger/primary
101 # For Mac OS X need to massage lines like ..
102 # tcp4 0 0 *.42000 *.* LISTEN
103 # tcp6 0 0 *.42000 *.* LISTEN
105 echo "... and netstat"
106 netstat -an \
107 | tee -a $seq.full \
108 | sed -n -e '/4[23]000.*LISTEN/{
109 s/0\.0\.0\.0/inet/g
110 s/:::/inet6:/g
111 s/tcp4[ 0]*\*./inet./
112 s/tcp6[ 0]*\*./inet6./
113 s/:/./g
114 s/.*\(inet6*.4[23]000\).*\(LISTEN\).*/... \1 ... \2/
116 }' \
117 | sort