/var/lib/pcp/testsuite/308 is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | #! /bin/sh
# PCP QA Test No. 308
# pmlogger and pmlc for proc metrics ... indom problems
# pv #452417
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
[ -d $PCP_PMDAS_DIR/proc ] || _notrun "proc PMDA directory is not installed"
_filter()
{
# some of this is because different platforms produce different
# PMIDs for the proc metrics, and the name of the init process is
# different
# And on some Linux systems (e.g. Fedora 18), pid 1 is not init, but
# /usr/lib/systemd/systemd --switched-root --system --deserialize ...
#
_filter_pmdumplog \
| grep proc.psinfo.ppid \
| sed -e 's/000*/zeroes.../' \
-e 's/ 60\.8\.3 / PMID /' \
-e 's/ 3\.1\.8 / PMID /' \
-e 's/ 3\.8\.3 / PMID /' \
-e 's/ init \[[0-9]*]/ init/' \
-e 's/ \/etc\/init\([ "]\)/ init\1/' \
-e 's/ \/sbin\/init\([ "]\)/ init\1/' \
-e 's/ \/usr\/lib\/systemd\/systemd\([ "]\)/ init\1/' \
-e 's/init .*"/init"/'
}
signal=$PCP_BINADM_DIR/pmsignal
status=1 # failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
if [ $PCP_PLATFORM = darwin -o $PCP_PLATFORM = solaris ]
then
_notrun "No proc metrics for $PCP_PLATFORM"
fi
eval `./getpmcdhosts -L -n 2 -m 'proc.psinfo.ppid>=0' | sed -e 's/ / host2=/' -e 's/^/host1=/'`
if [ -z "$host1" ]
then
_notrun "Cannot get first remote pmcd host with proc.psinfo.ppid metrics"
fi
if [ -z "$host2" ]
then
_notrun "Cannot get second remote pmcd host with proc.psinfo.ppid metrics"
fi
rm -f $seq.full
echo "host1=$host1" >>$seq.full
echo "host2=$host2" >>$seq.full
done_clean=false
install_on_cleanup=false
pminfo proc >/dev/null 2>&1 && install_on_cleanup=true
_cleanup()
{
if $done_clean
then
:
else
if $install_on_cleanup
then
( cd $PCP_PMDAS_DIR/proc; $sudo ./Install </dev/null >/dev/null 2>&1 )
else
( cd $PCP_PMDAS_DIR/proc; $sudo ./Remove </dev/null >/dev/null 2>&1 )
fi
done_clean=true
fi
$sudo rm -f $tmp.*
exit $status
}
trap "_cleanup; exit \$status" 0 1 2 3 15
( cd $PCP_PMDAS_DIR/proc; $sudo ./Install </dev/null >/dev/null 2>&1 )
# real QA test starts here
echo | tee -a $seq.full
echo "pmlogger directly ..." | tee -a $seq.full
inst=`pminfo -F proc.psinfo.ppid \
| sed -n -e '/inst \[1 /{
s/^[^"]*"/"/
s/] value .*//
p
}'`
if [ -z "$inst" ]
then
echo "Arrgh ... cannot find inst for local pid 1" | tee -a $seq.full
pminfo -F proc.psinfo.ppid >>$seq.full
exit
fi
echo "inst=$inst" >>$seq.full
ps $PCP_PS_ALL_FLAGS | egrep "PID|$inst" >>$seq.full
cat <<end-of-file >$tmp.conf
log advisory on once { proc.psinfo.ppid[$inst] }
end-of-file
echo "=== pmlogger config ===" >>$seq.full
cat $tmp.conf >>$seq.full
rm -f $tmp.0 $tmp.index $tmp.meta
pmlogger -s 1 -c $tmp.conf -l $tmp.log $tmp
status=$?
if [ $status -ne 0 ]
then
echo "Warning: pmlogger exit status=$status"
cat $tmp.log
fi
x=`pmdumplog $tmp | _filter`
if [ -z "$x" ]
then
echo "Error: pmdumplog | filter produces nothing"
pmdumplog -dilmst $tmp
else
echo "$x"
fi
echo | tee -a $seq.full
echo "pmlc for local pmlogger ..." | tee -a $seq.full
rm -f $tmp.0 $tmp.index $tmp.meta $tmp.log
pmlogger -L -s 1 -c /dev/null -l $tmp.log $tmp &
pid=$!
_wait_for_pmlogger $pid $tmp.log
( echo "connect $!"; cat $tmp.conf ) | pmlc
sleep 2
x=`pmdumplog $tmp | _filter`
if [ -z "$x" ]
then
echo "Error: pmdumplog | filter produces nothing"
$signal -s TERM $pid
pmdumplog -dilmst $tmp
else
echo "$x"
fi
echo | tee -a $seq.full
echo "pmlc local, pmcd and pmlogger remote ..." | tee -a $seq.full
inst=`pminfo -F -h $host1 proc.psinfo.ppid \
| sed -n -e '/inst \[1 /{
s/^[^"]*"/"/
s/] value .*//
p
}'`
if [ -z "$inst" ]
then
echo "Arrgh ... cannot find inst for host $host1 pid 1" | tee -a $seq.full
pminfo -F -h $host1 proc.psinfo.ppid >>$seq.full
exit
fi
cat <<end-of-file >$tmp.conf
log advisory on once { proc.psinfo.ppid[$inst] }
end-of-file
echo "inst=$inst" >>$seq.full
ssh -q pcpqa@$host1 ps -e | egrep "PID|$inst" >>$seq.full
echo "=== pmlogger config ===" >>$seq.full
cat $tmp.conf >>$seq.full
cat <<end-of-file >$tmp.cmd
. \$PCP_DIR/etc/pcp.env
rm -f /tmp/\$\$.*
( \$PCP_BINADM_DIR/pmlogger -L -s 1 -c /dev/null -l /tmp/\$\$.log /tmp/\$\$ </dev/null >/dev/null 2>&1 ) &
echo rem_pid=\$! rem_tmp=\$\$
end-of-file
scp -q $tmp.cmd pcpqa@$host1:$tmp.cmd
eval `ssh -q pcpqa@$host1 /bin/sh $tmp.cmd`
if [ -z "$rem_pid" ]
then
echo "Arrgh ... failed to get remote pmlogger pid"
exit
fi
if [ -z "$rem_tmp" ]
then
echo "Arrgh ... failed to get remote archive basename"
exit
fi
# if this fails, /hosts/$host1 may not help to diagnose the failure
# if $host1 is not exporting filesystems via NFS and/or the local
# host is not mounting them via NFS ... only matters if the remote
# pmlogger does not start ...
#
_wait_for_pmlogger "-h $host1 $rem_pid" /hosts/$host1/tmp/$rem_tmp.log
( echo "connect $rem_pid@$host1"; cat $tmp.conf ) | pmlc
sleep 2
rm -f $tmp.0 $tmp.meta $tmp.index
scp -q pcpqa@$host1:/tmp/$rem_tmp.index $tmp.index
scp -q pcpqa@$host1:/tmp/$rem_tmp.meta $tmp.meta
scp -q pcpqa@$host1:/tmp/$rem_tmp.0 $tmp.0
x=`pmdumplog $tmp | _filter`
if [ -z "$x" ]
then
echo "Error: pmdumplog | filter produces nothing"
$signal -s TERM $pid
pmdumplog -dilmst $tmp
else
echo "$x"
fi
ssh -q pcpqa@$host1 "rm -f /tmp/$rem_tmp.*"
echo | tee -a $seq.full
echo "pmlc local, pmcd remote on one host, pmlogger remote on a different host ..." | tee -a $seq.full
# need this in the format of the pmcd that pmlogger is connected to
#
inst=`pminfo -F -h $host2 proc.psinfo.ppid \
| sed -n -e '/inst \[1 /{
s/^[^"]*"/"/
s/] value .*//
p
}'`
if [ -z "$inst" ]
then
echo "Arrgh ... cannot find inst for host $host2 pid 1" | tee -a $seq.full
pminfo -F -h $host2 proc.psinfo.ppid >>$seq.full
exit
fi
cat <<end-of-file >$tmp.conf
log advisory on once { proc.psinfo.ppid[$inst] }
end-of-file
echo "inst=$inst" >>$seq.full
ssh -q pcpqa@$host2 ps -e | egrep "PID|$inst" >>$seq.full
echo "=== pmlogger config ===" >>$seq.full
cat $tmp.conf >>$seq.full
cat <<end-of-file >$tmp.cmd
. \$PCP_DIR/etc/pcp.env
rm -f /tmp/\$\$.*
( \$PCP_BINADM_DIR/pmlogger -h $host2 -L -s 1 -c /dev/null -l /tmp/\$\$.log /tmp/\$\$ </dev/null >/dev/null 2>&1 ) &
echo rem_pid=\$! rem_tmp=\$\$
end-of-file
scp $tmp.cmd pcpqa@$host1:$tmp.cmd
eval `ssh -q pcpqa@$host1 /bin/sh $tmp.cmd`
if [ -z "$rem_pid" ]
then
echo "Arrgh ... failed to get remote pmlogger pid"
exit
fi
if [ -z "$rem_tmp" ]
then
echo "Arrgh ... failed to get remote archive basename"
exit
fi
# see note above about /hosts/$host1
#
_wait_for_pmlogger "-h $host1 $rem_pid" /hosts/$host1/tmp/$rem_tmp.log
( echo "connect $rem_pid@$host1"; cat $tmp.conf ) | pmlc
sleep 2
rm -f $tmp.0 $tmp.meta $tmp.index
scp pcpqa@$host1:/tmp/$rem_tmp.index $tmp.index
scp pcpqa@$host1:/tmp/$rem_tmp.meta $tmp.meta
scp pcpqa@$host1:/tmp/$rem_tmp.0 $tmp.0
x=`pmdumplog $tmp | _filter`
if [ -z "$x" ]
then
echo "Error: pmdumplog | filter produces nothing"
$signal -s TERM $pid
pmdumplog -dilmst $tmp
else
echo "$x"
fi
ssh -q pcpqa@$host1 "rm -f /tmp/$rem_tmp.*"
# success, all done
status=0
exit
|