This file is indexed.

/var/lib/pcp/testsuite/1111 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
#! /bin/sh
# PCP QA Test No. 1111
# checks basic pcp2influxdb functionality
#
# Copyright (c) 2015-2017 Red Hat, Inc.
#
seq=`basename $0`
echo "QA output created by $seq"

. ./common.python

$python -c "from pcp import pmapi" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmapi module not installed"
which socat >/dev/null 2>&1 || _notrun "socat binary not installed"
which pcp2influxdb >$seq.full 2>&1 || _notrun "pcp2influxdb not installed"

$python -c "import requests" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python requests module not installed"
major=`$python -c 'import requests; print(requests.__version__.split(".")[0])'`
[ $major -ge 1 ] || _notrun "python requests module too old (v$major)"

port=8086
$PCP_BINADM_DIR/telnet-probe -c localhost $port \
	&& _notrun "Someone already listening on typical InfluxDB $port"

$sudo rm -rf $seq.full $tmp.*
signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!

trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

_full_stash()
{
    echo "--- pcp2influxdb stdout --" >>$seq.full
    cat $tmp.p2i.out >>$seq.full
    echo "--- pcp2influxdb stderr --" >>$seq.full
    cat $tmp.p2i.err >>$seq.full
    echo "--- socket cat stdout --" >>$seq.full
    cat $tmp.socat.out >>$seq.full
    echo "--- socket cat stderr --" >>$seq.full
    cat $tmp.socat.err >>$seq.full
}

pcp2influxdb="$python `which pcp2influxdb`"

echo | tee -a $seq.full
echo "=== 1. pcp2influxdb one-shot noauth ===" | tee -a $seq.full
socat tcp-listen:$port,reuseaddr - >$tmp.socat.out 2>$tmp.socat.err &
pid=$!
sleep 2
$pcp2influxdb -x roar -t 1 hinv.ncpu >$tmp.p2i.out 2>$tmp.p2i.err &
p2ipid=$!
sleep 3
$signal $pid $p2ipid 2>/dev/null
wait
egrep -q "^POST \/write\?db=roar" $tmp.socat.out
[ $? -eq 0 ] && echo "Found POST URL in noauth output"
egrep -q "hinv_ncpu value=[0-9]+(\.[0-9]+)? [0-9]+$" $tmp.socat.out
[ $? -eq 0 ] && echo "Found proper metric body in noauth output"
_full_stash

echo "=== 2. pcp2influxdb noauth with tags ===" | tee -a $seq.full
socat tcp-listen:$port,reuseaddr - >$tmp.socat.out 2>$tmp.socat.err &
pid=$!
sleep 2
$pcp2influxdb -x roar -X host=me.example.com -t 1 hinv.ncpu \
        >$tmp.p2i.out 2>$tmp.p2i.err &
p2ipid=$!
sleep 3
$signal $pid $p2ipid 2>/dev/null
wait
egrep -q "^POST \/write\?db=roar" $tmp.socat.out
[ $? -eq 0 ] && echo "Found POST URL in noauth output"
egrep -q "hinv_ncpu,host=me\.example\.com value=[0-9]+(\.[0-9]+)? [0-9]+$" $tmp.socat.out
[ $? -eq 0 ] && echo "Found proper metric body in noauth output"
_full_stash

echo "=== 3. pcp2influxdb auth with tags ===" | tee -a $seq.full
socat tcp-listen:$port,reuseaddr - >$tmp.socat.out 2>$tmp.socat.err &
pid=$!
sleep 2
$pcp2influxdb -x roar --db-user pcp --db-pass hey \
        --db-tags host=me.example.com -t 1 hinv.ncpu \
        >$tmp.p2i.out 2>$tmp.p2i.err &
p2ipid=$!
sleep 3
$signal $pid $p2ipid 2>/dev/null
wait
egrep -q "^POST \/write\?db=roar" $tmp.socat.out
[ $? -eq 0 ] && echo "Found POST URL in output"
egrep -q "Authorization: Basic cGNwOmhleQ==" $tmp.socat.out
[ $? -eq 0 ] && echo "Found auth data in HTTP request"
egrep -q "hinv_ncpu,host=me\.example\.com value=[0-9]+(\.[0-9]+)? [0-9]+$" $tmp.socat.out
[ $? -eq 0 ] && echo "Found proper metric body in output"
_full_stash

echo "=== 4. pcp2influxdb bad-instance tolerance ===" | tee -a $seq.full
rm -f $tmp.socat.out $tmp.socat.err
socat tcp-listen:$port,reuseaddr - >>$tmp.socat.out 2>>$tmp.socat.err &
pid=$!
sleep 2
$pcp2influxdb -t 2 -I sample.aggregate.null sample.string.hullo sample.bad >$tmp.p2i.out 2>$tmp.p2i.err &
p2ipid=$!
sleep 8 # enough for at least 2 messages
$signal $pid $p2ipid 2>/dev/null
wait
grep 'Excluding' $tmp.p2i.err
_full_stash

status=0
exit