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

[fix] zabbix timeout checks

This commit is contained in:
Ramil Valitov 2020-07-07 16:22:16 +03:00
parent 9a4557501c
commit ff69832d45
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -313,12 +313,13 @@ testDiscoverScriptRunDuration() {
ELAPSED_TIME=$(echo "($END_TIME - $START_TIME)/1000000" | bc) ELAPSED_TIME=$(echo "($END_TIME - $START_TIME)/1000000" | bc)
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)
echo "Elapsed time $ELAPSED_TIME ms" echo "Elapsed time $ELAPSED_TIME ms"
echo "Success time checks: $CHECK_OK_COUNT" echo "Success time checks: $CHECK_OK_COUNT"
echo "Stop time checks: $STOP_OK_COUNT" echo "Stop time checks: $STOP_OK_COUNT"
assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt 3000 ]" assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt $MAX_TIME ]"
} }
testZabbixDiscoverRunDuration() { testZabbixDiscoverRunDuration() {
@ -331,12 +332,13 @@ testZabbixDiscoverRunDuration() {
ELAPSED_TIME=$(echo "($END_TIME - $START_TIME)/1000000" | bc) ELAPSED_TIME=$(echo "($END_TIME - $START_TIME)/1000000" | bc)
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)
echo "Elapsed time $ELAPSED_TIME ms" echo "Elapsed time $ELAPSED_TIME ms"
echo "Success time checks: $CHECK_OK_COUNT" echo "Success time checks: $CHECK_OK_COUNT"
echo "Stop time checks: $STOP_OK_COUNT" echo "Stop time checks: $STOP_OK_COUNT"
assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt 3000 ]" assertTrue "The script worked for too long" "[ $ELAPSED_TIME -lt $MAX_TIME ]"
} }
testDiscoverScriptDoubleRun() { testDiscoverScriptDoubleRun() {