3 # Test PMCD's ability to detect and cleanup agents it didn't create when they
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard filters
17 which netstat
>/dev
/null
2>&1 || _notrun
"netstat not installed"
22 ln $seq.out.ipv6
$seq.out ||
exit 1
24 ln $seq.out.nonipv6
$seq.out ||
exit 1
27 trap "rm -f $tmp.*; exit" 0 1 2 3 15
29 # real QA test starts here
31 signal
=$PCP_BINADM_DIR/pmsignal
38 _filter_pmcd_log
<$log \
45 -e '/^sample/s/.*/sample agent.../' \
46 -e 's/fd=[0-9][0-9]*/fd=<n>/g' \
47 -e 's/^ ok [0-9]*/ ok <n>/g' \
48 -e '/^test/s/ *[0-9][0-9]* *[0-9][0-9]* ... bin/ <n> <n> <n> bin/' \
49 -e '/Resource busy/d' \
50 -e 's/0x[^ ]*\([^ ][^ ][^ ]\)/ADDR...\1/' \
51 -e '/client connection from/,/^$/d' \
53 -e '/Info: spindle_stats_init/d' \
54 -e '/UNIX_DOMAIN_SOCKET/d'
60 -e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
61 -e 's/^\(Log finished\) .*/\1 .../'
70 if [ -d $PCP_LOG_DIR/pmlogger
]
72 LOGGING_DIR
=$PCP_LOG_DIR/pmlogger
74 LOGGING_DIR
=$PCP_LOG_DIR
79 _restore_config
$PCP_PMCDCONF_PATH
80 pmafm
$LOGGING_DIR/$LOCALHOST/Latest remove
>$tmp.cmd
2>&1 \
82 echo "Restarting pmcd"
83 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
89 trap interrupt
1 2 3 15
93 if [ $PCP_PLATFORM = linux
]
95 cat >$tmp.config
<<End-of-file
96 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
97 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
98 test $domain socket inet 2222
100 elif [ $PCP_PLATFORM = darwin
]
102 cat >$tmp.config
<<End-of-file
103 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
104 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
105 test $domain socket inet 2222
107 elif [ $PCP_PLATFORM = solaris
]
109 cat >>$tmp.config
<<End-of-File
110 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
111 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
112 test $domain socket inet 2222
115 echo "Error - need pmcd.conf setup for $PCP_PLATFORM"
119 # netstat -an formats
122 # tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN
125 # tcp4 0 0 *.2222 *.* LISTEN
128 # *.2222 *.* 0 0 128000 0 LISTEN
131 $sudo $signal -a pmgadgets pmchart pmview pmie
>/dev
/null
2>&1
132 src
/pmdashutdown
-i 2222 -d $domain -l $tmp.pmdalog
&
134 echo "pmdashutdown pid: $pid" >$seq.full
137 echo "port 2222 should be listening"
142 -e 's/127\.0\.0\.1/*/g' \
143 -e 's/0\.0\.0\.0/*/g' \
145 -e 's/.*\(\*.2222\).*\(LISTEN\).*/... \1 ... \2/'
148 _save_config
$PCP_PMCDCONF_PATH
149 $sudo cp $tmp.config
$PCP_PMCDCONF_PATH
150 pmafm
$LOGGING_DIR/$LOCALHOST/Latest remove
>$tmp.cmd
2>&1 \
152 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
155 # cat $config | sed -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;"
158 # wait for pmdashutdown to finish
163 echo "wait for pmdashutdown to finish ... cycle $t" >>$seq.full
164 if ps
$PCP_PS_ALL_FLAGS |
tee -a $seq.full | cut
-f1 |
grep $pid >/dev
/null
2>&1
173 cat $tmp.pmdalog
>>$seq.full
175 echo "pmda log (should have terminated):"
176 _filter_pmda_log
<$tmp.pmdalog
179 $sudo $signal -a -s HUP pmcd
181 # wait for PMCD to finish writing log (or 5 seconds)
184 if egrep '^Cleanup "test" agent' $log >/dev
/null
2>&1