mirror of
https://github.com/rvalitov/zabbix-php-fpm.git
synced 2023-11-05 03:30:27 +01:00
[add] ondemand hot pools
This commit is contained in:
parent
ad9435ee39
commit
5b7f642e49
21
tests/all.sh
21
tests/all.sh
@ -227,6 +227,27 @@ testZabbixDiscoverNumberOfOndemandPoolsCold() {
|
|||||||
|
|
||||||
testZabbixDiscoverNumberOfOndemandPoolsHot() {
|
testZabbixDiscoverNumberOfOndemandPoolsHot() {
|
||||||
# We must start all the pools
|
# We must start all the pools
|
||||||
|
POOL_URL="/"
|
||||||
|
PHP_COUNT=$(getNumberOfPHPVersions)
|
||||||
|
|
||||||
|
PHP_LIST=$(find /etc/php/ -name 'www.conf' -type f)
|
||||||
|
while IFS= read -r pool; do
|
||||||
|
if [[ -n $pool ]]; then
|
||||||
|
POOL_DIR=$(dirname "$pool")
|
||||||
|
PHP_VERSION=$(echo "$POOL_DIR" | grep -oP "(\d\.\d)")
|
||||||
|
|
||||||
|
for ((c = 1; c <= MAX_POOLS; c++)); do
|
||||||
|
POOL_NAME="ondemand$c"
|
||||||
|
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
|
||||||
|
|
||||||
|
SCRIPT_NAME=$POOL_SOCKET \
|
||||||
|
SCRIPT_FILENAME=$POOL_SOCKET \
|
||||||
|
QUERY_STRING=json \
|
||||||
|
REQUEST_METHOD=GET \
|
||||||
|
cgi-fcgi -bind -connect "$POOL_URL" 2>/dev/null
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done <<<"$PHP_LIST"
|
||||||
|
|
||||||
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
|
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
|
||||||
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"ondemand' | wc -l)
|
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"ondemand' | wc -l)
|
||||||
|
@ -42,6 +42,7 @@ S_WHOAMI=$(type -P whoami)
|
|||||||
S_DATE=$(type -P date)
|
S_DATE=$(type -P date)
|
||||||
S_BC=$(type -P bc)
|
S_BC=$(type -P bc)
|
||||||
S_SLEEP=$(type -P sleep)
|
S_SLEEP=$(type -P sleep)
|
||||||
|
S_FCGI=$(type -P cgi-fcgi)
|
||||||
|
|
||||||
if [[ ! -x $S_PS ]]; then
|
if [[ ! -x $S_PS ]]; then
|
||||||
echo "Utility 'ps' not found. Please, install it first."
|
echo "Utility 'ps' not found. Please, install it first."
|
||||||
@ -107,6 +108,10 @@ if [[ ! -x $S_SLEEP ]]; then
|
|||||||
echo "Utility 'sleep' not found. Please, install it first."
|
echo "Utility 'sleep' not found. Please, install it first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -x $S_FCGI ]]; then
|
||||||
|
echo "Utility 'cgi-fcgi' not found. Please, install it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
#Local directory
|
#Local directory
|
||||||
LOCAL_DIR=$(${S_DIRNAME} "$0")
|
LOCAL_DIR=$(${S_DIRNAME} "$0")
|
||||||
|
Loading…
Reference in New Issue
Block a user