3 # exercise pmcd <-> pmda version exchange
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard filters
20 ln $seq.out.ipv6
$seq.out ||
exit 1
22 ln $seq.out.nonipv6
$seq.out ||
exit 1
25 signal
=$PCP_BINADM_DIR/pmsignal
26 status
=1 # failure is the default!
28 trap "_cleanup; exit \$status" 0 1 2 3 15
30 $sudo rm -f $seq.full
$tmp.
*
31 echo "=== I am PID $$" >>$seq.full
32 echo "=== /tmp files" >>$seq.full
33 $sudo ls -l /tmp
/[0-9][0-9]*.
* >>$seq.full
2>&1
34 echo "=== config files" >>$seq.full
35 ls -l $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH >>$seq.full
43 # pmcd may be quite some distance away
45 PMCD_CONNECT_TIMEOUT
=30
46 PMCD_REQUEST_TIMEOUT
=30
47 export PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT
52 -e '/^Installing .mchart view*/d' \
53 -e 's/.* \(hash table entries\)/ NNN \1/' \
54 -e 's/.* \(non-leaf nodes\)/ NNN \1/' \
55 -e 's/.* \(leaf nodes\)/ NNN \1/' \
56 -e 's/.* \(bytes of symbol table\)/ NNN \1/'
63 -e "/^simple.*bin/s/$simple_domain[ ]*[0-9]*[ ]*[0-9]*[ ]*[0-9]*/SIMPLE PID FD FD/" \
64 -e "/^simple.*dso/s/$simple_domain/SIMPLE/" \
65 -e "/^broken.*bin/s/$broken_domain[ ]*[0-9]*[ ]*[0-9]*[ ]*[0-9]*/BROKEN PID FD FD/" \
66 -e "s/[1-2][ ]dso.*irix_init/LIBIRIXPMDA DSO/" \
67 -e "s/[1-2][ ]dso.*linux_init/LINUX DSO/" \
68 -e "s;$PCP_PMDAS_DIR;PCP_PMDAS_DIR;g" \
71 -e "s/cmd=.*pmdas\/broken./cmd=/" \
72 -e "s/ fd=[0-9]*/ fd=FD/" \
73 -e "s/\.$DSO_SUFFIX/.\$DSO_SUFFIX/g" \
74 -e '/UNIX_DOMAIN_SOCKET/d' \
77 /client connection from/ { print; print "..."; skip=1; next }
78 skip == 1 && NF == 0 { skip = 0 }
90 # Remove the PMDA and restore pmcd.conf
95 echo "=== Removing broken_pmda namespace ==="
97 $sudo .
/broken_Remove
-N
104 echo "=== Resetting pmcd.conf back to original state ==="
105 $sudo cp $tmp.conf
$PCP_PMCDCONF_PATH
107 if [ -f $tmp.options
]
109 echo "=== Resetting pmcd.options back to original state ==="
110 echo '=== $PCP_PMCDOPTIONS_PATH before cp' >>$seq.full
111 cat $PCP_PMCDOPTIONS_PATH >>$seq.full
112 echo '=== $tmp.options before cp' >>$seq.full
113 cat $tmp.options
>>$seq.full
114 $sudo cp $tmp.options
$PCP_PMCDOPTIONS_PATH
116 if [ -f $tmp.conf
-o -f $tmp.options
]
118 echo "=== Restart PMCD ==="
119 echo '=== $PCP_PMCDCONF_PATH before init.d/pcp/start' >>$seq.full
120 cat $PCP_PMCDCONF_PATH >>$seq.full
121 echo '=== $PCP_PMCDOPTIONS_PATH before init.d/pcp/start' >>$seq.full
122 cat $PCP_PMCDOPTIONS_PATH >>$seq.full
123 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
128 echo "=== Filter pmcd.log ==="
129 cat $tmp.log | _filter_pmcd
130 echo '=== pmcd log' >>$seq.full
131 cat $tmp.log
>>$seq.full
135 echo "=== Restoring crontab ==="
136 _restore_cron
$tmp.cron
$sudo
138 [ -f $PCP_PMDAS_DIR/simple
/simple.conf.
$seq ] && $sudo mv $PCP_PMDAS_DIR/simple
/simple.conf.
$seq $PCP_PMDAS_DIR/simple
/simple.conf
140 echo "=== /tmp files" >>$seq.full
141 $sudo ls -l /tmp
/[0-9][0-9]*.
* >>$seq.full
2>&1
142 echo "=== config files" >>$seq.full
143 ls -l $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH >>$seq.full
149 # Removing cron entries that may collide
151 echo "=== Removing potential cron conflicts ==="
152 _remove_cron
$tmp.cron
$sudo
154 # Install broken pmda namespace
156 echo "=== Install broken namespace ==="
157 cd $here/pmdas
/broken
158 $sudo .
/broken_Install
-N < /dev
/null | _filter_ins
2>&1
159 # ensure help text built (-N above skips this)
160 $sudo make broken_v2.dir
> /dev
/null
2>&1
162 echo "=== Broken PMNS ==="
167 echo "Unable to install broken namespace, exiting"
173 echo "=== Building simple agent ==="
174 cd $PCP_PMDAS_DIR/simple
176 # get rid of warnings from simple if no config exists
178 [ -f simple.conf
] && $sudo mv simple.conf simple.conf.
$seq
179 echo "sec,min,hour" >$tmp.simple.conf
180 $sudo cp $tmp.simple.conf simple.conf
182 # Install the simple namespace, I don't bother to remove it again
184 $sudo .
/Install
-N < /dev
/null | _filter_ins
2>&1
185 echo "Namespace installed"
187 # if $sudo smake -f Makefile > $tmp.make 2>&1
188 if $sudo make > $tmp.
make 2>&1
192 echo "Unable to build the simple PMDA:"
196 sed -e "/^@ SIMPLE/s/SIMPLE/$simple_domain/" < help \
197 |
$sudo $PCP_BINADM_DIR/newhelp
-v 2 -o help
198 echo "Help generated"
201 # Replace pmcd.options
203 echo "=== Replacing pmcd.options ==="
204 $sudo cp $PCP_PMCDOPTIONS_PATH $tmp.options
205 cat << end-of-file > $tmp.newoptions
206 # New pmcd.options file created by QA 255
213 $sudo cp $tmp.newoptions
$PCP_PMCDOPTIONS_PATH
214 # Do not restart pmcd here, do it after changing pmcd.conf later
218 echo "=== Restarting PMCD with minimal PMDAs ==="
219 if [ -f $tmp.newconf
]
221 $sudo cp $tmp.newconf
$PCP_PMCDCONF_PATH
222 $sudo $signal -a -s HUP pmcd
>/dev
/null
2>&1
226 echo caller
- $1 - has not created
$tmp.newconf
!!!
230 # Install a standard pmda, but do not mess with the namespace
237 path
=$PCP_PMDAS_DIR/$agent
239 echo "=== Installing $agent ==="
240 cp $tmp.newconf
$tmp.latest
243 cat << end-of-file >> $tmp.latest
244 $agent $domain pipe binary $path/pmda$agent -d $domain
248 [ $PCP_PLATFORM = irix
] && prefix
=`pmobjstyle`.
249 cat << end-of-file >> $tmp.latest
250 $agent $domain dso ${agent}_init $path/${prefix}pmda_$agent.$DSO_SUFFIX
254 $sudo cp $tmp.latest
$PCP_PMCDCONF_PATH
255 # after non-root pmcd changes, the log files may be owned by
256 # root.root or pcp.pcp depending on the pattern of installs and
257 # pmcd restarts ... to be sure we can write the log files, remove
258 # any old ones before signalling pmcd
260 $sudo rm -f $PCP_LOG_DIR/pmcd
/simple.log
* $PCP_LOG_DIR/pmcd
/broken.log
*
261 $sudo $signal -a -s HUP pmcd
>/dev
/null
2>&1
265 if _check_agent
$agent
267 echo "$agent is alive and well"
269 echo "Failed to install $agent"
280 echo "=== Removing $agent ==="
281 _renew_pmcd _agent_remove
283 if _check_agent
$agent
285 echo "Failed to remove $agent"
288 echo "$agent was removed"
292 # Install broken pmda
299 echo "=== Installing $agent ==="
300 cp $tmp.newconf
$tmp.latest
301 cat << end-of-file >> $tmp.latest
302 broken $broken_domain pipe binary $here/pmdas/broken/$agent -d $broken_domain
305 $sudo cp $tmp.latest
$PCP_PMCDCONF_PATH
306 $sudo $signal -a -s HUP pmcd
>/dev
/null
2>&1
310 if _check_agent broken
312 echo "$agent is alive and well...hang on there should be some warnings"
315 elif [ "$num_warn" -ne 5 ]
317 echo "Failed to properly install $agent, expected 4 warnings"
320 echo "$agent is alive and as well as can be expected"
324 # Copy and replace pmcd.conf
326 cp $PCP_PMCDCONF_PATH $tmp.conf
327 cat << end-of-file > $tmp.newconf
328 # pmcd.conf generated by QA 255
332 if [ $PCP_PLATFORM = irix
]
334 cat >>$tmp.newconf
<<End-of-File
336 irix 1 dso irix_init libirixpmda.so
337 pmcd 2 dso pmcd_init pmda_pmcd.so
339 elif [ $PCP_PLATFORM = linux
]
341 cat >>$tmp.newconf
<<End-of-File
343 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
344 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
346 elif [ $PCP_PLATFORM = darwin
]
348 cat >>$tmp.newconf
<<End-of-File
350 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
351 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
353 elif [ $PCP_PLATFORM = solaris
]
355 cat >>$tmp.newconf
<<End-of-File
356 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
357 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
360 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
366 # Start with a fresh pmcd log
368 $sudo $signal -a pmgadgets pmchart pmview
>/dev
/null
2>&1
369 $sudo $PCP_RC_DIR/pcp restart | _filter_init
2>&1
372 # Test 2.0 PMDA first
374 _agent_install simple
$simple_domain true
376 _agent_install simple
$simple_domain false
379 # Test 2.0 broken PMDA
381 _broken_install broken_pmda_2_0
2