3 # pmlogger and pmlc for proc metrics ... indom problems
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/proc
] || _notrun
"proc PMDA directory is not installed"
21 # some of this is because different platforms produce different
22 # PMIDs for the proc metrics, and the name of the init process is
24 # And on some Linux systems (e.g. Fedora 18), pid 1 is not init, but
25 # /usr/lib/systemd/systemd --switched-root --system --deserialize ...
28 |
grep proc.psinfo.ppid \
29 |
sed -e 's/000*/zeroes.../' \
30 -e 's/ 60\.8\.3 / PMID /' \
31 -e 's/ 3\.1\.8 / PMID /' \
32 -e 's/ 3\.8\.3 / PMID /' \
33 -e 's/ init \[[0-9]*]/ init/' \
34 -e 's/ \/etc\/init\([ "]\)/ init\1/' \
35 -e 's/ \/sbin\/init\([ "]\)/ init\1/' \
36 -e 's/ \/usr\/lib\/systemd\/systemd\([ "]\)/ init\1/' \
37 -e 's/init .*"/init"/'
40 signal
=$PCP_BINADM_DIR/pmsignal
41 status
=1 # failure is the default!
42 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
44 if [ $PCP_PLATFORM = darwin
-o $PCP_PLATFORM = solaris
]
46 _notrun
"No proc metrics for $PCP_PLATFORM"
49 eval `./getpmcdhosts -L -n 2 -m 'proc.psinfo.ppid>=0' | sed -e 's/ / host2=/' -e 's/^/host1=/'`
52 _notrun
"Cannot get first remote pmcd host with proc.psinfo.ppid metrics"
56 _notrun
"Cannot get second remote pmcd host with proc.psinfo.ppid metrics"
60 echo "host1=$host1" >>$seq.full
61 echo "host2=$host2" >>$seq.full
64 install_on_cleanup
=false
65 pminfo proc
>/dev
/null
2>&1 && install_on_cleanup
=true
73 if $install_on_cleanup
75 ( cd $PCP_PMDAS_DIR/proc
; $sudo .
/Install
</dev
/null
>/dev
/null
2>&1 )
77 ( cd $PCP_PMDAS_DIR/proc
; $sudo .
/Remove
</dev
/null
>/dev
/null
2>&1 )
84 trap "_cleanup; exit \$status" 0 1 2 3 15
85 ( cd $PCP_PMDAS_DIR/proc
; $sudo .
/Install
</dev
/null
>/dev
/null
2>&1 )
87 # real QA test starts here
89 echo |
tee -a $seq.full
90 echo "pmlogger directly ..." |
tee -a $seq.full
91 inst
=`pminfo -F proc.psinfo.ppid \
92 | sed -n -e '/inst \[1 /{
100 echo "Arrgh ... cannot find inst for local pid 1" |
tee -a $seq.full
101 pminfo
-F proc.psinfo.ppid
>>$seq.full
105 echo "inst=$inst" >>$seq.full
106 ps
$PCP_PS_ALL_FLAGS |
egrep "PID|$inst" >>$seq.full
108 cat <<end-of-file >$tmp.conf
109 log advisory on once { proc.psinfo.ppid[$inst] }
112 echo "=== pmlogger config ===" >>$seq.full
113 cat $tmp.conf
>>$seq.full
115 rm -f $tmp.0 $tmp.index
$tmp.meta
116 pmlogger
-s 1 -c $tmp.conf
-l $tmp.log
$tmp
120 echo "Warning: pmlogger exit status=$status"
123 x
=`pmdumplog $tmp | _filter`
126 echo "Error: pmdumplog | filter produces nothing"
132 echo |
tee -a $seq.full
133 echo "pmlc for local pmlogger ..." |
tee -a $seq.full
134 rm -f $tmp.0 $tmp.index
$tmp.meta
$tmp.log
135 pmlogger
-L -s 1 -c /dev
/null
-l $tmp.log
$tmp &
137 _wait_for_pmlogger
$pid $tmp.log
138 ( echo "connect $!"; cat $tmp.conf
) | pmlc
140 x
=`pmdumplog $tmp | _filter`
143 echo "Error: pmdumplog | filter produces nothing"
150 echo |
tee -a $seq.full
151 echo "pmlc local, pmcd and pmlogger remote ..." |
tee -a $seq.full
153 inst
=`pminfo -F -h $host1 proc.psinfo.ppid \
154 | sed -n -e '/inst \[1 /{
161 echo "Arrgh ... cannot find inst for host $host1 pid 1" |
tee -a $seq.full
162 pminfo
-F -h $host1 proc.psinfo.ppid
>>$seq.full
165 cat <<end-of-file >$tmp.conf
166 log advisory on once { proc.psinfo.ppid[$inst] }
169 echo "inst=$inst" >>$seq.full
170 ssh -q pcpqa@
$host1 ps
-e |
egrep "PID|$inst" >>$seq.full
171 echo "=== pmlogger config ===" >>$seq.full
172 cat $tmp.conf
>>$seq.full
174 cat <<end-of-file >$tmp.cmd
175 . \$PCP_DIR/etc/pcp.env
177 ( \$PCP_BINADM_DIR/pmlogger -L -s 1 -c /dev/null -l /tmp/\$\$.log /tmp/\$\$ </dev/null >/dev/null 2>&1 ) &
178 echo rem_pid=\$! rem_tmp=\$\$
181 scp
-q $tmp.cmd pcpqa@
$host1:$tmp.cmd
182 eval `ssh -q pcpqa@$host1 /bin/sh $tmp.cmd`
186 echo "Arrgh ... failed to get remote pmlogger pid"
192 echo "Arrgh ... failed to get remote archive basename"
196 # if this fails, /hosts/$host1 may not help to diagnose the failure
197 # if $host1 is not exporting filesystems via NFS and/or the local
198 # host is not mounting them via NFS ... only matters if the remote
199 # pmlogger does not start ...
201 _wait_for_pmlogger
"-h $host1 $rem_pid" /hosts
/$host1/tmp
/$rem_tmp.log
203 ( echo "connect $rem_pid@$host1"; cat $tmp.conf
) | pmlc
205 rm -f $tmp.0 $tmp.meta
$tmp.index
206 scp
-q pcpqa@
$host1:/tmp
/$rem_tmp.index
$tmp.index
207 scp
-q pcpqa@
$host1:/tmp
/$rem_tmp.meta
$tmp.meta
208 scp
-q pcpqa@
$host1:/tmp
/$rem_tmp.0 $tmp.0
209 x
=`pmdumplog $tmp | _filter`
212 echo "Error: pmdumplog | filter produces nothing"
218 ssh -q pcpqa@
$host1 "rm -f /tmp/$rem_tmp.*"
220 echo |
tee -a $seq.full
221 echo "pmlc local, pmcd remote on one host, pmlogger remote on a different host ..." |
tee -a $seq.full
222 # need this in the format of the pmcd that pmlogger is connected to
224 inst
=`pminfo -F -h $host2 proc.psinfo.ppid \
225 | sed -n -e '/inst \[1 /{
232 echo "Arrgh ... cannot find inst for host $host2 pid 1" |
tee -a $seq.full
233 pminfo
-F -h $host2 proc.psinfo.ppid
>>$seq.full
236 cat <<end-of-file >$tmp.conf
237 log advisory on once { proc.psinfo.ppid[$inst] }
240 echo "inst=$inst" >>$seq.full
241 ssh -q pcpqa@
$host2 ps
-e |
egrep "PID|$inst" >>$seq.full
242 echo "=== pmlogger config ===" >>$seq.full
243 cat $tmp.conf
>>$seq.full
245 cat <<end-of-file >$tmp.cmd
246 . \$PCP_DIR/etc/pcp.env
248 ( \$PCP_BINADM_DIR/pmlogger -h $host2 -L -s 1 -c /dev/null -l /tmp/\$\$.log /tmp/\$\$ </dev/null >/dev/null 2>&1 ) &
249 echo rem_pid=\$! rem_tmp=\$\$
252 scp
$tmp.cmd pcpqa@
$host1:$tmp.cmd
253 eval `ssh -q pcpqa@$host1 /bin/sh $tmp.cmd`
257 echo "Arrgh ... failed to get remote pmlogger pid"
263 echo "Arrgh ... failed to get remote archive basename"
267 # see note above about /hosts/$host1
269 _wait_for_pmlogger
"-h $host1 $rem_pid" /hosts
/$host1/tmp
/$rem_tmp.log
271 ( echo "connect $rem_pid@$host1"; cat $tmp.conf
) | pmlc
273 rm -f $tmp.0 $tmp.meta
$tmp.index
274 scp pcpqa@
$host1:/tmp
/$rem_tmp.index
$tmp.index
275 scp pcpqa@
$host1:/tmp
/$rem_tmp.meta
$tmp.meta
276 scp pcpqa@
$host1:/tmp
/$rem_tmp.0 $tmp.0
277 x
=`pmdumplog $tmp | _filter`
280 echo "Error: pmdumplog | filter produces nothing"
286 ssh -q pcpqa@
$host1 "rm -f /tmp/$rem_tmp.*"