File: 519

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (171 lines) | stat: -rwxr-xr-x 4,253 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
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
#! /bin/sh
# PCP QA Test No. 519
# exercise new action args (no limit of 2) for pmie ... caused
# pmie to dump core initially
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#
#
# Solaris Note (OpenIndiana specifically)
#
# Need to edit /etc/syslog.conf and add these lines
# # for PCP QA
# daemon.info                     /var/log/syslog
#
# then kill -HUP <pid-for-syslogd>
#

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

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

rm -f $seq.out
case $PCP_PLATFORM
in
    linux)
	ln $seq.$PCP_PLATFORM $seq.out || exit 1
	SYSLOG_OPT='"-p daemon.info"'
	;;
    darwin)
	ln $seq.linux $seq.out || exit 1
	SYSLOG_OPT=''
	;;
    solaris)
	ln $seq.linux $seq.out || exit 1
	SYSLOG_OPT='"-p daemon.info"'
	;;
    *)
	_notrun "Need qualified output for $PCP_PLATFORM"
	;;
esac

_filter()
{
    # other syslog timestamp variants ...
    # 2014-09-15T10:44:40.269104+10:00
    sed \
	-e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/TIMESTAMP/' \
	-e 's/[A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/TIMESTAMP/' \
	-e 's/20[0-9][0-9]-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9]*/TIMESTAMP/' \
	-e 's/STAMP[-+][0-1][0-9]:[0-5][0-9]/STAMP/' \
	-e "s/`hostname`/HOST/" \
	-e "s/`hostname | sed -e 's/\..*//'`/HOST/" \
	-e 's/[0-9][A-Z]:HOST/HOST/' \
	-e 's/\(pmie[([]\)[0-9][0-9]*/\1PID/' \
	-e 's/ \[ID [0-9][0-9]* daemon.info]//'
}

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

PMCD_CONNECT_TIMEOUT=60
PMCD_REQUEST_TIMEOUT=60
export PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT

eval `./getpmcdhosts -n 2 -L | sed -e 's/ / other2=/' -e 's/^/other1=/'`
if [ -z "$other1" ]
then
    _notrun "Cannot find first remote host running pmcd"
fi
if [ -z "$other2" ]
then
    _notrun "Cannot find second remote host running pmcd"
    exit
fi
echo "other1=$other1" >>$seq_full
echo "other2=$other2" >>$seq_full

# real QA test starts here
$sudo rm -f core* $seq.core*

cat <<End-of-File | pmie -T 10sec >$tmp.out 2>$tmp.err
// use hosts not in QA circus
//

hosts = ":'$other1' :'$other2'";

some_host (
  some_inst (
    ( 100 * filesys.used \$hosts / filesys.capacity \$hosts ) > 0 ) )
-> shell 15 "src/show-args -c SYSMON -t PERF_INFO_SYSTEM -m 'file system over half-full" "\n%h:[%i] %v% " "'"
 & syslog 15 $SYSLOG_OPT "PCP QA $seq - please ignore - ..." " %h:[%i] %v% ";

End-of-File

# hostnames $other1 and $other2 may contain domain name components,
# but pmie may just report the hostname
#
o1=`echo $other1 | sed -e 's/\..*//'`
o2=`echo $other2 | sed -e 's/\..*//'`
echo "pmie output ..."
sed <$tmp.out \
    -e "/^$other1:/d" \
    -e "/^$o1:/d" \
    -e "/^$other2:/d" \
    -e "/^$o2:/d" \
#
grep -E "^($other1|$o1):" <$tmp.out >/dev/null && echo "... at least one line for other1 host"
grep -E "^($other2|$o2)*:" <$tmp.out >/dev/null && echo "... at least one line for other2 host"

echo
echo "pmie stderr ..."
_filter <$tmp.err

# may be using journalctl, and so no syslog in the file system
#
if [ "$PCPQA_SYSTEMD" = yes ] && `which journalctl >/dev/null 2>&1`
then
    echo "Using journalctl ..." >>$seq_full
    have_journalctl=true
else
    have_journalctl=false
    SYSLOG=''
    for f in /var/adm/SYSLOG /var/log/daemon.log /var/log/messages \
	     /var/log/syslog /var/log/syslog.1 /var/log/system.log
    do
	if [ -f $f -a -s $f ]
	then
	    SYSLOG=$f
	    break
	fi
    done
    if [ -z "$SYSLOG" ]
    then
	echo "Arrgh! Cannot find your syslog file"
	exit 1
    fi
fi

echo
echo "SYSLOG ..."

if $have_journalctl
then
    # be careful ... --boot not supported in all versions, -l not
    # supported in all versions
    $sudo journalctl -b --full | tail -200 >$tmp.syslog 2>>$seq_full
else
    $sudo tail -200 $SYSLOG >$tmp.syslog
fi

sed <$tmp.syslog -n '/PCP QA '"$seq"' - please ignore/s/\.\.\..*/.../p' \
| _filter \
| sort -u

echo >>$seq_full
if $have_journalctl
then
    echo "=== tail journalctl -b --full ===" >>$seq_full
else
    echo "=== tail SYSLOG ($SYSLOG) ===" >>$seq_full
fi
echo "`wc -l <$tmp.syslog | sed -e 's/ //g'` lines ... expect 200" >>$seq_full
cat $tmp.syslog >>$seq_full

_check_core

exit