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
17 [ -d $PCP_PMDAS_DIR/simple
] || _notrun
"simple PMDA directory is not installed"
22 ln $seq.out.ipv6
$seq.out ||
exit 1
24 ln $seq.out.nonipv6
$seq.out ||
exit 1
27 signal
=$PCP_BINADM_DIR/pmsignal
28 status
=1 # failure is the default!
30 trap "_cleanup; exit \$status" 0 1 2 3 15
32 $sudo rm -f $seq.full
$tmp.
*
33 echo "=== I am PID $$" >>$seq.full
34 echo "=== /tmp files" >>$seq.full
35 $sudo ls -l /tmp
/[0-9][0-9]*.
* >>$seq.full
2>&1
36 echo "=== config files" >>$seq.full
37 ls -l $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH >>$seq.full
45 # pmcd may be quite some distance away
47 PMCD_CONNECT_TIMEOUT
=30
48 PMCD_REQUEST_TIMEOUT
=30
49 export PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT
54 -e '/^Installing .mchart view*/d' \
55 -e 's/.* \(hash table entries\)/ NNN \1/' \
56 -e 's/.* \(non-leaf nodes\)/ NNN \1/' \
57 -e 's/.* \(leaf nodes\)/ NNN \1/' \
58 -e 's/.* \(bytes of symbol table\)/ NNN \1/'
65 -e "/^simple.*bin/s/$simple_domain[ ]*[0-9]*[ ]*[0-9]*[ ]*[0-9]*/SIMPLE PID FD FD/" \
66 -e "/^simple.*dso/s/$simple_domain/SIMPLE/" \
67 -e "/^broken.*bin/s/$broken_domain[ ]*[0-9]*[ ]*[0-9]*[ ]*[0-9]*/BROKEN PID FD FD/" \
68 -e "s/[1-2][ ]dso.*linux_init/LINUX DSO/" \
69 -e "s;$PCP_PMDAS_DIR;PCP_PMDAS_DIR;g" \
72 -e "s/cmd=.*pmdas\/broken./cmd=/" \
73 -e "s/ fd=[0-9]*/ fd=FD/" \
74 -e "s/\.$DSO_SUFFIX/.\$DSO_SUFFIX/g" \
75 -e '/UNIX_DOMAIN_SOCKET/d' \
78 /client connection from/ { print; print "..."; skip=1; next }
79 skip == 1 && NF == 0 { skip = 0 }
91 # Remove the PMDA and restore pmcd.conf
96 echo "=== Removing broken_pmda namespace ==="
98 $sudo .
/broken_Remove
-N
105 echo "=== Resetting pmcd.conf back to original state ==="
106 $sudo cp $tmp.conf
$PCP_PMCDCONF_PATH
108 if [ -f $tmp.options
]
110 echo "=== Resetting pmcd.options back to original state ==="
111 echo '=== $PCP_PMCDOPTIONS_PATH before cp' >>$seq.full
112 cat $PCP_PMCDOPTIONS_PATH >>$seq.full
113 echo '=== $tmp.options before cp' >>$seq.full
114 cat $tmp.options
>>$seq.full
115 $sudo cp $tmp.options
$PCP_PMCDOPTIONS_PATH
117 if [ -f $tmp.conf
-o -f $tmp.options
]
119 echo "=== Restart PMCD ==="
120 echo '=== $PCP_PMCDCONF_PATH before init.d/pcp/start' >>$seq.full
121 cat $PCP_PMCDCONF_PATH >>$seq.full
122 echo '=== $PCP_PMCDOPTIONS_PATH before init.d/pcp/start' >>$seq.full
123 cat $PCP_PMCDOPTIONS_PATH >>$seq.full
124 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
129 echo "=== Filter pmcd.log ==="
130 cat $tmp.log | _filter_pmcd
131 echo '=== pmcd log' >>$seq.full
132 cat $tmp.log
>>$seq.full
136 echo "=== Restoring crontab ==="
137 _restore_cron
$tmp.cron
$sudo
139 [ -f $PCP_PMDAS_DIR/simple
/simple.conf.
$seq ] && $sudo mv $PCP_PMDAS_DIR/simple
/simple.conf.
$seq $PCP_PMDAS_DIR/simple
/simple.conf
141 echo "=== /tmp files" >>$seq.full
142 $sudo ls -l /tmp
/[0-9][0-9]*.
* >>$seq.full
2>&1
143 echo "=== config files" >>$seq.full
144 ls -l $PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH >>$seq.full
150 # Removing cron entries that may collide
152 echo "=== Removing potential cron conflicts ==="
153 _remove_cron
$tmp.cron
$sudo
155 # Install broken pmda namespace
157 echo "=== Install broken namespace ==="
158 cd $here/pmdas
/broken
159 $sudo .
/broken_Install
-N < /dev
/null | _filter_ins
2>&1
160 # ensure help text built (-N above skips this)
161 $sudo $PCP_MAKE_PROG broken_v2.dir
> /dev
/null
2>&1
163 echo "=== Broken PMNS ==="
168 echo "Unable to install broken namespace, exiting"
174 echo "=== Building simple agent ==="
175 cd $PCP_PMDAS_DIR/simple
177 # get rid of warnings from simple if no config exists
179 [ -f simple.conf
] && $sudo mv simple.conf simple.conf.
$seq
180 echo "sec,min,hour" >$tmp.simple.conf
181 $sudo cp $tmp.simple.conf simple.conf
183 # Install the simple namespace, I don't bother to remove it again
185 $sudo .
/Install
-N < /dev
/null | _filter_ins
2>&1
186 echo "Namespace installed"
188 if $sudo $PCP_MAKE_PROG > $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
247 cat << end-of-file >> $tmp.latest
248 $agent $domain dso ${agent}_init $path/pmda_$agent.$DSO_SUFFIX
252 $sudo cp $tmp.latest
$PCP_PMCDCONF_PATH
253 # after non-root pmcd changes, the log files may be owned by
254 # root.root or pcp.pcp depending on the pattern of installs and
255 # pmcd restarts ... to be sure we can write the log files, remove
256 # any old ones before signalling pmcd
258 $sudo rm -f $PCP_LOG_DIR/pmcd
/simple.log
* $PCP_LOG_DIR/pmcd
/broken.log
*
259 $sudo $signal -a -s HUP pmcd
>/dev
/null
2>&1
263 if _check_agent
$agent
265 echo "$agent is alive and well"
267 echo "Failed to install $agent"
278 echo "=== Removing $agent ==="
279 _renew_pmcd _agent_remove
281 if _check_agent
$agent
283 echo "Failed to remove $agent"
286 echo "$agent was removed"
290 # Install broken pmda
297 echo "=== Installing $agent ==="
298 cp $tmp.newconf
$tmp.latest
299 cat << end-of-file >> $tmp.latest
300 broken $broken_domain pipe binary $here/pmdas/broken/$agent -d $broken_domain
303 $sudo cp $tmp.latest
$PCP_PMCDCONF_PATH
304 $sudo $signal -a -s HUP pmcd
>/dev
/null
2>&1
308 if _check_agent broken
310 echo "$agent is alive and well...hang on there should be some warnings"
313 elif [ "$num_warn" -ne 5 ]
315 echo "Failed to properly install $agent, expected 4 warnings"
318 echo "$agent is alive and as well as can be expected"
322 # Copy and replace pmcd.conf
324 cp $PCP_PMCDCONF_PATH $tmp.conf
325 cat << end-of-file > $tmp.newconf
326 # pmcd.conf generated by QA 255
330 if [ $PCP_PLATFORM = linux
]
332 cat >>$tmp.newconf
<<End-of-File
334 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
335 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
337 elif [ $PCP_PLATFORM = darwin
]
339 cat >>$tmp.newconf
<<End-of-File
341 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
342 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
344 elif [ $PCP_PLATFORM = solaris
]
346 cat >>$tmp.newconf
<<End-of-File
348 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
349 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
351 elif [ $PCP_PLATFORM = freebsd
]
353 cat >>$tmp.newconf
<<End-of-File
355 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
356 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
359 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
365 # Start with a fresh pmcd log
367 $sudo $signal -a pmgadgets pmchart pmview
>/dev
/null
2>&1
368 $sudo $PCP_RC_DIR/pcp restart | _filter_init
2>&1
371 # Test 2.0 PMDA first
373 _agent_install simple
$simple_domain true
375 _agent_install simple
$simple_domain false
378 # Test 2.0 broken PMDA
380 _broken_install broken_pmda_2_0
2