This file is indexed.

/var/lib/pcp/testsuite/661 is in pcp-testsuite 4.0.1-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#! /bin/sh
# PCP QA Test No. 661
# checks pmwebd graphite (web application) functionality
#
# Copyright (c) 2014-2016 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"

. ./common.webapi
. ./common.python

test -d "$PCP_SHARE_DIR/webapps/graphite" || \
	_notrun "graphite webapp is not installed"
test -d "$PCP_SHARE_DIR/webapps/blinkenlights" || \
	_notrun "blinkenlights webapp is not installed"
which curl >/dev/null 2>&1 || _notrun "No curl binary installed"

$python -c "from PIL import Image" >/dev/null 2>&1 || _notrun "$python PIL package is not installed"

$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
rm -f $seq.full

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!
username=`id -u -n`

_cleanup()
{
    $sudo rm -fr $tmp.dir
    $sudo rm -f $tmp.*
    [ -z "$pid" ] || kill $pid
}
trap "_cleanup; exit \$status" 0 1 2 3 15

webport=44339   # not 44323, so system pmwebd is unaffected by test case
webargs="-U $username -p $webport"

echo
echo "=== pmwebd graphite capabilities ===" | tee -a $seq.full

$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 &
pid=$!
_wait_for_pmwebd_logfile $tmp.out $webport

# Not sure what this is trying to do ... just echoing GET HTTP/1.0 will
# cause telnet-probe to hang waiting for a response from pmwebd ...
# sending "GET HTTP/1.0" followed by "FOO" gets no response to the
# illegal request ... is that what we're trying to test?
#
echo "crashers"
( echo "GET  HTTP/1.0"; echo FOO ) \
| $PCP_BINADM_DIR/telnet-probe localhost $webport
( echo "GET HTTP/1.0"; echo FOO ) \
| $PCP_BINADM_DIR/telnet-probe localhost $webport

_filter_curl_i()
{
    tr -d '\r' |                      # drop ^M from httpd results
    sed -e 's,^Date:.*$,Date: XXX,' -e 's/302 Moved Temporarily/302 Found/' -e 's/^ETag: .*/ETAG/' |
    grep -v 'Connection:.*Alive'      # some microhttpd versions add this
}

_filter_graphite_image()
{
    imgname=$1

    # note: PIL is deprecated, pillow is apparently the successor.
    $python -c "
import sys
from PIL import Image
img = Image.open('$imgname')
print('size=%dx%d\n' % (img.size[0], img.size[1]))
"
}

echo "the catalog"
curl -s -i "http://localhost:$webport/?zoo=goo&phantasm" | _filter_curl_i
curl -s -i "http://localhost:$webport/blinkenlights" | _filter_curl_i
curl -s -i "http://localhost:$webport/blinkenlights/" | _filter_curl_i
curl -s -i "http://localhost:$webport/graphite/index.html" | _filter_curl_i | grep -i etag
curl -s -S "http://localhost:$webport/graphite/index.html?foo=bar&ectoplasm=egon"

echo
echo "metric name breakage" 
curl -s -S "http://localhost:$webport/graphite/render?format=json&target=.." | pmjson --pretty
curl --compressed -s -S "http://localhost:$webport/graphite/render?format=json&target=foo-XX-bar" | pmjson --pretty

echo
echo "metric tree iteration" 
curl -s -S "http://localhost:$webport/graphite/metrics/find?query=archives*naslog*.*" | pmjson --pretty | tee -a $here/$seq.full

curl --compressed -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.*" | pmjson --pretty | tee -a $here/$seq.full

curl -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*." | pmjson --pretty | tee -a $here/$seq.full

curl --compressed -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*.all" | pmjson --pretty | tee -a $here/$seq.full

curl -s -S "http://localhost:$webport/graphite/metrics/find?format=completer&query=archives*naslog*.k*.all." | pmjson --pretty | tee -a $here/$seq.full

echo
echo "metric regex grep 1" 
curl --compressed -s -S "http://localhost:$webport/graphite/graphlot/findmetric?q=.*960624.*disk.*dks131.*"
echo
echo "metric regex grep 2"
curl -s -S "http://localhost:$webport/graphite/browser/search?query=2014+hinv+n.*"
echo # not \n terminated

echo
echo "metric value dump 1" 
curl -s -S "http://localhost:$webport/graphite/render?format=json&target=*/node_archive.proc.psinfo.pid.*&from=15:50_20131127&until=1385585880&maxDataPoints=100" \
| pmjson --pretty | tee -a $here/$seq.full

echo
echo "metric value dump 2" 
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" | pmjson --pretty | tee -a $here/$seq.full

echo
echo compressed archive, expect non-empty result
curl -s -S "http://localhost:$webport/graphite/rawdata?target=*20130706.kernel.all.nprocs&from=00:00_20130705&until=23:59_20130705" | pmjson --pretty | tee -a $here/$seq.full

echo
echo "metric gfx rendering" 
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
_filter_graphite_image $tmp.png
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
_filter_graphite_image $tmp.png
# until=now should trigger redirect
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
if [ -s $tmp.png ]; then
    echo unexpected png
    _filter_graphite_image $tmp.png
else
    echo expected empty/absent png
fi
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
_filter_graphite_image $tmp.png

# tidy up
cat $tmp.out >> $seq.full

# Run one more test but without -X mode

kill $pid
sleep 3
$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 &
pid=$!
_wait_for_pmwebd_logfile $tmp.out $webport

echo
echo "metric value dump 1 without -X"
curl -s -S "http://localhost:$webport/graphite/render?format=json&target=*node_archive*.proc.psinfo.pid.*&from=15:50_20131127&until=1385585880&maxDataPoints=100" | pmjson --pretty | tee -a $here/$seq.full

status=0
exit