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
|
#!/bin/sh
# PCP QA Test No. 1845
# pmlogger_daily for pmproxy-pushed archives (like 1698)
# - rewrite and merge testing
# - see qa/1869 for cull and compress testing
#
# Copyright (c) 2025 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
# mimic test in pmlogger_daily ...
#
if [ -x "$PCP_BINADM_DIR/pmlogger_daily_report" ]
then
if [ -f $PCP_VAR_DIR/config/pmlogconf/zeroconf/disk ]
then
:
else
_notrun "no zeroconf installation for pmlogger_daily_report metrics"
fi
else
_notrun "pmlogger_daily_report script not installed"
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
save_log_dir="$PCP_LOG_DIR"
_filter()
{
tee -a $seq_full \
| sed \
-e '/cannot create .*pmlogger_daily.pid:/d' \
-e '/pmlogger_daily.pid: Permission denied/d' \
-e '/^Sending SIGHUP to pmproxy /d' \
-e "s@$tmp@TMP@g" \
-e "s@$PCP_BINADM_DIR@PCP_BINADM_DIR@g" \
-e '/^PCP_BINADM_DIR\/pmsignal: .* Operation not permitted/d' \
-e '/^pmsignal: failing command: /d' \
-e "s@$save_log_dir@PCP_LOG_DIR@g" \
-e "s@\[.*/control@[TMP/control@" \
-e "s/`pmdate -1d %Y%m%d`/TODAY-1/g" \
-e "s/`pmdate -2d %Y%m%d`/TODAY-2/g" \
-e '/^Start \[/s/ 2[0-9:. -]*/ DATESTAMP/' \
-e '/^End \[/s/ 2[0-9:. -]*/ DATESTAMP /' \
| _filter_ls -u -g
}
PCP_LOG_DIR=$tmp; export PCP_LOG_DIR
PCP_ARCHIVE_DIR=$tmp/pmlogger; export PCP_ARCHIVE_DIR
PCP_REMOTE_ARCHIVE_DIR=$tmp/pmproxy; export PCP_REMOTE_ARCHIVE_DIR
mkdir -p $PCP_REMOTE_ARCHIVE_DIR/qahost || exit 1
mkdir -p $PCP_ARCHIVE_DIR || exit 1
# ok-foo archives are less than 20sec long, so make the MM.SS parts
# of the archive basenames to ensure there is no temporal overlap
# Dodge: 02:30 ... that is a potential daylight savings black hole
# for timezone Australia/Melbourne, and touch(1) helpfully
# (not!) responds with: invalid date format ‘202510050230.00’
#
cat <<End-of-File >$tmp.config
qahost archives/ok-mv-foo `pmdate -1d %Y%m%d`
qahost archives/ok-foo `pmdate -2d %Y%m%d.00.10`
qahost archives/ok-mv-foo `pmdate -2d %Y%m%d.01.20`
qahost archives/ok-foo `pmdate -2d %Y%m%d.03.30`
End-of-File
./mk.logfarm -c $tmp.config $PCP_REMOTE_ARCHIVE_DIR
ls -lR $tmp >>$seq_full
find $PCP_REMOTE_ARCHIVE_DIR -name "*.index" \
| while read arch
do
pmlogdump -L $arch >>$seq_full
done
cat <<End-of-File >$tmp.control
\$version=1.1
End-of-File
# real QA test starts here
echo "== default options, but no compression ==="
$PCP_BINADM_DIR/pmlogger_daily -V -c $tmp.control -x 5 -l $tmp.out >$tmp.tmp 2>&1
_filter <$tmp.tmp
_filter <$tmp.out
echo "Remaining archives files ..."
find $PCP_REMOTE_ARCHIVE_DIR -type f -print \
| LC_COLLATE=POSIX sort \
| _filter
# success, all done
exit
|