blob: 5b3f186a9560967e9f9664ae19bf943353fe8dc3 (
plain)
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
|
#! /bin/sh
# PCP QA Test No. 652
# checks basic pmdasystemd functionality
#
# Copyright (c) 2012 Red Hat, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
. ./localconfig
if which journalctl >/dev/null 2>&1
then
echo Found journalctl
else
_notrun no journalctl
fi
journal_version=`journalctl --version | grep ^systemd | awk '{print $2}'`
if [ "$journal_version" -ge 193 ]; then
echo Found recent enough journalctl
else
_notrun journalctl too old "$journal_version"
fi
[ $PCP_VER -ge 3805 ] || _notrun "Installed pmdasystemd is too old"
_cleanup()
{
_restore_pmda_install $iam
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
exit $status
}
_filter()
{
sed \
-e "s,$tmp,TMPFILE,g" \
-e "s,$PCP_VAR_DIR,PCP_VAR_DIR,g" \
-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
}
_filter_probe()
{
sed \
-e 's/^\(systemd.journal.count 1\) [0-9][0-9]*/\1 COUNT/g' \
-e 's/^\(systemd.journal.bytes 1\) [0-9][0-9]*/\1 BYTES/g'
}
_filter_events()
{
fgrep 'MESSAGE=yo'
}
_filter_events_raw()
{
fgrep '4d4553534147453d796f'
}
iam=systemd
status=1 # failure is the default!
trap "_cleanup" 0 1 2 3 15
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.* $seq.full
# real QA test starts here
_prepare_pmda_install $iam
# install PMDA accepting the defaults (esp config file)
$sudo ./Remove < /dev/null >/dev/null 2>&1
$sudo ./Install < /dev/null >$tmp.out 2>&1
cat $tmp.out | _filter_pmda_install | _filter
echo
echo "=== 1. scalar metrics ===" | tee -a $here/$seq.full
pmprobe -v systemd | tee -a $here/$seq.full | _filter_probe
echo | tee -a $here/$seq.full
echo "=== 2. journald.records ===" | tee -a $here/$seq.full
(sleep 3; logger yo) &
pmevent -T 10 systemd.journal.records | tee -a $here/$seq.full | _filter_events
echo | tee -a $here/$seq.full
echo "=== 3. journald.records ===" | tee -a $here/$seq.full
(sleep 3; logger yo) &
pmevent -T 10 systemd.journal.records_raw | tee -a $here/$seq.full | _filter_events_raw
# remove PMDA to ensure proper cleanup (in case it wasnt already installed beforehand)
$sudo ./Remove < /dev/null >/dev/null 2>&1
status=0
exit
|