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

[fix] max time check

This commit is contained in:
Ramil Valitov 2020-09-21 14:36:30 +03:00
parent 1589f098e1
commit 92222fb293
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -155,6 +155,8 @@ function printElapsedTime() {
} }
function assertExecutionTime() { function assertExecutionTime() {
local MAX_TIME
MAX_TIME=$(echo "$ZABBIX_TIMEOUT * 1000" | bc)
assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt $MAX_TIME ]" assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt $MAX_TIME ]"
} }
@ -739,7 +741,6 @@ testDiscoverScriptRunDuration() {
DATA=$(sudo -u zabbix sudo "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "sleep" "/php-fpm-status") DATA=$(sudo -u zabbix sudo "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "sleep" "/php-fpm-status")
CHECK_OK_COUNT=$(echo "$DATA" | grep -o -F "execution time OK" | wc -l) CHECK_OK_COUNT=$(echo "$DATA" | grep -o -F "execution time OK" | wc -l)
STOP_OK_COUNT=$(echo "$DATA" | grep -o -F "stop required" | wc -l) STOP_OK_COUNT=$(echo "$DATA" | grep -o -F "stop required" | wc -l)
MAX_TIME=$(echo "$ZABBIX_TIMEOUT * 1000" | bc)
printElapsedTime printElapsedTime
printYellow "Success time checks: $CHECK_OK_COUNT" printYellow "Success time checks: $CHECK_OK_COUNT"
@ -754,7 +755,6 @@ testZabbixDiscoverRunDuration() {
AddSleepToConfig AddSleepToConfig
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"])
MAX_TIME=$(echo "$ZABBIX_TIMEOUT * 1000" | bc)
printElapsedTime printElapsedTime
assertExecutionTime assertExecutionTime