File: 507

package info (click to toggle)
pcp 3.9.10
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 81,836 kB
  • ctags: 26,423
  • sloc: ansic: 178,791; sh: 79,349; cpp: 61,042; xml: 28,842; perl: 12,963; yacc: 5,351; python: 4,578; lex: 1,894; makefile: 1,665; fortran: 60; java: 22; awk: 20
file content (139 lines) | stat: -rwxr-xr-x 3,357 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
#! /bin/sh
# PCP QA Test No. 507
# exercises the pcp(1) works with an archive generates from
# our own pmlogger config file for it.  also checks bug #640234
#
# 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.check

qahost=`_get_fqdn`
if [ -z "$qahost" ]
then
    echo "$seq: Arrgh: cannot determine fully qualified domain name for local host"
    exit 1
fi

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

_filter()
{
    if [ $PCP_PLATFORM = darwin ]
    then
	# this is bizarre, but the amount of RAM is not constant
	# ... has been observed to randomly be 2046 or 2047 on
	# the one system ... scale up RAM to next 128MB boundary
	#
	sed -e 's/MB RAM/ RAM/' \
	| $PCP_AWK_PROG '
$NF == "RAM"	{ x = $(NF-1); x = ((int)(x/128)+1)*128; $(NF-1) = x }
		{ print }'
    else
	cat
    fi \
    | sed \
	-e "/^ licenses:.*/d" \
	-e "s/$qahost/HOST/g" \
	-e "s/$local/HOST/g" \
    | fgrep -v "archive:"
}

_config()
{
    cat <<End-of-File
log mandatory on once {
    hinv.ncpu
    hinv.ndisk
    hinv.nnode
    hinv.nrouter
    hinv.nxbow
    hinv.ncell
    hinv.physmem
    hinv.cputype
    pmda.uname
    pmcd.numagents
    pmcd.numclients
    pmcd.services
    pmcd.version
    pmcd.build
    pmcd.timezone
    pmcd.agent.status
    pmcd.pmlogger
    pmcd.pmie
}
End-of-File
}

# 
# check command args compatible:
# -h local must be same as no args & just local
# also, locally-generated archive must obviously be very similar also
# 
# real QA test starts here
_config > $tmp.config.pcp
pmlogger -T 3sec -c $tmp.config.pcp $tmp.archive
echo pmlogger status=$?

pcp -a $tmp.archive | _filter >$tmp.arch
echo status=$?

#  This loop deals with cases when pcp(1) reports that some condition has
#  changed between the three invokations of pcp(1).  If a difference has
#  been detected, do the test again to see if the difference is repeated.
itns=2
isdiff=TRUE
until [ $isdiff = FALSE -o $itns = 0 ]
do
    rm -f $tmp.noargs $tmp.local $tmp.localnoh \
      $tmp.diffnoargslocal $tmp.noargslocalnoh
    pcp | _filter > $tmp.noargs
    statusna=$?
    pcp -h $qahost | _filter > $tmp.local
    statusll=$?
    export PMCD_HOST=$qahost
    pcp | _filter > $tmp.localnoh
    statusln=$?
    unset PMCD_HOST
    
    diff $tmp.noargs $tmp.local > $tmp.diffnoargslocal
    diff $tmp.noargs $tmp.localnoh > $tmp.noargslocalnoh
    
    if [ -s $tmp.diffnoargslocal -o -s $tmp.noargslocalnoh ]
    then
        isdiff=TRUE
	if [ $itns -gt 1 ] ; then sleep 5 ; fi
    else
        isdiff=FALSE
    fi
    itns=`expr $itns - 1`
done
echo status=$statusna
echo status=$statusll
echo status=$statusln
echo === Comparing noargs and local
if [ -s $tmp.diffnoargslocal ] ; then cat $tmp.diffnoargslocal ; fi
echo === Comparing noargs and args
if [ -s $tmp.noargslocalnoh ] ; then cat $tmp.noargslocalnoh ; fi

echo === Checking for missing archive metrics
egrep '(Unknown)|( unknown)' $tmp.arch

echo === Checking bug 640234
echo 'pminfo(1) output:'
pminfo -fa src/pcpcmd pmcd.pmlogger
echo
echo 'pcp(1) output:'
pcp -n src/root_irix -a src/pcpcmd | fgrep -v "$PCP_PMDAS_DIR/summary"
# dont use services/pmie output here cos archive doesn't have all metrics

# success, all done
status=0
exit