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

[fix] max recursive checks

This commit is contained in:
Ramil Valitov 2020-07-07 15:03:28 +03:00
parent d3d90e6e6b
commit d6efe19e0b
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -8,6 +8,16 @@ MAX_PORTS=3
MIN_PORT=9000
TEST_SOCKET=""
function getUserParameters() {
sudo find /etc/zabbix/ -name 'userparameter_php_fpm.conf' -type f | head -n1
}
function restoreUserParameters() {
PARAMS_FILE=$(getUserParameters)
sudo rm -f $PARAMS_FILE
sudo cp "$TRAVIS_BUILD_DIR/zabbix/userparameter_php_fpm.conf" "$(sudo find /etc/zabbix/ -name 'zabbix_agentd*.d' -type d | head -n1)"
}
copyPool() {
ORIGINAL_FILE=$1
POOL_NAME=$2
@ -250,14 +260,6 @@ testDiscoverScriptSleep() {
assertTrue "No success stop checks detected" "[ $STOP_OK_COUNT -gt 0 ]"
}
function getUserParameters() {
sudo find /etc/zabbix/ -name 'userparameter_php_fpm.conf' -type f | head -n1
}
function restoreUserParameters() {
sudo cp "$TRAVIS_BUILD_DIR/zabbix/userparameter_php_fpm.conf" "$(sudo find /etc/zabbix/ -name 'zabbix_agentd*.d' -type d | head -n1)"
}
function AddSleepToConfig() {
PARAMS_FILE=$(getUserParameters)
sudo sed -i 's#.*zabbix_php_fpm_discovery.*#UserParameter=php-fpm.discover[*],sudo /etc/zabbix/zabbix_php_fpm_discovery.sh sleep $1#' "$PARAMS_FILE"
@ -294,6 +296,7 @@ testZabbixDiscoverDoubleRun() {
function discoverAllZabbix() {
DATA_OLD=$1
DATA_COUNT=$2
MAX_CHECKS=50
if [[ -z $DATA_COUNT ]]; then
DATA_COUNT=0
@ -305,7 +308,7 @@ function discoverAllZabbix() {
return 0
else
DATA_COUNT=$(echo "$DATA_COUNT + 1" | bc)
if [[ $DATA_COUNT -gt 10 ]]; then
if [[ $DATA_COUNT -gt $MAX_CHECKS ]]; then
echo "Data old: $DATA_OLD"
echo "Data new: $DATA"
return 1