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
|
#!/bin/sh
# PCP QA Test No. 722
# Exercise the python pmatop implementation
#
# Copyright (c) 2013-2014 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=0 # success is the default!
$sudo rm -f $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
remove_extra_whitespace()
{
sed \
-e 's/>>>.*<<<//g' \
-e 's/[0-9]/9/g' \
-e 's/9[9\.e]*/9/g' \
-e 's/ *$//' \
-e '/^ *$/d' \
-e 's/ */ /g' \
-e 's/^ *//' \
-e 's/RECORD.*$/RECORD/' \
}
redact_lines()
{
$PCP_AWK_PROG -v f=$1 '
BEGIN {first_cpu=1;first_dsk=1;first_lvm=1;proc_printed=0}
/^9/ {if (! proc_printed) {
gsub("[SR]","x",$10)
gsub("[a-zA-Z_][a-zA-Z_]+","userid",$6)
gsub("[a-zA-Z_][a-zA-Z_]+","process",$9)
gsub("[a-zA-Z_][a-zA-Z_]+","process",$12)
if ($2 != "9K") $2="HHMMSS"
if ($3 != "9K") $3="HHMMSS"
proc_printed = 1
print $0}
next}
/cpu/ {if (first_cpu) {print $0; first_cpu=0}; next}
/PRC/ {$4 = "HHMMSS";$7 = "HHMMSS"}
/DSK/ {if (first_dsk) {$3 = "DISKNAME"; print $0; first_dsk=0}; next}
/LVM/ {if (first_lvm) {gsub("[a-zA-Z0-9_-]*","x",$3);print $0; first_lvm=0;}; next}
/NET/ {if ($3 == "transport" || $3 == "network") {print $0}; next}
/ATOP/ {gsub("[A-Za-z]*","Day",$3);gsub("[A-Za-z]*","Month",$4)}
{print $0}'
}
redact_header()
{
$PCP_AWK_PROG -v f=$1 '
/ATOP/ {gsub("[A-Za-z]*","Day",$3);gsub("[A-Za-z]*","Month",$4)}
/LVM/ {gsub("[a-zA-Z0-9_-]*","x",$3);print $0; next}
{print $0}'
}
PMATOP=pmatop.py # local version, wont be there on installed system
which $PMATOP >/dev/null 2>&1
if [ $? -ne 0 ]; then
PMATOP=pmatop
which $PMATOP >/dev/null 2>&1 || _notrun "pmatop not installed"
fi
# real QA test starts here
$PMATOP -r $here/src/pmatop-log.folio -m 1 1 | redact_header | remove_extra_whitespace | tee -a $tmp.out 2>&1
$PMATOP -r $here/src/pmatop-log.folio -g 1 1 | redact_header | remove_extra_whitespace | tee -a $tmp.out 2>&1
$PMATOP -w test.pmatop 0.2 10
if pmafm test.pmatop check | grep -q OK
then echo pmatop log creation OK | tee -a $tmp.out 2>&1
else echo pmatop log creation FAILED | tee -a $tmp.out 2>&1; fi
cat $tmp.out >>$here/$seq.full
# success, all done
eval `pmafm test.pmatop remove`
status=0
exit
|