This file is indexed.

/var/lib/pcp/testsuite/370 is in pcp-testsuite 4.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#!/bin/sh
# PCP QA Test No. 370
#
# exercise sar2pcp
#
# Copyright (c) 2012 Red Hat.
# Copyright (c) 2010 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

which sar >/dev/null 2>&1 || _notrun "sar not installed"
which sadf >/dev/null 2>&1 || _notrun "sadf not installed"
which sar2pcp >/dev/null 2>&1 || _notrun "sar2pcp not installed"

platform=`uname -m`
[ $platform = "x86_64" ] || _notrun "No qualified input data for $platform platform"

version=`sar -V 2>&1 | sed -n -e '/sysstat version /{
s/.* //
p
}'`

_fuzzy()
{
    case "$version"
    in
	11.1.5)
	    sed \
		-e '/kernel.all.cpu.sys/s/0.001[78]/0.0017 or 0.0018/' \
		-e '/diskdev8-2/s/0.3[78]/0.37 or 0.38/' \
	    # end
	    ;;
	*)	# no fuzziness required
	    cat
	    ;;
    esac
}

rm -f $seq.out
file_version=$version
case "$version"
in
    9.0.4*)	# RHEL6
	eval `pmprobe -v kernel.uname.distro | sed -e 's/.*distro 1 /distro=/g'`
	case "$distro"
	in
	    Red*Hat*6.*|CentOS*6.*)
		# special case for systat in RHEL >=6.5 (see --legacy
		# note in sar(1) on these systems for the way the sar
		# data format and versioning was broken).
		#
		minor=`echo $distro | sed -e 's/.*release 6.//g' -e 's/ .*//g'`
		if [ $minor -ge 5 ]; then
		    ln $seq.out.8 $seq.out || exit 1
		    file_version=9.0.4_rh6.5
		else
		    ln $seq.out.4 $seq.out || exit 1
		    file_version=9.0.4
		fi
		;;
	    *)
		ln $seq.out.4 $seq.out || exit 1
		file_version=9.0.4
		;;
	esac
	;;
    9.0.6.1)
	ln $seq.out.5 $seq.out || exit 1
	;;
    9.0.6*)
	ln $seq.out.1 $seq.out || exit 1
	file_version=9.0.6
	;;
    9.1.7*)
	ln $seq.out.2 $seq.out || exit 1
	file_version=9.1.7
	;;
    10.0.1*)
	ln $seq.out.3 $seq.out || exit 1
	file_version=10.0.1
	;;
    10.0.5*)
	ln $seq.out.6 $seq.out || exit 1
	file_version=10.0.5
	;;
    10.1.5)
	ln $seq.out.12 $seq.out || exit 1
	;;
    10.1.6)
	ln $seq.out.11 $seq.out || exit 1
	;;
    10.2.0|10.2.1)
	ln $seq.out.7 $seq.out || exit 1
	file_version=10.2.0
	;;
    11.0.0|11.0.1)
	ln $seq.out.9 $seq.out || exit 1
	file_version=11.0.1
	;;
    11.1.5)
	ln $seq.out.10 $seq.out || exit 1
	;;
    11.2.0)
	ln $seq.out.13 $seq.out || exit 1
	;;
    *)
	_notrun "no qualified output for sysstat version $version"
	;;
esac
[ -f sadist/sa-sysstat-$file_version ] || \
    _notrun "no data file (sa-sysstat-$file_version) for sysstat version $version"

status=0	# success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here

# For this test, don't load any global derived metric configs by default. 
# So the PCP_DERIVED_CONFIG environment variable is initially set to an
# empty string, except below where PCP_DERIVED_CONFIG is used for sar's -u view
export PCP_DERIVED_CONFIG=""

echo "Using sa-sysstat-$file_version" >>$seq.full

sar2pcp sadist/sa-sysstat-$file_version $tmp

# version 9.x output
# 11:07:39        CPU     %user     %nice   %system   %iowait    %steal     %idle
# 11:07:44        all      3.20      0.10      1.60      0.00      0.00     95.10
#
# version 10.x output
# 04:50:52 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
# 04:50:57 PM     all      0.31      0.00      0.31      0.00      0.00     99.38
#
sar $sar_opt -f sadist/sa-sysstat-$file_version -u \
| tee -a $seq.full \
| sed -n '/^[0-2][0-9]:/{
s/^01\(:..:..\) PM/13\1/
s/^02\(:..:..\) PM/14\1/
s/^03\(:..:..\) PM/15\1/
s/^04\(:..:..\) PM/16\1/
s/^05\(:..:..\) PM/17\1/
s/^06\(:..:..\) PM/18\1/
s/^07\(:..:..\) PM/19\1/
s/^08\(:..:..\) PM/20\1/
s/^09\(:..:..\) PM/21\1/
s/^10\(:..:..\) PM/22\1/
s/^11\(:..:..\) PM/23\1/
s/^12\(:..:..\) AM/00\1/
s/^\(..:..:..\) AM/\1/
p
}' \
| $PCP_AWK_PROG >$tmp.sar '
NR == 1		{ next }
		# percent to utilization
		{ for (i = 2; i <= NF; i++) { $i = $i / 100 }
		  print
		}'

