3 # checks pmwebd graphite (web application) functionality
5 # Copyright (c) 2014-2016 Red Hat.
8 echo "QA output created by $seq"
13 test -d "$PCP_SHARE_DIR/webapps/graphite" || \
14 _notrun
"graphite webapp is not installed"
15 test -d "$PCP_SHARE_DIR/webapps/blinkenlights" || \
16 _notrun
"blinkenlights webapp is not installed"
17 which curl
>/dev
/null
2>&1 || _notrun
"No curl binary installed"
18 $python -c "import json.tool" >/dev
/null
2>&1
19 [ $?
-eq 0 ] || _notrun
"python import json.tool not installed"
25 signal
=$PCP_BINADM_DIR/pmsignal
26 status
=1 # failure is the default!
33 [ -z "$pid" ] ||
kill $pid
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 webport
=44339 # not 44323, so system pmwebd is unaffected by test case
38 webargs
="-U $username -p $webport"
41 echo "=== pmwebd graphite capabilities ===" |
tee -a $seq.full
43 $PCP_BINADM_DIR/pmwebd
$webargs -GX -R $PCP_SHARE_DIR/webapps
-i 15 -A `pwd` -N -M8 -x/dev
/tty
-d1 -vvvvv -l $tmp.out
&
45 _wait_for_pmwebd_logfile
$tmp.out
$webport
48 # TODO: telnet-probe hanging in read(2) here:
50 # | $PCP_BINADM_DIR/telnet-probe localhost $webport
52 # | $PCP_BINADM_DIR/telnet-probe localhost $webport
56 tr -d '\r' |
# drop ^M from httpd results
57 sed -e 's,^Date:.*$,Date: XXX,' |
58 grep -v 'Connection:.*Alive' # some microhttpd versions add this
62 curl
-s -i "http://localhost:$webport/?zoo=goo&phantasm" | _filter_curl_i
63 curl
-s -i "http://localhost:$webport/blinkenlights" | _filter_curl_i
64 curl
-s -i "http://localhost:$webport/blinkenlights/" | _filter_curl_i
65 curl
-s -S "http://localhost:$webport/graphite/index.html?foo=bar&ectoplasm=egon"
68 echo "metric name breakage"
69 curl
-s -S "http://localhost:$webport/graphite/render?format=json&target=.." | _webapi_json_pretty
70 curl
--compressed -s -S "http://localhost:$webport/graphite/render?format=json&target=foo-XX-bar" | _webapi_json_pretty
73 echo "metric tree iteration"
74 curl
-s -S "http://localhost:$webport/graphite/metrics/find?query=archives*naslog*.*" | _webapi_json_pretty
75 curl
--compressed -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.*" | _webapi_json_pretty
76 curl
-s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*." | _webapi_json_pretty
77 curl
--compressed -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*.all" | _webapi_json_pretty
78 curl
-s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*.all." | _webapi_json_pretty
81 echo "metric regex grep 1"
82 curl
--compressed -s -S "http://localhost:$webport/graphite/graphlot/findmetric?q=.*960624.*disk.*dks131.*"
84 echo "metric regex grep 2"
85 curl
-s -S "http://localhost:$webport/graphite/browser/search?query=2014+hinv+n.*"
86 echo # not \n terminated
89 echo "metric value dump 1"
90 curl
-s -S "http://localhost:$webport/graphite/render?format=json&target=*/node_archive.proc.psinfo.pid.*&from=15:50_20131127&until=1385585880&maxDataPoints=100" | _webapi_json_pretty
92 echo "metric value dump 2"
93 curl
--compressed -s -S "http://localhost:$webport/graphite/rawdata?target=*/node_archive.proc.psinfo.pid.*&from=00:00_20131127&until=00:00_20131129&maxDataPoints=300" | _webapi_json_pretty
96 echo compressed archive
, expect non-empty result
97 curl
-s -S "http://localhost:$webport/graphite/rawdata?target=*20130706.kernel.all.nprocs&from=00:00_20130705&until=23:59_20130705" | _webapi_json_pretty
100 echo "metric gfx rendering"
101 curl
-s -S "http://localhost:$webport/graphite/render?width=999&height=999&hideLegend=false&bgcolor=%23FF0&title=hello&format=png&target=*-chartqa1-2E-meta.sample.*byte*&target=*-chartqa1-2E-meta.*NOSUCH*&target=*-chartqa1-2E-meta.sample.dodgey.value.NOSUCH&from=22:31_20071010&until=22:36_20071010" > $tmp.png
102 _webapi_img_pretty
$tmp.png
103 curl
-s -S "http://localhost:$webport/graphite/render?width=999&height=999&target=*archive*20150417*.proc.nprocs&from=09:30_20150417&until=23:00_20150417" > $tmp.png
104 _webapi_img_pretty
$tmp.png
105 # until=now should trigger redirect
106 curl
--compressed -s -S "http://localhost:$webport/graphite/render?width=999&height=999&target=*archive*20150417*.proc.nprocs&from=09:30_20150417&until=now" > $tmp.png
107 if [ -s $tmp.png
]; then
109 _webapi_img_pretty
$tmp.png
111 echo expected empty
/absent png
113 curl
-L -s -S "http://localhost:$webport/graphite/render?width=999&height=999&target=*archive*20150417*.proc.nprocs&from=09:30_20150417&until=now" > $tmp.png
114 _webapi_img_pretty
$tmp.png
117 cat $tmp.out
>> $seq.full
119 # Run one more test but without -X mode
123 $PCP_BINADM_DIR/pmwebd
$webargs -G -R $PCP_SHARE_DIR/webapps
-I -i 15 -A `pwd` -N -M8 -x/dev
/tty
-d1 -vvvvv -l $tmp.out
&
125 _wait_for_pmwebd_logfile
$tmp.out
$webport
128 echo "metric value dump 1 without -X"
129 curl
-s -S "http://localhost:$webport/graphite/render?format=json&target=*node_archive*.proc.psinfo.pid.*&from=15:50_20131127&until=1385585880&maxDataPoints=100" | _webapi_json_pretty