Skip to content

Commit

Permalink
Allowed possibility to use empty passive or active checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dotneft committed Dec 25, 2024
1 parent 72d9d1b commit a41e79f
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 80 deletions.
29 changes: 19 additions & 10 deletions Dockerfiles/agent/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=$ZABBIX_CONF_DIR/zabbix_agentd.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -153,7 +162,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -166,7 +175,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "StartAgents" "${ZBX_STARTAGENTS}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=$ZABBIX_CONF_DIR/zabbix_agentd.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -153,7 +162,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -166,7 +175,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "StartAgents" "${ZBX_STARTAGENTS}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=$ZABBIX_CONF_DIR/zabbix_agentd.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -153,7 +162,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -166,7 +175,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "StartAgents" "${ZBX_STARTAGENTS}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent/ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=$ZABBIX_CONF_DIR/zabbix_agentd.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -153,7 +162,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "LogRemoteCommands" "${ZBX_LOGREMOTECOMMANDS}"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -166,7 +175,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "StartAgents" "${ZBX_STARTAGENTS}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent2/alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=${ZABBIX_CONF_DIR}/zabbix_agent2.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -152,7 +161,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "SourceIP"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -163,7 +172,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "ListenIP" "${ZBX_LISTENIP}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent2/centos/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=${ZABBIX_CONF_DIR}/zabbix_agent2.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -152,7 +161,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "SourceIP"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -163,7 +172,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "ListenIP" "${ZBX_LISTENIP}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
29 changes: 19 additions & 10 deletions Dockerfiles/agent2/rhel/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,25 @@ prepare_zbx_agent_config() {
echo "** Preparing Zabbix agent configuration file"
ZBX_AGENT_CONFIG=${ZABBIX_CONF_DIR}/zabbix_agent2.conf

: ${ZBX_PASSIVESERVERS:=""}
: ${ZBX_ACTIVESERVERS:=""}
: ${ZBX_PASSIVESERVERS=""}
: ${ZBX_ACTIVESERVERS=""}

[ -n "$ZBX_PASSIVESERVERS" ] && ZBX_PASSIVESERVERS=","$ZBX_PASSIVESERVERS

ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST$ZBX_PASSIVESERVERS

[ -n "$ZBX_ACTIVESERVERS" ] && ZBX_ACTIVESERVERS=","$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST","$ZBX_PASSIVESERVERS
elif [ ! -z "$ZBX_SERVER_HOST" ]; then
ZBX_PASSIVESERVERS=$ZBX_SERVER_HOST
fi

ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT$ZBX_ACTIVESERVERS
if [ ! -z "$ZBX_SERVER_HOST" ]; then
if [ ! -z "$ZBX_SERVER_PORT" ] && [ "$ZBX_SERVER_PORT" != "10051" ]; then
ZBX_SERVER_HOST=$ZBX_SERVER_HOST":"$ZBX_SERVER_PORT
fi
if [ ! -z "$ZBX_ACTIVESERVERS" ]; then
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST","$ZBX_ACTIVESERVERS
else
ZBX_ACTIVESERVERS=$ZBX_SERVER_HOST
fi
fi

update_config_var $ZBX_AGENT_CONFIG "PidFile"
update_config_var $ZBX_AGENT_CONFIG "LogType" "console"
Expand All @@ -152,7 +161,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "SourceIP"

: ${ZBX_PASSIVE_ALLOW:="true"}
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_PASSIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_PASSIVESERVERS" ]; then
echo "** Using '$ZBX_PASSIVESERVERS' servers for passive checks"
update_config_var $ZBX_AGENT_CONFIG "Server" "${ZBX_PASSIVESERVERS}"
else
Expand All @@ -163,7 +172,7 @@ prepare_zbx_agent_config() {
update_config_var $ZBX_AGENT_CONFIG "ListenIP" "${ZBX_LISTENIP}"

: ${ZBX_ACTIVE_ALLOW:="true"}
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ]; then
if [ "${ZBX_ACTIVE_ALLOW,,}" == "true" ] && [ ! -z "$ZBX_ACTIVESERVERS" ]; then
echo "** Using '$ZBX_ACTIVESERVERS' servers for active checks"
update_config_var $ZBX_AGENT_CONFIG "ServerActive" "${ZBX_ACTIVESERVERS}"
else
Expand Down
Loading

0 comments on commit a41e79f

Please sign in to comment.