File: 992

package info (click to toggle)
pcp 7.0.5-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,916 kB
  • sloc: ansic: 1,478,844; sh: 177,285; xml: 160,462; cpp: 83,809; python: 24,349; perl: 18,303; yacc: 6,877; lex: 2,864; makefile: 2,694; awk: 165; fortran: 60; java: 52
file content (104 lines) | stat: -rwxr-xr-x 2,427 bytes parent folder | download
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
#!/bin/sh
# PCP QA Test No. 992
# test pmlogger with pmcpp integration
#
# Copyright (c) 2015 Ken McDonell.  All Rights Reserved.
#
# check-group-include: pmcpp

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

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

status=1	# failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

# handle these ...
# /tmp/853-3145.*
# Dump optfetch structures from 0x7f56fa4bec30 next=0x7f56fa4bf3f0
# ...
# <empty line>
# 60.0.20 (kernel.all.cpu.user):
# 60.0.33 (hinv.ndisk):
# 60.0.25 (disk.all.write):
#
_filter()
{
    sed \
	-e "s@$tmp@TMP@g" \
	-e "s@$PCP_BINADM_DIR@PCP_BINADM_DIR@g" \
	-e "s@$PCP_VAR_DIR@PCP_VAR_DIR@g" \
	-e '/(kernel\./s/[0-9][0-9.]*/PMID/' \
	-e '/(hinv\./s/[0-9][0-9.]*/PMID/' \
	-e '/(disk\./s/[0-9][0-9.]*/PMID/' \
	-e '/possible dynamic root/d' \
    | _filter_pmlogger_log \
    | $PCP_AWK_PROG '
BEGIN				{ skip = 0 }
/^Dump optfetch structures/	{ print "Dump optfetch structures ..."
				  skip = 1
				  next
				}
skip == 1 && NF == 0		{ skip = 0 }
skip == 0			{ print }'
}

cat <<End-of-File >$tmp.config
# based on pmlogger(1) man page
log mandatory on once { hinv.ndisk }
log mandatory on every 10 minutes {
    kernel.all.cpu.user		# singular
    sample.lights		# indom
    sample.long			# non-terminal
    sample.bin [ "bin-100" "bin-300" "bin-500" "bin-700" ]	# instances
}

log mandatory on every 15 secs {
    network.interface.out.packets [ "no-such-interface" ]	# bad instance
}
log mandatory on every 15 secs {
    foo.bar				# bad metric
}
log mandatory on every 15 secs {
    sample.string.write_me [ "?" ]	# no instance for singular
}

%include "$tmp.macros.default"

%ifdef disk_all
log mandatory on %disk_all_freq {
    %disk_all.write
}
log mandatory on %disk_all_freq {
    %disk_all.read [ "nodisk" ]
}
%endif
End-of-File

# real QA test starts here
cat <<End-of-File >$tmp.macros.default
%undef disk_all
End-of-File
pmlogger -Dlog -C -c $tmp.config 2>&1 | _filter

echo
echo "=== now with disk_all defined ==="
cat <<End-of-File >$tmp.macros.default
%define disk_all disk.all
%define disk_all_freq 20sec
End-of-File
pmlogger -Dlog -C -c $tmp.config >$tmp.out 2>$tmp.err
echo "--- stdout ---" >>$seq_full
cat $tmp.out >>$seq_full
echo "--- stderr ---" >>$seq_full
cat $tmp.err >>$seq_full
cat $tmp.out $tmp.err | _filter

# success, all done
status=0

exit