3 # Exercise pmdapipe output capture.
5 # Copyright (c) 2015-2016 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
16 [ -f $PCP_PMDAS_DIR/pipe
/pmdapipe
] || _notrun
"pipe PMDA not installed"
17 id
-u nobody
>/dev
/null
2>&1 || _notrun
"User nobody unavailable"
19 PIPE_CONF_FILE
=$PCP_PMDAS_DIR/pipe
/pipe.conf
20 PIPE_CONF_DIR
=$PCP_SYSCONF_DIR/pipe.conf.d
21 PIPE_INDOM_CACHE
=$PCP_VAR_DIR/config
/pmda
/128.0
23 status
=1 # failure is the default!
26 $sudo rm -rf $tmp $tmp.
* $seq.full
30 [ -d $PIPE_CONF_DIR.
$seq ] && _restore_config
$PIPE_CONF_DIR
31 [ -f $PIPE_CONF_FILE.
$seq ] && _restore_config
$PIPE_CONF_FILE
32 [ -f $PIPE_INDOM_CACHE.
$seq ] && _restore_config
$PIPE_INDOM_CACHE
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 # move aside pipe configuration state to be restored later.
40 [ -d $PIPE_CONF_DIR ] && _save_config
$PIPE_CONF_DIR
41 [ -f $PIPE_CONF_FILE ] && _save_config
$PIPE_CONF_FILE
42 [ -f $PIPE_INDOM_CACHE ] && _save_config
$PIPE_INDOM_CACHE
44 cat <<EOF > $tmp.config
45 # instance user command
46 empty-line $username echo
47 echo-all $username echo \$0
48 echo-two $username echo \$1 \$2
49 ls-pipe root ls $PCP_PMDAS_DIR/pipe | LC_COLLATE=POSIX sort
52 cat << EOF1 > $tmp.confdir
55 disallow user $username : noop
61 -e "s/[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9]/HH:MM:SS.MSEC/g"\
62 -e "s/$hostname/HOST/g" \
66 # pmdapipe is installed with custom configuration, check it
70 echo "== basic empty line (ok) =="
71 pmval
-x '' -i empty-line
-t 0.25 -s 8 pipe.firehose | _filter_pmval
73 echo "== basic echo mirror (ok) =="
74 pmval
-x 'hello' -i echo-all
-t 0.25 -s 8 pipe.firehose | _filter_pmval
76 echo "== extra parameters (ok) =="
77 pmval
-x '1 two 3' -i echo-two
-t 0.25 -s 8 pipe.firehose | _filter_pmval
79 echo "== bad parameters (expect failure) =="
80 pmval
-x '1;2' -i echo-all
-t 0.25 -s 3 pipe.firehose | _filter_pmval
82 echo "== insufficient parameters (expect failure) =="
83 pmval
-x 'one' -i echo-two
-t 0.25 -s 3 pipe.firehose | _filter_pmval
85 echo "== disallowed access (expect failure) =="
86 pmval
-x '' -i noop
-s 3 pipe.firehose | _filter_pmval
92 echo "=== remove pipe agent ==="
93 $sudo .
/Remove
>$tmp.out
2>&1
94 _filter_pmda_remove
<$tmp.out
97 # install new (deterministic) configuration for pmcd/pmdapipe
101 # start from known starting points
102 cd $PCP_PMDAS_DIR/pipe
103 $sudo .
/Remove
>/dev
/null
2>&1
104 $sudo $PCP_RC_DIR/pmcd stop
2>&1 | _filter_pcp_stop
106 $sudo rm -rf "$PIPE_CONF_DIR" "$PIPE_CONF_FILE" "$PIPE_INDOM_CACHE"
107 $sudo mkdir
-m 755 "$PIPE_CONF_DIR"
109 $sudo mv $tmp.confdir
$PIPE_CONF_DIR/config-
$seq
110 $sudo mv $tmp.config
$PIPE_CONF_FILE
113 echo "=== pipe agent installation ==="
114 $sudo .
/Install
</dev
/null
>$tmp.out
2>&1
115 cat $tmp.out
>>$here/$seq.full
116 # Check pipe metrics have appeared ... X metrics and Y values
117 _filter_pmda_install
<$tmp.out \
119 -e '/^Waiting for pmcd/s/\.\.\.[. ]*$/DOTS/' \
120 -e 's/[0-9][0-9]* warnings, //' \
122 /Check pipe metrics have appeared/ { if ($7 >= 5 && $7 <= 25) $7 = "X"
123 if ($10 >= 3 && $10 <= 25) $10 = "Y"
130 # cull message resulting from non-event check access (pminfo/pmprobe)
131 grep -v 'No value(s) available'
134 # real QA test starts here
137 # pmcd should have been started by the Install process - check
138 # a sub-tree that is known-good for all pipe versions
140 if pminfo
-v pipe
> $tmp.info
2> $tmp.err
142 cat $tmp.info
$tmp.err | _filter_pipe
145 echo "... failed! ... here is the Install log ..."
147 echo "... pminfo -v pipe ..."
148 cat $tmp.info
$tmp.err