4 # Derived metrics - exercise pmDesc processing during bind
6 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
17 if grep -q 'pmRegisterDerived' $PCP_INC_DIR/pmapi.h
21 echo "No derived metric support" >$seq.notrun
22 echo "$seq: [not run] `cat $seq.notrun`"
26 unset PCP_DERIVED_CONFIG
28 status
=0 # success is the default!
29 $sudo rm -rf $tmp.
* $seq.full
30 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34 cat $tmp.out
>>$seq.full
39 # real QA test starts here
41 pminfo
-d sample.pdu sample.recv_pdu sample.xmit_pdu sample.byte_ctr sample.kbyte_ctr sample.long.hundred sample.bin
44 echo "No semantic errors here ..."
45 cat <<End-of-File >$tmp.config
46 myname.a = sample.kbyte_ctr
47 myname.b = sample.recv_pdu + sample.xmit_pdu
49 myname.d = 123 + sample.long.hundred
50 myname.e = sample.pdu / sample.long.hundred
51 myname.f = 1024 * sample.byte_ctr
52 myname.g = sample.bin + 100 - sample.bin - 100
53 myname.h = sample.seconds + sample.milliseconds / 1000
56 pminfo
-Dderive -d -c $tmp.config myname
>$tmp.out
2>&1
60 echo "Semantic errors ..."
61 cat <<End-of-File >$tmp.config
63 myname.a = no.such.metric
65 myname.b = sample.bad.unknown
66 # bad semantics - counters and *
67 myname.c = disk.dev.read * disk.dev.write
68 # bad semantics - counter and non-counter
69 myname.d = sample.byte_ctr + sample.long.hundred
70 # bad semantics - non-counter and counter
71 myname.e = sample.long.hundred - 100 / sample.byte_ctr
72 # bad semantics - non-counters ... not possible at the moment
73 # bad semantics - non-arithmetic metrics
74 myname.f = 3 + sample.lights
75 myname.g = sample.sysinfo - 42
76 # pmUnits checks and metric semantic checks
77 myname.h = disk.dev.total + sample.long.hundred
78 myname.i = sample.long.hundred - disk.dev.total
79 myname.j = sample.mirage * sample.step_counter
80 myname.k = sample.step_counter / sample.mirage_longlong
82 myname.l = sample.bin + sample.darkness
83 # from here on down, test cases driven by gcov analysis ...
84 myname.gcov.a = 42 + sample.bad.unknown
85 myname.gcov.b = (disk.all.total + disk.dev.total) + 42
86 myname.gcov.c = 42 - (disk.all.total + disk.dev.total)
87 myname.gcov.d = (sample.bin + sample.darkness)+42
90 #debug# pminfo -D derive,appl0,appl1 -d -c $tmp.config myname >$tmp.out 2>&1
91 pminfo
-D derive
-d -c $tmp.config myname
>$tmp.out
2>&1