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 e47229aa6f
commit c90d6b00b1
34 changed files with 306 additions and 0 deletions

View File

@ -201,9 +201,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

@ -201,9 +201,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

@ -201,9 +201,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

@ -201,9 +201,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

@ -201,9 +201,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

@ -207,10 +207,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/ember.conf" "Plugins.EmberPlus.System.Path" "/usr/sbin/zabbix-agent2-plugin/ember-plus"
}
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

@ -207,10 +207,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/ember.conf" "Plugins.EmberPlus.System.Path" "/usr/sbin/zabbix-agent2-plugin/ember-plus"
}
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

@ -207,10 +207,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/ember.conf" "Plugins.EmberPlus.System.Path" "/usr/sbin/zabbix-agent2-plugin/ember-plus"
}
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

@ -207,10 +207,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/ember.conf" "Plugins.EmberPlus.System.Path" "/usr/sbin/zabbix-agent2-plugin/ember-plus"
}
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

@ -207,10 +207,19 @@ prepare_zbx_agent_plugin_config() {
update_config_var "/etc/zabbix/zabbix_agent2.d/plugins.d/ember.conf" "Plugins.EmberPlus.System.Path" "/usr/sbin/zabbix-agent2-plugin/ember-plus"
}
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

@ -495,6 +495,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"
@ -510,6 +518,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -492,6 +492,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"
@ -507,6 +515,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -492,6 +492,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"
@ -507,6 +515,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -492,6 +492,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"
@ -507,6 +515,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -492,6 +492,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"
@ -507,6 +515,7 @@ prepare_proxy() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -248,10 +248,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

@ -248,10 +248,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

@ -248,10 +248,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

@ -248,10 +248,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

@ -248,10 +248,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

@ -542,6 +542,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"
@ -557,6 +565,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -539,6 +539,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"
@ -554,6 +562,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -539,6 +539,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"
@ -554,6 +562,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -539,6 +539,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"
@ -554,6 +562,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -539,6 +539,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"
@ -554,6 +562,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -559,6 +559,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"
@ -573,6 +581,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -559,6 +559,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"
@ -573,6 +581,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -559,6 +559,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"
@ -573,6 +581,7 @@ prepare_server() {
prepare_db
update_zbx_config
clear_zbx_env
}
#################################################

View File

@ -559,6 +559,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"
@ -573,6 +581,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
}
#################################################