3 # exercises pmie_check functionality
5 # Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 [ -f /etc
/gentoo-release
] && _notrun
"Gentoo is lacking chkconfig support"
17 if [ -z "$PCP_PMIECONTROL_PATH" ]
19 echo "Error: botched installation - PCP_PMIECONTROL_PATH not defined"
27 _restore_config
$PCP_PMIECONTROL_PATH
28 _restore_config
$PCP_PMCDCONF_PATH
33 status
=1 # failure is the default!
34 $sudo rm -f $tmp.
* $seq.full
35 signal
=$PCP_BINADM_DIR/pmsignal
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 lhost
=`hostname | sed -e 's/\..*//'`
41 remote
=`./getpmcdhosts -n 1 -L 2>$tmp.out`
42 rhost
=`echo $remote | sed -e 's/\..*//'`
43 [ -z "$remote" ] && _notrun
`cat $tmp.out`
45 # Now that we have pmmgr in the mix, there is more than one pmie
46 # potentially running, so lines like this
47 # ... try /var/lib/pcp/tmp/pmie/25453: different logfile, skip
48 # /var/log/pcp/pmmgr/bozo/pmie.log differs to /tmp/SEQ-PID.log1
49 # are now expected, and not a problem.
54 -e "s/$seq-$$/SEQ-PID/g" \
55 -e "s;$PCP_BIN_DIR/pmie;\$PCP_BIN_DIR/pmie;" \
57 -e 's/\([ "]\)'"$remote"'\([ "]\)/\1REMOTEHOST\2/g' \
58 -e 's/\([ "]\)'"$rhost"'\([ "]\)/\1REMOTEHOST\2/g' \
59 -e 's/\([ "]\)'"$host"'\([ "]\)/\1LOCALHOST\2/g' \
60 -e 's/\([ "]\)local:\([ "]\)/\1LOCALHOST\2/g' \
61 -e "s;/private/tmp;/tmp;g" \
62 -e '/ try .* different logfile, skip/d' \
63 -e '/\/pmmgr\/.* differs to /d' \
70 if [ -d $PCP_TMP_DIR/pmie
]
71 then cd $PCP_TMP_DIR/pmie
75 ls -l >>$here/$seq.full
77 echo "plist=$plist" >>$here/$seq.full
82 ps
-p $process >/dev
/null
2>&1
85 echo "urk, $PCP_TMP_DIR/pmie/$process has no running pmie instance"
87 count
=`expr $count + 1`
88 ps
-f -p $process >>$here/$seq.full
89 if `which pstree >/dev/null 2>&1`
91 pstree
$process >>$here/$seq.full
99 # create a basic pmcd config file
100 cat >$tmp.pmcd.conf
<< EOF
102 irix 1 dso irix_init libirixpmda.so
103 pmcd 2 dso pmcd_init pmda_pmcd.so
104 proc 3 dso proc_init pmda_proc.so
107 # create a pmie config file
108 cat >$tmp.conf
<< EOF
109 foo = sample.long.one;
110 doo = sample.long.ten;
113 # create pmie control files
114 cat >$tmp.control
<< EOF
116 $remote n $tmp.log1 -c $tmp.conf
117 $remote n $tmp.log2 -c $tmp.conf
118 LOCALHOSTNAME n $tmp.log0 $tmp.conf
121 # real QA test starts here
122 _save_config
$PCP_PMIECONTROL_PATH
123 _save_config
$PCP_PMCDCONF_PATH
125 $sudo cp $tmp.pmcd.conf
$PCP_PMCDCONF_PATH
127 $sudo $signal -a -s TERM pmie
>/dev
/null
2>&1
129 _change_config pmcd on
130 _change_config pmie off
131 $sudo rm -f $PCP_TMP_DIR/pmie
/*
134 echo "pmie count at start of QA testing: $?"
137 echo === check default
install operation
===
138 $sudo $PCP_RC_DIR/pmie restart
2>&1 | _filter_pmie_start
140 # chkconfig no longer controls start-ability, expect non-zero
141 echo "pmie count after chkconfig pmie off: $?"
144 echo === check
for missing control
file ===
145 _change_config pmie off
146 $sudo rm -f $PCP_PMIECONTROL_PATH
147 _change_config pmie on
148 $sudo $PCP_RC_DIR/pmie restart
2>&1 | _filter_pmie_start
150 echo "pmie count after attempt without control file: $?"
153 echo === check pmie_check and custom config
===
154 pmie_check
-V -V -N -c $tmp.control
-l $tmp.log
155 cat $tmp.log | _filter
156 # don't bother counting pmie processes, as -N is used above!
160 $sudo $PCP_RC_DIR/pmie stop
2>&1 \
161 | _filter_pmie_start \
162 |
sed -e '/pmie: PMIE not running/d'
163 _change_config pmie off