Clear ZBX, DB env variables before starting agent, server, proxy and web-service

This commit is contained in:
Alexey Pustovalov 2024-08-20 18:09:56 +09:00
parent b57d31b9cb
commit d0fe91b860
35 changed files with 315 additions and 0 deletions

View File

@ -202,9 +202,18 @@ prepare_zbx_agent_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
clear_zbx_env
}
#################################################

View File

@ -202,9 +202,18 @@ prepare_zbx_agent_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
clear_zbx_env
}
#################################################

View File

@ -202,9 +202,18 @@ prepare_zbx_agent_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
clear_zbx_env
}
#################################################

View File

@ -202,9 +202,18 @@ prepare_zbx_agent_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
clear_zbx_env
}
#################################################

View File

@ -202,9 +202,18 @@ prepare_zbx_agent_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
clear_zbx_env
}
#################################################

View File

@ -206,10 +206,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mssql.conf" "Plugins.MSSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/mssql"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
prepare_zbx_agent_plugin_config
clear_zbx_env
}
#################################################

View File

@ -206,10 +206,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mssql.conf" "Plugins.MSSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/mssql"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
prepare_zbx_agent_plugin_config
clear_zbx_env
}
#################################################

View File

@ -206,10 +206,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mssql.conf" "Plugins.MSSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/mssql"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
prepare_zbx_agent_plugin_config
clear_zbx_env
}
#################################################

View File

@ -206,10 +206,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mssql.conf" "Plugins.MSSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/mssql"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
prepare_zbx_agent_plugin_config
clear_zbx_env
}
#################################################

View File

@ -206,10 +206,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/mssql.conf" "Plugins.MSSQL.System.Path" "/usr/sbin/zabbix-agent2-plugin/mssql"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_agent() {
echo "** Preparing Zabbix agent"
prepare_zbx_agent_config
prepare_zbx_agent_plugin_config
clear_zbx_env
}
#################################################

View File

@ -499,6 +499,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -514,6 +522,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -496,6 +496,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -511,6 +519,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -496,6 +496,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -511,6 +519,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -496,6 +496,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -511,6 +519,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -496,6 +496,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -511,6 +519,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -246,10 +246,19 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_proxy() {
echo "Preparing Zabbix proxy"
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -246,10 +246,19 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_proxy() {
echo "Preparing Zabbix proxy"
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -246,10 +246,19 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_proxy() {
echo "Preparing Zabbix proxy"
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -246,10 +246,19 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_proxy() {
echo "Preparing Zabbix proxy"
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -246,10 +246,19 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_proxy() {
echo "Preparing Zabbix proxy"
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -550,6 +550,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -565,6 +573,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -547,6 +547,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -562,6 +570,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -547,6 +547,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -562,6 +570,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -547,6 +547,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -562,6 +570,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -547,6 +547,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|MYSQL)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -562,6 +570,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -567,6 +567,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -581,6 +589,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -567,6 +567,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -581,6 +589,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -567,6 +567,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -581,6 +589,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -573,6 +573,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -587,6 +595,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -567,6 +567,14 @@ update_zbx_config() {
fi
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^(ZBX|DB|POSTGRES)_"); do
unset "${env_var%%=*}"
done
}
prepare_db() {
echo "** Preparing database"
@ -581,6 +589,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -109,9 +109,18 @@ prepare_zbx_web_service_config() {
update_config_var $ZBX_CONFIG "IgnoreURLCertErrors" "${ZBX_IGNOREURLCERTERRORS}"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_web_service() {
echo "** Preparing Zabbix web service"
prepare_zbx_web_service_config
clear_zbx_env
}
#################################################

View File

@ -109,9 +109,18 @@ prepare_zbx_web_service_config() {
update_config_var $ZBX_CONFIG "IgnoreURLCertErrors" "${ZBX_IGNOREURLCERTERRORS}"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_web_service() {
echo "** Preparing Zabbix web service"
prepare_zbx_web_service_config
clear_zbx_env
}
#################################################

View File

@ -109,9 +109,18 @@ prepare_zbx_web_service_config() {
update_config_var $ZBX_CONFIG "IgnoreURLCertErrors" "${ZBX_IGNOREURLCERTERRORS}"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_web_service() {
echo "** Preparing Zabbix web service"
prepare_zbx_web_service_config
clear_zbx_env
}
#################################################

View File

@ -109,9 +109,18 @@ prepare_zbx_web_service_config() {
update_config_var $ZBX_CONFIG "IgnoreURLCertErrors" "${ZBX_IGNOREURLCERTERRORS}"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_web_service() {
echo "** Preparing Zabbix web service"
prepare_zbx_web_service_config
clear_zbx_env
}
#################################################

View File

@ -109,9 +109,18 @@ prepare_zbx_web_service_config() {
update_config_var $ZBX_CONFIG "IgnoreURLCertErrors" "${ZBX_IGNOREURLCERTERRORS}"
}
clear_zbx_env() {
[[ "${ZBX_CLEAR_ENV}" == "false" ]] && return
for env_var in $(env | grep -E "^ZBX_"); do
unset "${env_var%%=*}"
done
}
prepare_web_service() {
echo "** Preparing Zabbix web service"
prepare_zbx_web_service_config
clear_zbx_env
}
#################################################