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
|
#!/bin/sh
# PCP QA Test No. 1430
# Do the default pmlogger config and pmlogger_daily_report
# play well together?
#
# Copyright (c) 2022 Ken McDonell. All Rights Reserved.
#
if [ $# -eq 0 ]
then
seq=`basename $0`
echo "QA output created by $seq"
else
# use $seq from caller, unless not set
[ -n "$seq" ] || seq=`basename $0`
echo "QA output created by `basename $0` $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
[ -x $PCP_BINADM_DIR/pmlogger_daily_report ] || \
_notrun pmlogger_daily_report not installed
[ -d $PCP_VAR_DIR/config/pmlogconf/zeroconf ] || \
_notrun pmlogconf files for zeroconf not installed
which pmrep >/dev/null 2>&1 || \
_notrun pmrep not installed
# need standard derived metrics for some of the reports
#
unset PCP_DERIVED_CONFIG
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
# some metrics are unavailable on some platforms, some may be
# unavailable depending on configuration, e.g. device mapper,
# and some may have an empty indom (no values), so deal with
# that here
#
_filter()
{
echo "s@$tmp@TMP@g" >$tmp.sed
echo '/^Invalid metric disk.dm.discard_bytes/d' >>$tmp.sed
echo '/PM_ERR_INDOM_LOG/d' >>$tmp.sed
sed -f $tmp.sed
}
# more or less from pmlogger_daily_report ... in this test
# we're only interested in unexepected errors, not the actual
# pmlogger_daily_report from the running system
#
_report()
{
echo | tee -a $seq_full
echo "=== $1 ===" | tee -a $seq_full
pmrep -a $tmp -z -E 0 -p -f%H:%M:%S -t1sec "$1" >$tmp.out 2>$tmp.err
cat $tmp.out $tmp.err >>$seq_full
if [ -s $tmp.out ]
then
:
else
_filter <$tmp.err
fi
}
# real QA test starts here
# start with a fresh shiny pmlogconf-generated pmlogger config
# ... use same options as pmlogger_check does
#
$PCP_BINADM_DIR/pmlogconf -r -c -q $tmp.config 2>&1 \
| _filter
cat $tmp.config >>$seq_full
# now log like crazy for 5 secs
#
echo "Run pmlogger ..."
pmlogger -l $tmp.log -t 1sec -T 5sec -c $tmp.config $tmp
cat $tmp.log >>$seq_full
# copied directly from pmlogger_daily_report ... if things
# change there, need to track changes here
#
_report :sar-u-ALL '# CPU Utilization statistics, all CPUS'
_report :sar-u-ALL-P-ALL '# CPU Utilization statistics, per-CPU'
_report :vmstat '# virtual memory (vmstat) statistics'
_report :vmstat-a '# virtual memory active/inactive memory statistics'
_report :sar-B '# paging statistics'
_report :sar-b '# I/O and transfer rate statistics'
_report :sar-d-dev '# block device statistics'
_report :sar-d-dm '# device-mapper device statistics'
_report :sar-F '# mounted filesystem statistics'
_report :sar-H '# hugepages utilization statistics'
_report :sar-I-SUM '# interrupt statistics, summed'
_report :sar-n-DEV '# network statistics, per device'
_report :sar-n-EDEV '# network error statistics, per device'
_report :sar-n-NFSv4 '# NFSv4 client and RPC statistics'
_report :sar-n-NFSDv4 '# NFSv4 server and RPC statistics'
_report :sar-n-SOCK '# socket statistics'
_report :sar-n-TCP-ETCP '# TCP statistics'
_report :sar-q '# queue length and load averages'
_report :sar-r '# memory utilization statistics'
_report :sar-S '# swap usage statistics'
_report :sar-W '# swapping statistics'
_report :sar-w '# task creation and system switching statistics'
_report :sar-y '# TTY devices activity'
_report :numa-hint-faults '# NUMA hint fault statistics'
_report :numa-per-node-cpu '# NUMA per-node CPU statistics'
_report :numa-pgmigrate-per-node '# NUMA per-node page migration statistics'
# success, all done
exit
|