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

[add] continous checks

This commit is contained in:
Ramil Valitov 2020-07-07 01:31:17 +03:00
parent 94d2898cb5
commit c474b4c6c5
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914
2 changed files with 58 additions and 7 deletions

View File

@ -190,7 +190,7 @@ testDiscoverScriptReturnsData() {
}
testDiscoverScriptDebug() {
DATA=$(sudo -u zabbix sudo "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "/php-fpm-status")
DATA=$(sudo -u zabbix sudo "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "nosleep" "/php-fpm-status")
NUMBER_OF_ERRORS=$(echo "$DATA" | grep -o -F 'Error:' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
if [[ $PHP_COUNT != $NUMBER_OF_ERRORS ]]; then
@ -210,7 +210,15 @@ testZabbixDiscoverReturnsData() {
}
testZabbixDiscoverNumberOfStaticPools() {
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"static' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
POOLS_BY_DESIGN=$(echo "$PHP_COUNT * $MAX_POOLS" | bc)
@ -218,7 +226,15 @@ testZabbixDiscoverNumberOfStaticPools() {
}
testZabbixDiscoverNumberOfDynamicPools() {
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"dynamic' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
POOLS_BY_DESIGN=$(echo "$PHP_COUNT * $MAX_POOLS" | bc)
@ -226,7 +242,15 @@ testZabbixDiscoverNumberOfDynamicPools() {
}
testZabbixDiscoverNumberOfOndemandPoolsCold() {
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"ondemand' | wc -l)
#If the pools are not started then we have 0 here:
assertEquals "Number of pools mismatch" "0" "$NUMBER_OF_POOLS"
@ -256,7 +280,15 @@ testZabbixDiscoverNumberOfOndemandPoolsHot() {
fi
done <<<"$PHP_LIST"
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"ondemand' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
POOLS_BY_DESIGN=$(echo "$PHP_COUNT * $MAX_POOLS" | bc)
@ -264,7 +296,15 @@ testZabbixDiscoverNumberOfOndemandPoolsHot() {
}
testZabbixDiscoverNumberOfIPPools() {
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"localhost",' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
POOLS_BY_DESIGN="$PHP_COUNT"
@ -272,7 +312,15 @@ testZabbixDiscoverNumberOfIPPools() {
}
testZabbixDiscoverNumberOfPortPools() {
OLD_DATA=""
DATA="1"
while
[[ $OLD_DATA != "$DATA" ]]
OLD_DATA="$DATA"
DATA=$(zabbix_get -s 127.0.0.1 -p 10050 -k php-fpm.discover["/php-fpm-status"])
do true; done
NUMBER_OF_POOLS=$(echo "$DATA" | grep -o -F '{"{#POOLNAME}":"port' | wc -l)
PHP_COUNT=$(getNumberOfPHPVersions)
POOLS_BY_DESIGN=$(echo "$PHP_COUNT * $MAX_POOLS" | bc)

View File

@ -561,6 +561,9 @@ for ARG in "$@"; do
elif [[ ${ARG} == "sleep" ]]; then
USE_SLEEP_TIMEOUT="1"
echo "Debug: Sleep timeout enabled"
elif [[ ${ARG} == "nosleep" ]]; then
MAX_EXECUTION_TIME="10000000"
echo "Debug: Timeout checks disabled"
elif [[ ${ARG} == /* ]]; then
STATUS_PATH=${ARG}
PrintDebug "Argument $ARG is interpreted as status path"