echo "check user CPU time ..."
# note sar's -u view of user is really usr+guest
# ... saved by derived metrics!
# also need to relax tolerance in comparison, 'cause sar seems to get
# the arithmetic "not quite right" (tm)
echo "user = kernel.all.cpu.user + kernel.all.cpu.guest" >$tmp.config
export PCP_DERIVED_CONFIG=$tmp.config
pmval -f 8 -t 5 -a $tmp user \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9]*[0-9]//
p
}' >$tmp.pcp
( echo ""; echo "user = kernel.all.cpu.user + kernel.all.cpu.guest" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($3-$NF > 0.001 || $3-$NF < -0.001) print "[",NR,"] mismatch:",$1,$3,$NF }'

echo
echo "check timestamps ..."
$PCP_AWK_PROG <$tmp.both '
$1 != $9	{ print "[",NR,"] mismatch:",$0 }'

echo
echo "check sys CPU time ..."
# note sar's -u view of system is really sys+intr
# ... saved by derived metrics!
# also need to relax tolerance in comparison, 'cause sar seems to get
# the arithmetic "not quite right" (tm)
echo "system = kernel.all.cpu.sys + kernel.all.cpu.intr" >$tmp.config
export PCP_DERIVED_CONFIG=$tmp.config
pmval -f 8 -t 5 -a $tmp system \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "system = kernel.all.cpu.sys + kernel.all.cpu.intr" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($5-$NF > 0.001 || $5-$NF < -0.001) print "[",NR,"] mismatch:",$1,$5,$NF }'

echo >>$seq.full
# version 9.x output
# 11:07:39          tps      rtps      wtps   bread/s   bwrtn/s
# 11:07:44         0.00      0.00      0.00      0.00      0.00
#
# version 10.x output
# 04:50:52 PM       tps      rtps      wtps   bread/s   bwrtn/s
# 04:50:57 PM      0.80      0.00      0.80      0.00      6.40
#
sar -f sadist/sa-sysstat-$file_version -b \
| tee -a $seq.full \
| sed -n '/^[0-2][0-9]:/{
s/^00\(:..:..\) PM/12\1/
s/^01\(:..:..\) PM/13\1/
s/^02\(:..:..\) PM/14\1/
s/^03\(:..:..\) PM/15\1/
s/^04\(:..:..\) PM/16\1/
s/^05\(:..:..\) PM/17\1/
s/^06\(:..:..\) PM/18\1/
s/^07\(:..:..\) PM/19\1/
s/^08\(:..:..\) PM/20\1/
s/^09\(:..:..\) PM/21\1/
s/^10\(:..:..\) PM/22\1/
s/^11\(:..:..\) PM/23\1/
s/^\(..:..:..\) AM/\1/
p
}' \
| $PCP_AWK_PROG >$tmp.sar '
NR == 1		{ next }
		# blocks to Kbytes
		{ for (i = 5; i <= NF; i++) { $i = $i /2 }
		  print
		}'

echo
echo "check disk iops ..."
# units are iops, so within 0.01 iop is ok
pmval -f 8 -t 5 -a $tmp disk.all.total \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "disk.all.total" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($2-$NF > 0.02 || $2-$NF < -0.02) print "[",NR,"] mismatch:",$1,$2,$NF }'

echo
echo "check disk write thruput ..."
# units are iops, so within 0.01 iop is ok
pmval -f 8 -w 16 -t 5 -a $tmp disk.all.write_bytes \
| sed -n '/^[0-2][0-9]:/{
s/\.[0-9][0-9][0-9]//
p
}' >$tmp.pcp
( echo ""; echo "disk.all.write_bytes" ) >>$seq.full
cat $tmp.pcp >>$seq.full
paste $tmp.sar $tmp.pcp >$tmp.both
$PCP_AWK_PROG <$tmp.both '
{ if ($6-$NF > 0.02 || $6-$NF < -0.02) print "[",NR,"] mismatch:",$1,$6,$NF }'

echo
echo "full dump ..."
# note proc.nprocs -> proc.nproc mapping needed after sar2pcp changes in
# commit 48e373f0609a0a0804bc052d5e9dec41a5a2928e so output matches 370's
# "out" files
#
pmdumplog -lm -z $tmp 2>&1 \
| sed \
	-e 's/245\.0\.[0-9][0-9]*/245.0.NN/g' \
	-e 's/(proc.nprocs)/(proc.nproc)/' \
| _fuzzy

# success, all done
exit