File: 1781

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (98 lines) | stat: -rwxr-xr-x 2,409 bytes parent folder | download
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
#!/bin/sh
# PCP QA Test No. 1781
# Testing pmdahdb
#
# Copyright (c) 2025 Sam Feifer.  All Rights Reserved.
#
# hdb.conf must be configured correctly before running the test

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.python

pmda_path="$PCP_PMDAS_DIR/hdb"
pmda_script="$pmda_path/pmdahdb.python"

[ -d $pmda_path ] || _notrun "HDB PMDA is not installed"

$python -c "from pcp import pmda" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python pcp pmda module not installed"

$python -c "from hdbcli import dbapi" >/dev/null 2>&1
[ $? -eq 0 ] || _notrun "python hdbcli module not installed"

# Set these to match what is in hdb.conf
host="localhost"
port="39017"
user="user"
password="password"

HDB_VERSION=`$python $here/hdb/hdb_connect.python -H $host -P $port -U $user -W $password -Q "SELECT VERSION FROM SYS.M_DATABASE"` || _notrun "Cannot connnect to hdb instance"

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=1	# failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

pmdahdb_remove()
{
    cd $pmda_path
    echo
    echo "=== remove HDB agent ==="
    $sudo ./Remove >$tmp.out 2>&1
    _filter_pmda_remove <$tmp.out
}

pmdahdb_install()
{
    cd $pmda_path
    $sudo ./Remove >/dev/null 2>&1

    echo
    echo "=== HDB agent installation ==="
    $sudo ./Install </dev/null >$tmp.out 2>&1
    cat $tmp.out >>$seq_full
    cat $PCP_LOG_DIR/pmcd/hdb.log >>$seq_full
    _filter_pmda_install <$tmp.out \
    | sed \
        -e 's/[0-9][0-9]* warnings, //' \
    | $PCP_AWK_PROG '
/Check hdb metrics have appeared/   { if ($7 >= 178 && $7 <= 198) $7 = "X"
                                          if ($10 >= 1000 && $10 <= 5000) $10 = "Y"
                                        }
                                        { print }'
}

_prepare_pmda hdb

trap "_cleanup_pmda hdb; exit \$status" 0 1 2 3 15

_stop_auto_restart pmcd

# real QA test starts here
pmdahdb_install

echo "Check across all metrics for warnings on fetch"
pminfo -dft hdb >> $seq_full
pminfo -v hdb

echo "Check hdb.version value matches hdb shell"
pcpversion=`pmprobe -v hdb.version | awk '{ print $NF }' | tr -d \"`
if [ $pcpversion = $HDB_VERSION ]
then
    echo "Success - matching version numbers"
    status=0
else
    echo "Mismatch: $pcpversion vs $HDB_VERSION" | tee -a $seq_full
fi

pmdahdb_remove

# success, all done
exit