/var/lib/pcp/testsuite/common.pcpweb is in pcp-testsuite 3.8.12ubuntu1.
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 | #!/bin/sh
#
# Common pre-test checking for weblog and webping PCP QA tests
#
# Copyright (c) 1997-2002 Silicon Graphics, Inc. All Rights Reserved.
#
. ./localconfig
. ./common.product
_installed()
{
versions $1 | fgrep $1 > /dev/null 2>&1
}
_remove_pmda()
{
( cd $PCP_PMDAS_DIR/$1 ; $sudo ./Remove ) 2>&1
_pmda_installed $1 $PCP_PMCDCONF_PATH \
&& _fail "couldn't install $1 pmda"
}
_install_pmda()
{
( cd $PCP_PMDAS_DIR/$1 ; $sudo ./Install < /dev/null ) 2>&1
_pmda_installed $1 $PCP_PMCDCONF_PATH \
|| _fail "couldn't install $1 pmda"
}
_save_state()
{
$sudo cp $PCP_PMCDCONF_PATH $PCP_PMCDCONF_PATH.$seq \
|| _fail "couldn't save pmcd.conf"
if [ -f $PCP_VAR_DIR/config/web/webping.conf ]
then
$sudo cp $PCP_VAR_DIR/config/web/webping.conf $PCP_VAR_DIR/config/web/webping.conf.$seq \
|| _fail "couldn't save webping.conf"
fi
if [ -f $PCP_VAR_DIR/config/web/webdefaults ]
then
$sudo cp $PCP_VAR_DIR/config/web/webdefaults $PCP_VAR_DIR/config/web/webdefaults.$seq \
|| _fail "couldn't save webdefaults"
fi
}
_pmda_installed()
{
grep "^$1" "$2" >/dev/null
}
_restore_state()
{
if [ -f $PCP_PMCDCONF_PATH.$seq ]
then
# reset pmda installation state
for pmda in weblog webping
do
if _pmda_installed $pmda $PCP_PMCDCONF_PATH.$seq
then
_pmda_installed $pmda $PCP_PMCDCONF_PATH \
|| _install_pmda $pmda > /dev/null
else
_pmda_installed $pmda $PCP_PMCDCONF_PATH \
&& _remove_pmda $pmda > /dev/null
fi
done
# copy back saved configuration files
[ -f $PCP_PMCDCONF_PATH.$seq ] \
&& $sudo mv $PCP_PMCDCONF_PATH.$seq $PCP_PMCDCONF_PATH
[ -f $PCP_VAR_DIR/config/web/webping.conf.$seq ] \
&& $sudo mv $PCP_VAR_DIR/config/web/webping.conf.$seq $PCP_VAR_DIR/config/web/webping.conf
[ -f $PCP_VAR_DIR/config/web/webdefaults.$seq ] \
&& $sudo mv $PCP_VAR_DIR/config/web/webdefaults.$seq $PCP_VAR_DIR/config/web/webdefaults
# restart pmcd to pick up new configuration
$sudo $PCP_BINADM_DIR/pmsignal -a -s HUP pmcd
_wait_for_pmcd
fi
}
_pmget()
{
pminfo -f $1 | $PCP_AWK_PROG '/^ *value/ { print $2 }' \
|| _fail "Couldn't get value for $1"
}
_pmcount()
{
pminfo $1 | grep -c .
}
_require_pmda()
{
_pmda_installed $1 $PCP_PMCDCONF_PATH \
|| _install_pmda $1 > /dev/null
}
##############################################################################
unset ROOT
|