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 124 125 126 127 128 129
|
#!/bin/sh
# PCP QA Test No. 1163
# Test direct rewriting of help text records.
#
# Copyright (c) 2018 Red Hat. All Rights Reserved.
#
# check-group-exclude: pmdumplog
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed -e "s|$tmp.config|CONFIG|"
}
# real QA test starts here
# Create a config file
cat > $tmp.config <<EOF
# do nothing
text metric 2.0.20 { }
text indom 60.1 { }
# delete metric text records
text metric pmcd.numagents oneline { delete }
text metric 2.0.3 help { delete }
text metric 2.0.16 * { delete }
text metric 3.8.* oneline { delete }
text metric 3.9.* help { delete }
text metric 3.11.* * { delete }
text metric 11.*.* oneline { delete }
text metric 60.*.* help { delete }
text metric 62.*.* * { delete }
# delete indom text records
text indom 2.1 oneline { delete }
text indom 2.3 help { delete }
text indom 2.4 * { delete }
text indom 60.* oneline { delete }
text indom 62.* help { delete }
text indom 129.* * { delete }
# replace metric text records
text metric pmcd.numagents help { text -> "rewritten" }
text metric 2.0.3 oneline { text -> "rewritten" }
text metric 2.0.20 * { text -> "rewritten" }
text metric 3.8.* help { text -> "rewritten" }
text metric 3.9.* oneline { text -> "rewritten" }
text metric 2.5.* * { text -> "rewritten" }
text metric 11.*.* help { text -> "rewritten" }
text metric 60.*.* oneline { text -> "rewritten" }
text metric 70.*.* * { text -> "rewritten" }
# replace indom text records
text indom 2.1 help { text -> "rewritten" }
text indom 2.3 oneline { text -> "rewritten" }
text indom 3.9 * { text -> "rewritten" }
text indom 60.* help { text -> "rewritten" }
text indom 62.* oneline { text -> "rewritten
multiple
lines" }
# change metric association
text metric 2.3.1 oneline { metric -> 2.0.16 } # previous text deleted
text metric 2.4.1 help { metric -> 2.0.16 } # previous text deleted
text metric 2.5.0 * { metric -> 3.11.1 } # previous text deleted
# change indom association
text indom 2.1 help { indom -> 2.3 } # previous text deleted
text indom 2.3 oneline { indom -> 2.1 } # previous text deleted
text indom 3.9 * { indom -> 60.6 } # no previous text
EOF
# Run pmlogrewrite(1)
rm -f $tmp.rewritten*
pmlogrewrite -vvvv -c $tmp.config archives/20180415.09.16 $tmp.rewritten 2>&1 | _filter | tee $seq_full
# Now dump the rewritten archive
pmdumplog -h $tmp.rewritten 2>&1 | tee -a $seq_full
# A few more tests
cat > $tmp.config <<EOF
text metric 2.0.3 * "Number of clients currently connected to PMCD" { delete }
text InDom 2.3 * "PMDA Instance Domain" { delete }
text metric 2.0.16 *
"A space-separated string representing all running PCP services with PID
files in \$PCP_RUN_DIR (such as pmcd itself, pmproxy and a few others)."
{ delete }
text metric 2.0.20 *
"Minor part of the PCP build version numbering. For example on Linux
with RPM packaging, if the PCP RPM version is pcp-2.5.99-20070323 then
pmcd.build returns the string \"20070323\"."{ delete }
EOF
# Run pmlogrewrite(1)
rm -f $tmp.rewritten*
pmlogrewrite -vvvv -c $tmp.config archives/20180415.09.16 $tmp.rewritten 2>&1 | _filter | tee $seq_full
# Now dump the rewritten archive
pmdumplog -h $tmp.rewritten 2>&1 | tee -a $seq_full
# success, all done
status=0
exit
|