/var/lib/pcp/testsuite/544 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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | #!/bin/sh
# PCP QA Test No. 544
# testing collectl2pcp metrics extraction (proc indom, in particular)
#
# Copyright (c) 2013 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "cd $here; rm -rf testarchive.* $tmp.*; exit \$status" 0 1 2 3 15
which collectl2pcp >$seq.full 2>&1 || _notrun collectl2pcp not installed
# real QA test starts here
C=./collectl
TA=testarchive
cat > $tmp.general <<End-of-General
disk.dev.avactive
disk.dev.aveq
disk.dev.read
disk.dev.read_bytes
disk.dev.write
disk.dev.write_bytes
hinv.machine
hinv.ncpu
hinv.ndisk
hinv.ninterface
hinv.pagesize
hinv.physmem
kernel.all.cpu.idle
kernel.all.cpu.intr
kernel.all.cpu.irq.hard
kernel.all.cpu.irq.soft
kernel.all.cpu.sys
kernel.all.cpu.user
kernel.all.cpu.wait.total
kernel.all.hz
kernel.all.intr
kernel.all.load
kernel.all.nprocs
kernel.uname.distro
kernel.uname.machine
kernel.uname.nodename
kernel.uname.release
kernel.uname.sysname
mem.physmem
mem.util.active
mem.util.active_anon
mem.util.active_file
mem.util.anonpages
mem.util.bounce
mem.util.bufmem
mem.util.cached
mem.util.commitLimit
mem.util.committed_AS
mem.util.corrupthardware
mem.util.directMap2M
mem.util.directMap4k
mem.util.dirty
mem.util.free
mem.util.hugepagesFree
mem.util.hugepagesRsvd
mem.util.hugepagesSurp
mem.util.hugepagesTotal
mem.util.inactive
mem.util.inactive_anon
mem.util.inactive_file
mem.util.kernelStack
mem.util.mapped
mem.util.mlocked
mem.util.NFS_Unstable
mem.util.pageTables
mem.util.shmem
mem.util.slab
mem.util.slabReclaimable
mem.util.slabUnreclaimable
mem.util.swapCached
mem.util.swapFree
mem.util.swapTotal
mem.util.unevictable
mem.util.vmallocChunk
mem.util.vmallocTotal
mem.util.vmallocUsed
mem.util.writeback
End-of-General
cat > $tmp.cpus <<End-of-CPUs
kernel.percpu.cpu.guest
kernel.percpu.cpu.idle
kernel.percpu.cpu.intr
kernel.percpu.cpu.irq.hard
kernel.percpu.cpu.irq.soft
kernel.percpu.cpu.nice
kernel.percpu.cpu.steal
kernel.percpu.cpu.sys
kernel.percpu.cpu.user
kernel.percpu.cpu.wait.total
End-of-CPUs
cat > $tmp.disks <<End-of-Disks
network.interface.in.bytes
network.interface.in.packets
network.interface.out.bytes
network.interface.out.packets
End-of-Disks
cat > $tmp.nets <<End-of-Nets
network.interface.in.bytes
network.interface.in.packets
network.interface.out.bytes
network.interface.out.packets
network.tcp.rtoalgorithm
network.tcp.rtomin
network.tcp.rtomax
network.tcp.maxconn
network.tcp.activeopens
network.tcp.passiveopens
network.tcp.attemptfails
network.tcp.estabresets
network.tcp.currestab
network.tcp.insegs
network.tcp.outsegs
network.tcp.retranssegs
network.tcp.inerrs
network.tcp.outrsts
network.udp.indatagrams
network.udp.noports
network.udp.inerrors
network.udp.outdatagrams
network.udp.recvbuferrors
network.udp.sndbuferrors
End-of-Nets
cat > $tmp.procs <<End-of-Procs
proc.psinfo.cmd
proc.psinfo.psargs
proc.psinfo.nice
proc.psinfo.start_time
proc.psinfo.vsize
proc.psinfo.rss
proc.psinfo.blocked
proc.psinfo.wchan_s
proc.psinfo.processor
proc.memory.vmsize
proc.memory.vmlock
proc.memory.vmrss
proc.memory.vmdata
proc.memory.vmstack
proc.memory.vmexe
proc.memory.vmlib
proc.memory.vmswap
proc.psinfo.cmd
proc.psinfo.psargs
proc.io.syscr
proc.io.syscw
proc.io.read_bytes
proc.io.write_bytes
proc.io.cancelled_write_bytes
End-of-Procs
_checksums()
{
$sudo rm -f $tmp.out.*
echo "=== General metrics ==="
pminfo -f -a $TA `cat $tmp.general` | tee $tmp.out.general
echo
echo "=== CPU metrics ==="
pminfo -f -a $TA `cat $tmp.cpus` | tee $tmp.out.cpus
echo
echo "=== Disk metrics ==="
pminfo -f -a $TA `cat $tmp.disks` | tee $tmp.out.disks
echo
echo "=== Network metrics ==="
pminfo -f -a $TA `cat $tmp.nets` | tee $tmp.out.nets
echo
echo "=== Process metrics ==="
pminfo -f -a $TA `cat $tmp.procs` | tee $tmp.out.procs
SUM="sum -r"
[ $PCP_PLATFORM = darwin ] && SUM=sum
$SUM $tmp.out.* \
| sed -e 's/[ ][ ]*[0-9]*[ ]/ /' \
| sed -e 's/^00*//' \
| while read chksum path
do
printf "%05d %s\n" $chksum $path | sed -e "s,$tmp,TMP,g"
done
}
# value_checker ... needs control file ($tmp.control) and
# collectl raw data ($tmp.raw) and the $tmp.out.* files from
# _checksums() all in place before we're called
#
_value_checker()
{
echo "Check values ..."
sed <$tmp.control -e '/^#/d' -e '/^$/d' \
| while read metric inst idx scale
do
# pick pcp value from pminfo output like
#
# proc.psinfo.nice
# ...
# inst [1963 or "001963 /sbin/udevd"] value 1234
#
rm -f $tmp.pcp
for out in $tmp.out.*
do
if grep "^$metric\$" <$out >/dev/null
then
$PCP_AWK_PROG <$out >$tmp.pcp '
BEGIN { state = 0 }
$1 == "'"$metric"'" { state = 1; next }
state == 0 { next }
state == 1 && NF == 0 { exit }
state == 1 && /inst \['"$inst"' / { print $NF }'
break
fi
done
# pick collectl value from lines like
# proc:1963 stat 1963 (udevd) S 1 1963 1963 0 -1 4202816 15592 3077542 0 59 23 133 1265 283410 16 -4 1 0 1415 11366400 321 18446744073709551615 140559097348096 140559097471148 140736691194048 140736691189232 140559090053656 0 2147221247 0 0 18446744071580463705 0 0 17 23 0 0 0 0 0
# proc:28062 VmSwap: 0 kB
#
rm -f $tmp.collectl $tmp.tmp
case $idx
in
[1-9][0-9])
# stat line
#
cat $tmp.raw | sed -n -e "/^proc:$inst stat/"'{
s/([^)]*)/(cmd)/
s/^proc:[0-9]* stat /stat /
p
}' \
| head -1 \
| tee $tmp.tmp \
| $PCP_AWK_PROG "{ printf \"%d\\n\",\$$idx * $scale }" >$tmp.collectl
;;
VmSwap|VmRSS)
# lines like
# proc:28062 VmSwap: 0 kB
#
$PCP_AWK_PROG <$tmp.raw '
$1 == "proc:'"$inst"'" && $2 == "'"$idx"':" { print }' \
| head -1 \
| tee $tmp.tmp \
| $PCP_AWK_PROG "{ printf \"%d\\n\",\$3 * $scale }" >$tmp.collectl
;;
esac
__pcp=`cat $tmp.pcp`
if [ -z "$__pcp" ]
then
echo "$metric[$inst]: failed to extract PCP value"
else
__collectl=`cat $tmp.collectl`
if [ -z "$__collectl" ]
then
echo "$metric[$inst]: failed to extract scaled collectl value ($idx)"
[ -s $tmp.tmp ] && echo "from ... `cat $tmp.tmp`"
else
if [ "$__pcp" = "$__collectl" ]
then
echo "$metric[$inst]: match"
else
echo "$metric[$inst]: pcp value \"$__pcp\" != scaled collectl value \"$__collectl\""
fi
fi
fi
echo "$metric[$inst]: pcp=\"$__pcp\" collectl=\"$__collectl\"" >>$seq.full
done
}
# real QA test starts here
echo '## Testing RHEL6.4 inst/value extraction:' | tee -a $seq.full
collectl2pcp -F $C/rhel6.raw.gz $TA
_checksums
# compare values for some metrics and instances
#
cat <<End-of-File >$tmp.control
# metric instance collectl_index scale
proc.psinfo.nice 1963 20 1.0
proc.psinfo.nice 11607 20 1.0
proc.psinfo.nice 11996 20 1.0
# max and smallest non-zero vsize
proc.psinfo.vsize 12223 24 1.0
proc.psinfo.vsize 12232 24 1.0
# max and smallest non-zero rss
proc.psinfo.rss 12223 25 1.0
proc.psinfo.rss 11712 25 1.0
# all vmswap values are 0 in the test data
proc.memory.vmswap 156384 VmSwap 1.0
# max and smallest non-zero rss
proc.memory.vmrss 12223 VmRSS 1.0
proc.memory.vmrss 11712 VmRSS 1.0
End-of-File
zcat <$C/rhel6.raw.gz >$tmp.raw
_value_checker
echo | tee -a $seq.full
echo '## Testing Debian inst/value extraction:' | tee -a $seq.full
collectl2pcp -F $C/debian_sid_detailed.raw.gz $TA
_checksums
# compare values for some metrics and instances
#
cat <<End-of-File >$tmp.control
# metric instance collectl_index scale
proc.psinfo.nice 2459 20 1.0
# max and smallest non-zero vsize
proc.psinfo.vsize 7876 24 1.0
proc.psinfo.vsize 7872 24 1.0
# max and smallest non-zero rss
proc.psinfo.rss 7876 25 1.0
proc.psinfo.rss 7872 25 1.0
# all vmswap values are 0 in the test data
proc.memory.vmswap 8159 VmSwap 1.0
End-of-File
zcat <$C/debian_sid_detailed.raw.gz >$tmp.raw
_value_checker
# success, all done
status=0
exit
|