File: 375

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 (157 lines) | stat: -rwxr-xr-x 3,824 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
#! /bin/sh
# PCP QA Test No. 374
# pmlogger (PCP 2.0) and pmlc (assorted) version compatibility
#
# PCP_ARCHIVE_VERSION V2 variant, see 1414 for the V3 variant.
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

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

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

PMCD_CONNECT_TIMEOUT=30
PMCD_REQUEST_TIMEOUT=30
export PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT

rm -f $seq.out
case $PCP_PLATFORM
in
    linux|darwin|solaris|openbsd)
	ln $seq.$PCP_PLATFORM $seq.out || exit 1
	;;
    *)
	_notrun "Need qualified output for $PCP_PLATFORM"
	;;
esac

_filter()
{
    _filter_pmdumplog \
    | sed \
	-e '/^pmlogger .* on host .* is logging metrics from host .*/d' \
	-e '/^PMCD host/d' \
	-e '/^log started/d' \
    | $PCP_AWK_PROG '
$1 == "log" && $2 == "size"	{ if ($3 > 100 && $3 <= 200) $3 = "more than 100"
				  else if ($3 > 200 && $3 <= 400) $3 = "more than 200"
				}
				{ print }'
}

_speak_to_me()
{
    host=$1
    $sudo rm -f /tmp/$$.*
    # if remote hosts are running older versions with bad autonegotiate
    # version logic in libpcp, then pmlc there will only be able to connect
    # to pmlogger here if we force pmlogger to offer LOG_PDU_VERSION2
    #
    _start_up_pmlogger -V2 --pmlc-ipc-version=2 -L -c $tmp.config -l /tmp/$$.log /tmp/$$ </dev/null >/dev/null 2>&1
    _wait_for_pmlogger $pid /tmp/$$.log || _exit 1

    # the success cases
    #
    cat <<End-of-File | ssh -q pcpqa@$host "sh -c 'PMCD_CONNECT_TIMEOUT=$PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT=$PMCD_REQUEST_TIMEOUT pmlc'" >$tmp.out 2>$tmp.err
connect $pid@$me
status
new volume
status
flush
# singular, all instances
query { pmcd.simabi pmcd.control.register }
# some instances
query pmcd.agent.type [ "$PCP_PLATFORM" "pmcd" "sample"]
# non-leaf
query pmcd.pdu_in
# logging
log mandatory on once pmcd.agent.type ["$PCP_PLATFORM" "pmcd"]
log mandatory off pmcd.agent.type ["sample"]
End-of-File
    # do ssh again is probably long enough for "once" metrics above
    # to have been logged
    #
    cat <<End-of-File | ssh -q pcpqa@$host "sh -c 'PMCD_CONNECT_TIMEOUT=$PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT=$PMCD_REQUEST_TIMEOUT pmlc'" >>$tmp.out 2>>$tmp.err
connect $pid@$me
query pmcd.agent.type ["$PCP_PLATFORM" "pmcd" "sample"]
End-of-File
    cat $tmp.err $tmp.out | _filter

    # the failures
    #
    echo "connect $pid@$me" | ssh -q pcpqa@$host "sh -c 'PMCD_CONNECT_TIMEOUT=$PMCD_CONNECT_TIMEOUT PMCD_REQUEST_TIMEOUT=$PMCD_REQUEST_TIMEOUT pmlc'" >$tmp.out 2>$tmp.err
    cat $tmp.err $tmp.out | _filter

    # cleanup
    #
    if [ ! -z "$host" ]
    then
	$sudo $signal -s TERM $pid
	pid=''
    fi

}

_cleanup()
{
    if $need_clean
    then
	if [ ! -z "$pid" ]
	then
	    $sudo $signal -s TERM $pid
	    sleep 1
	    $sudo $signal -s KILL $pid
	    pid=''
	fi
	need_clean=false
    fi
    $sudo rm -f $tmp.* /tmp/$$.*
    exit
}

need_clean=true
signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

if [ -x $PCP_BINADM_DIR/pmhostname ]
then
    me=`pmhostname`
else
    host=`hostname`
    me=`_host_to_fqdn $host`
fi
pid=''

cat >$tmp.config <<End-of-File
# with delayed preamble, need to force *something* into the archive
log mandatory on once sample.long.ten
End-of-File

# real QA test starts here

# Require at least PCP 5.3.4 on the remote hosts, so that pmlc there
# can connect to the local pmlogger.
#
for type in "-b 32 -v pcp>=5.3.4" "-b 64 -v pcp>=5.3.4"
do
    echo
    echo "=== pmlc host type: $type ==="
    host=`./getpmcdhosts -L -n 1 $type`
    if [ -z "$host" ]
    then
	_notrun "Cannot find a 64-bit host running PCP"
    else
	echo "$host for type=$type" >>$seq_full
	_speak_to_me $host
    fi
done

# success, all done
status=0
exit