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
|
#!/bin/sh
# PCP QA Test No. 1071
# Exercise pmrep with a wide range of different types of metrics.
# See archives/mk.rep.sh for the types being tested against.
#
# Copyright (c) 2016 Red Hat.
#
# check-group-exclude: pcp-uptime
seq=`basename $0`
echo "QA output created by $seq"
. ./common.python
$python -c "from pcp import pmapi" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmapi module not installed"
$python -c "from collections import OrderedDict" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python collections OrderedDict module not installed"
which pmrep >/dev/null 2>&1 || _notrun "pmrep not installed"
if [ $PCP_PLATFORM = freebsd ]
then
# workaround datetime.strftime() in Python that is busted when
# the timezone|timeinfo is, er, Australia/Someplace, for at least
# some parts of the year
#
version=`uname -rs | sed -e 's/FreeBSD //'`
case "$version"
in
14.[0-3]-*)
_notrun "datetime.strftime() botch"
# NOTREACHED
;;
esac
fi
status=1 # failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
_path_filter()
{
sed \
-e "s#$here#QAPATH#g" \
#end
}
# timezone: :Australia/Melbourne (reporting, current is AEDT-11)
# this is not deterministic .... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_archive_filter()
{
sed \
-e '/timezone/s/ (reporting.*)//' \
#end
}
log="--archive $here/archives/rep -z"
metrics1="
kernel.uname.sysname
hinv.machine
kernel.all.lastpid
mem.util.used
network.tcpconn.close
kernel.all.uptime
hinv.ncpu
mem.physmem
hinv.nfilesys
"
metrics2="
proc.psinfo.start_time
network.interface.baudrate
kernel.all.hz
disk.all.read_bytes
kernel.all.sysfork
kernel.percpu.cpu.user
kernel.all.load
hinv.cpu.bogomips
hinv.cpu.clock
network.interface.speed
"
# real QA test starts here
echo "== testing default metrics reporting"
pmrep -s 9 -t 1 -p -P 4 -w 12 -x $log $metrics1 | _archive_filter | _path_filter
pmrep -s 9 -t 1 -p -P 4 -w 12 -x $log $metrics2 | _archive_filter | _path_filter
echo "== testing raw metrics reporting"
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -r $log $metrics1 | _archive_filter | _path_filter
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -r $log $metrics2 | _archive_filter | _path_filter
echo "== testing uninterpolated metrics reporting"
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -u $log $metrics1 | _archive_filter | _path_filter
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -u $log $metrics2 | _archive_filter | _path_filter
echo "== testing uninterpolated raw metrics reporting"
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -u -r $log $metrics1 | _archive_filter | _path_filter
pmrep -s 9 -t 1 -p -P 4 -w 12 -x -u -r $log $metrics2 | _archive_filter | _path_filter
# success, all done
echo "== done"
status=0
exit
|