pmrep: fix archive end time reporting
[pcp.git] / qa / 717
blobab0a6d6d7cf769c95a5f8260ce03210047eb2f45
1 #! /bin/sh
2 # PCP QA Test No. 717
3 # Basic checkout of the Python pmdasimple implementation.
5 # Copyright (c) 2013 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.python
13 [ -d $PCP_PMDAS_DIR/simple ] || _notrun "simple PMDA directory is not installed"
14 $python -c "from pcp import pmda" >/dev/null 2>&1
15 [ $? -eq 0 ] || _notrun "python pcp pmda module not installed"
16 test -f "$PCP_PMDAS_DIR/simple/pmdasimple.python"
17 [ $? -eq 0 ] || _notrun "python simple pmda not yet installed"
19 status=1
20 done_clean=false
21 rm -f $seq.full
23 _cleanup()
25 if $done_clean
26 then
28 else
29 _restore_config $PCP_PMCDCONF_PATH
30 rm -f $tmp.*
31 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
32 _wait_for_pmcd
33 _wait_for_pmlogger
34 done_clean=true
36 exit $status
39 trap "_cleanup" 0 1 2 3 15
41 # real QA test starts here
42 iam=simple
43 cd $PCP_PMDAS_DIR/$iam
45 # copy the pmcd config file to restore state later.
46 _save_config $PCP_PMCDCONF_PATH
48 # start from a known starting point
49 $sudo ./Remove >/dev/null 2>&1
51 echo
52 echo "=== $iam agent installation ==="
53 cat << End-of-File | $sudo ./Install >$tmp.out 2>&1
54 both
55 python
56 End-of-File
57 # Check simple metrics have appeared ... X metrics and Y values
58 _filter_pmda_install <$tmp.out \
59 | sed \
60 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/'
62 check()
64 iter=$1
65 name=$2
67 echo "fetch pmprobe #$iter - $name" | tee -a $here/$seq.full
68 pmprobe -v $iam > $tmp.pmprobe
69 cat $tmp.pmprobe >>$here/$seq.full
71 echo "check pmprobe #$iter - $name" | tee -a $here/$seq.full
72 cat $tmp.pmprobe \
73 | while read metric nv v1
75 if [ "$metric" = "simple.numfetch" ]
76 then
77 echo "$metric shows $nv value(s), $v1 fetches so far"
78 else
79 echo "$metric shows $nv value(s)"
81 done
84 echo
85 echo "=== fetch and check values ==="
86 echo sec,min,hour > $tmp.conf && $sudo mv $tmp.conf simple.conf
87 check 1 defaults
88 echo sec,min > $tmp.conf && $sudo mv $tmp.conf simple.conf
89 check 2 twotimes
90 echo hour > $tmp.conf && $sudo mv $tmp.conf simple.conf
91 check 3 onetime
92 echo > $tmp.conf && $sudo mv $tmp.conf simple.conf
93 check 4 notime
95 # reset the clock back to the start state
96 echo sec,min,hour > $tmp.conf && $sudo mv $tmp.conf simple.conf
98 echo "=== remove $iam agent ==="
99 $sudo ./Remove >$tmp.out 2>&1
100 _filter_pmda_remove <$tmp.out
102 status=0
103 exit