3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

[add] pm checks

This commit is contained in:
Ramil Valitov 2020-07-06 23:08:12 +03:00
parent 8c9ec82da5
commit f6cd5afe41
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -43,11 +43,23 @@ setupPool() {
#Create new socket pools
for ((c = 1; c <= MAX_POOLS; c++)); do
POOL_NAME="socket$c"
POOL_NAME="static$c"
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "static"
done
for ((c = 1; c <= MAX_POOLS; c++)); do
POOL_NAME="dynamic$c"
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "dynamic"
done
for ((c = 1; c <= MAX_POOLS; c++)); do
POOL_NAME="ondemand$c"
POOL_SOCKET="/run/php/php${PHP_VERSION}-fpm-${POOL_NAME}.sock"
copyPool "$POOL_FILE" "$POOL_NAME" "$POOL_SOCKET" "ondemand"
done
#Create TCP port based pools
#Division on 1 is required to convert from float to integer
START_PORT=$(echo "($MIN_PORT + $PHP_VERSION * 100 + 1)/1" | bc)
@ -205,9 +217,23 @@ testZabbixDiscoverReturnsData() {
assertNotNull "Discover script failed: $DATA" "$IS_OK"
}
testZabbixDiscoverNumberOfSocketPools() {
testZabbixDiscoverNumberOfStaticPools() {
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}":"socket1",' | wc -l)
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"static' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
assertEquals "Number of pools mismatch" "$PHP_COUNT" "$NUMBER_OF_POOLS"
}
testZabbixDiscoverNumberOfDynamicPools() {
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}":"dynamic' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
assertEquals "Number of pools mismatch" "$PHP_COUNT" "$NUMBER_OF_POOLS"
}
testZabbixDiscoverNumberOfOndemandPools() {
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)
PHP_COUNT=$(getNumberOfPHPVersions)
assertEquals "Number of pools mismatch" "$PHP_COUNT" "$NUMBER_OF_POOLS"
}