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
|
#!/bin/sh
# PCP QA Test No. 1745
# Basic checkout of pmlogger double-sampling case.
#
# Copyright (c) 2020 Red Hat. All Rights Reserved.
#
# check-group-exclude: pmdumplog
#
seq=`basename $0`
if [ $# -eq 0 ]
then
echo "QA output created by $seq"
else
echo "QA output created by $seq $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
[ -d $PCP_PMDAS_DIR/simple ] || _notrun "simple PMDA directory is not installed"
_cleanup()
{
cd $here
_restore_pmda_install simple
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
# real QA test starts here
_prepare_pmda_install simple || _exit 1
echo "=== $iam agent installation ==="
$sudo ./Install -e </dev/null >$tmp.out 2>&1
# Check simple metrics have appeared ... X metrics and Y values
_filter_pmda_install <$tmp.out >> $seq_full
echo "=== create pmlogger archive ==="
cat << End-of-File > $tmp.conf
log advisory on default {
kernel.all.pswitch
sample
simple.color
kernel.all.pswitch
}
End-of-File
pmlogger -t 0.25sec -s 7 -c $tmp.conf -l $tmp.log $tmp.archive
cat $tmp.log >> $seq_full
pmdumplog -a $tmp.archive >> $seq_full
echo "=== check archive contents ==="
_filter_pmval()
{
sed \
-e '/^$/d' \
-e '/^metric:/d' \
-e '/^archive:/d' \
-e '/^host:/d' \
-e '/^start:/d' \
-e '/^end:/d' \
-e '/^semantics:/d' \
-e '/^units:/d' \
-e '/^samples:/d' \
#end
}
pmval -U $tmp.archive kernel.all.pswitch \
| tee -a $seq_full \
| _filter_pmval > $tmp.values
lines=`wc -l < $tmp.values`
echo "lines=$lines, expect 6" >>$seq_full
if [ $lines -ge 4 -a $lines -le 7 ]
then
echo "Raw sample count in expected range"
else
echo "Bad sample count: $lines"
cat $tmp.values
status=1
fi
exit
|