Commit ecedf204 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Add support of proxy hostname

parent a19cbb3f
......@@ -286,6 +286,7 @@ define ZABBIX_PROXY_CONFIG
config zabbix 'proxy'
option server ''
option hostname ''
option startpollers '5'
option cachesize '32M'
endef
......
......@@ -20,6 +20,7 @@ entry_execute_method_root_Zabbix() {
common_execute_method_param "$DMROOT.Zabbix.Agent.ServerActive" "1" "zabbix_get_agent_serveractive" "zabbix_set_agent_serveractive"
common_execute_method_obj "$DMROOT.Zabbix.Proxy." "0"
common_execute_method_param "$DMROOT.Zabbix.Proxy.Server" "1" "zabbix_get_proxy_server" "zabbix_set_proxy_server"
common_execute_method_param "$DMROOT.Zabbix.Proxy.Hostname" "1" "zabbix_get_proxy_hostname" "zabbix_set_proxy_hostname"
common_execute_method_param "$DMROOT.Zabbix.Proxy.StartPollers" "1" "zabbix_get_start_pollers" "zabbix_set_start_pollers"
common_execute_method_param "$DMROOT.Zabbix.Proxy.StartPingers" "1" "zabbix_get_start_pingers" "zabbix_set_start_pingers"
common_execute_method_param "$DMROOT.Zabbix.Proxy.CacheSize" "1" "zabbix_get_cache_size" "zabbix_set_cache_size"
......@@ -72,6 +73,19 @@ zabbix_set_proxy_server() {
fi
}
zabbix_get_proxy_hostname() {
echo `$UCI_GET zabbix.proxy.hostname`
}
zabbix_set_proxy_hostname() {
local hostname=`$UCI_GET zabbix.proxy.hostname`
if [ "$hostname" != "$1" ]; then
$UCI_SET zabbix.proxy.hostname="$1"
$UCI_COMMIT
chmod a+r /etc/config/zabbix
fi
}
zabbix_get_start_pollers() {
echo `$UCI_GET zabbix.proxy.startpollers`
}
......
......@@ -5,6 +5,7 @@ DATABASE=`/sbin/uci -q get mysql.credentials.database`
USER=`/sbin/uci -q get mysql.credentials.username`
PASSWORD=`/sbin/uci -q get mysql.credentials.password`
SERVER=`/sbin/uci -q get zabbix.proxy.server`
HOSTNAME=`/sbin/uci -q get zabbix.proxy.hostname`
START_POLLERS=`/sbin/uci -q get zabbix.proxy.startpollers`
START_PINGERS=`/sbin/uci -q get zabbix.proxy.startpingers`
CACHE_SIZE=`/sbin/uci -q get zabbix.proxy.cachesize`
......@@ -15,6 +16,9 @@ if [ ! -z "$DBSERVER" ] && [ ! -z "$DATABASE" ] && [ ! -z "$USER" ] && [ ! -z "$
echo "DBUser=$USER" >> /etc/zabbix_proxy.conf.d/zabbix_proxy.conf
echo "DBPassword=$PASSWORD" >> /etc/zabbix_proxy.conf.d/zabbix_proxy.conf
echo "Server=$SERVER" >> /etc/zabbix_proxy.conf.d/zabbix_proxy.conf
if [ ! -z "$HOSTNAME" ]; then
echo "Hostname=$HOSTNAME" >> /etc/zabbix_proxy.conf.d/zabbix_proxy.conf
fi
if [ ! -z "$START_POLLERS" ]; then
echo "StartPollers=$START_POLLERS" >> /etc/zabbix_proxy.conf.d/zabbix_proxy.conf
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment