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
|
#!/bin/sh
# PCP QA Test No. 1869
# pmlogger_daily for pmproxy-pushed archives (like 1698)
# - cull and compress testing
# - see qa/1845 for rewrite and merge 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
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
tee -a $seq_full \
| sed \
-e '/^+ date-and-timestamp /d' \
-e '/^+ pmsignal -s HUP /d' \
-e '/^Add merge callback for: pmlogger_daily_report/d' \
-e '/Warning: skipping log rotation/d' \
-e '/Warning: current volume of current pmlogger not known/d' \
-e "s@$tmp@TMP@g" \
-e "s@\[.*/control@[TMP/control@" \
-e "s/`pmdate -1d %Y%m%d`/TODAY-1/g" \
-e "s/`pmdate -3d %Y%m%d`/TODAY-3/g" \
-e "s/`pmdate -5d %Y%m%d`/TODAY-5/g" \
-e "s/`pmdate -7d %Y%m%d`/TODAY-7/g" \
-e '/^Start \[/s/ 2[0-9:. -]*/ DATESTAMP/' \
-e '/^End \[/s/ 2[0-9:. -]*/ DATESTAMP /' \
# end
}
PCP_LOG_DIR=$tmp; export PCP_LOG_DIR
PCP_REMOTE_ARCHIVE_DIR=$tmp/pmproxy; export PCP_REMOTE_ARCHIVE_DIR
mkdir -p $PCP_REMOTE_ARCHIVE_DIR/qahost || exit 1
# make dates an odd number of days back from now so
# we can cull using an even number of dates
cat <<End-of-File >$tmp.config
qahost tmparch/mv-foo `pmdate -1d %Y%m%d`
qahost tmparch/foo `pmdate -3d %Y%m%d`
qahost tmparch/mv-foo `pmdate -5d %Y%m%d`
qahost tmparch/foo `pmdate -7d %Y%m%d`
End-of-File
./mk.logfarm -c $tmp.config $PCP_REMOTE_ARCHIVE_DIR
ls -lR $tmp >>$seq_full
cat <<End-of-File >$tmp.control
\$version=1.1
End-of-File
# real QA test starts here
echo "== default options ==="
$PCP_BINADM_DIR/pmlogger_daily -V -N -c $tmp.control >$tmp.tmp 2>&1
_filter <$tmp.tmp
echo
echo "== -k 4 -x 2 =="
$PCP_BINADM_DIR/pmlogger_daily -V -N -c $tmp.control -k 4 -x 2 >$tmp.tmp 2>&1
_filter <$tmp.tmp
echo
echo "== \$PCP_CULLAFTER=4 and \$PCP_COMPRESSAFTER=2 in top-level control file =="
cat <<'End-of-File' >$PCP_REMOTE_ARCHIVE_DIR/control
$PCP_CULLAFTER=4
$PCP_COMPRESSAFTER=2
End-of-File
$PCP_BINADM_DIR/pmlogger_daily -V -N -c $tmp.control >$tmp.tmp 2>&1
_filter <$tmp.tmp
rm -f $PCP_REMOTE_ARCHIVE_DIR/control
echo
echo "== \$PCP_CULLAFTER=4 in top-level and \$PCP_COMPRESSAFTER=2 in per-host control files =="
cat <<'End-of-File' >$PCP_REMOTE_ARCHIVE_DIR/control
$PCP_CULLAFTER=4
End-of-File
cat <<'End-of-File' >$PCP_REMOTE_ARCHIVE_DIR/qahost/control
$PCP_COMPRESSAFTER=2
End-of-File
$PCP_BINADM_DIR/pmlogger_daily -V -N -c $tmp.control >$tmp.tmp 2>&1
_filter <$tmp.tmp
rm -f $PCP_REMOTE_ARCHIVE_DIR/control $PCP_REMOTE_ARCHIVE_DIR/qahost/control
echo
echo "== \$PCP_CULLAFTER=? and \$PCP_COMPRESSAFTER=? in both control files =="
cat <<'End-of-File' >$PCP_REMOTE_ARCHIVE_DIR/control
$PCP_CULLAFTER=6
$PCP_COMPRESSAFTER=4
End-of-File
cat <<'End-of-File' >$PCP_REMOTE_ARCHIVE_DIR/qahost/control
$PCP_CULLAFTER=4
$PCP_COMPRESSAFTER=2
End-of-File
$PCP_BINADM_DIR/pmlogger_daily -V -N -c $tmp.control >$tmp.tmp 2>&1
_filter <$tmp.tmp
rm -f $PCP_REMOTE_ARCHIVE_DIR/control $PCP_REMOTE_ARCHIVE_DIR/qahost/control
# success, all done
exit
|