容器安装6.0,如何修改zabbix_server.conf

我是一个zabbix新手,我在用docker安装zabbix后,想修改zabbix_server.conf的一些参数,但不知道应该如何修改,我看到网上有说通过环境变量进行设置,但我不清楚环境变量名称与配置项之间是如何映射的,比如我想修改LogType,由console修改为file,并指定LogFile,我应该如何进行?

请先 登录 后评论

2 个回答

细雨闲花

可以参考下官方文档https://hub.docker.com/r/zabbix/zabbix-server-mysql

或者可以把zabbix_server.conf 挂载出来,修改后重启容器即可

请先 登录 后评论
NoYoWiFi

这个参数没法修改,应该也不用修改

从官方的文档来看

update_config_var $ZBX_CONFIG "LogType" "console"


```官方支持的环境变量

update_zbx_config() {

    echo "** Preparing Zabbix server configuration file"


    ZBX_CONFIG=$ZABBIX_ETC_DIR/zabbix_server.conf


    update_config_var $ZBX_CONFIG "ListenIP" "${ZBX_LISTENIP}"

    update_config_var $ZBX_CONFIG "ListenPort" "${ZBX_LISTENPORT}"

    update_config_var $ZBX_CONFIG "ListenBacklog" "${ZBX_LISTENBACKLOG}"


    update_config_var $ZBX_CONFIG "SourceIP" "${ZBX_SOURCEIP}"

    update_config_var $ZBX_CONFIG "LogType" "console"

    update_config_var $ZBX_CONFIG "LogFile"

    update_config_var $ZBX_CONFIG "LogFileSize"

    update_config_var $ZBX_CONFIG "PidFile"


    update_config_var $ZBX_CONFIG "DebugLevel" "${ZBX_DEBUGLEVEL}"


    if [ -n "${ZBX_DBTLSCONNECT}" ]; then

        update_config_var $ZBX_CONFIG "DBTLSConnect" "${ZBX_DBTLSCONNECT}"

        update_config_var $ZBX_CONFIG "DBTLSCAFile" "${ZBX_DBTLSCAFILE}"

        update_config_var $ZBX_CONFIG "DBTLSCertFile" "${ZBX_DBTLSCERTFILE}"

        update_config_var $ZBX_CONFIG "DBTLSKeyFile" "${ZBX_DBTLSKEYFILE}"

        update_config_var $ZBX_CONFIG "DBTLSCipher" "${ZBX_DBTLSCIPHER}"

        update_config_var $ZBX_CONFIG "DBTLSCipher13" "${ZBX_DBTLSCIPHER13}"

    fi


    if [ ! -n "${DB_SERVER_SOCKET}" ]; then

        update_config_var $ZBX_CONFIG "DBHost" "${DB_SERVER_HOST}"

        update_config_var $ZBX_CONFIG "DBPort" "${DB_SERVER_PORT}"

    else

        update_config_var $ZBX_CONFIG "DBHost"

        update_config_var $ZBX_CONFIG "DBPort"

    fi

    update_config_var $ZBX_CONFIG "DBSocket" "${DB_SERVER_SOCKET}"

    update_config_var $ZBX_CONFIG "DBName" "${DB_SERVER_DBNAME}"

    update_config_var $ZBX_CONFIG "DBSchema" "${DB_SERVER_SCHEMA}"


    if [ -n "${VAULT_TOKEN}" ] && [ -n "${ZBX_VAULTURL}" ]; then

        update_config_var $ZBX_CONFIG "VaultDBPath" "${ZBX_VAULTDBPATH}"

        update_config_var $ZBX_CONFIG "VaultURL" "${ZBX_VAULTURL}"

        update_config_var $ZBX_CONFIG "DBUser"

        update_config_var $ZBX_CONFIG "DBPassword"

    else

        update_config_var $ZBX_CONFIG "VaultDBPath"

        update_config_var $ZBX_CONFIG "VaultURL"

        update_config_var $ZBX_CONFIG "DBUser" "${DB_SERVER_ZBX_USER}"

        update_config_var $ZBX_CONFIG "DBPassword" "${DB_SERVER_ZBX_PASS}"

    fi


    update_config_var $ZBX_CONFIG "AllowUnsupportedDBVersions" "${ZBX_ALLOWUNSUPPORTEDDBVERSIONS}"


    update_config_var $ZBX_CONFIG "StartReportWriters" "${ZBX_STARTREPORTWRITERS}"

    : ${ZBX_WEBSERVICEURL:="http://zabbix-web-service:10053/report"}

    update_config_var $ZBX_CONFIG "WebServiceURL" "${ZBX_WEBSERVICEURL}"


    update_config_var $ZBX_CONFIG "HistoryStorageURL" "${ZBX_HISTORYSTORAGEURL}"

    update_config_var $ZBX_CONFIG "HistoryStorageTypes" "${ZBX_HISTORYSTORAGETYPES}"

    update_config_var $ZBX_CONFIG "HistoryStorageDateIndex" "${ZBX_HISTORYSTORAGEDATEINDEX}"


    update_config_var $ZBX_CONFIG "StatsAllowedIP" "${ZBX_STATSALLOWEDIP}"


    update_config_var $ZBX_CONFIG "StartPollers" "${ZBX_STARTPOLLERS}"

    update_config_var $ZBX_CONFIG "StartIPMIPollers" "${ZBX_IPMIPOLLERS}"

    update_config_var $ZBX_CONFIG "StartPollersUnreachable" "${ZBX_STARTPOLLERSUNREACHABLE}"

    update_config_var $ZBX_CONFIG "StartTrappers" "${ZBX_STARTTRAPPERS}"

    update_config_var $ZBX_CONFIG "StartPingers" "${ZBX_STARTPINGERS}"

    update_config_var $ZBX_CONFIG "StartDiscoverers" "${ZBX_STARTDISCOVERERS}"

    update_config_var $ZBX_CONFIG "StartHistoryPollers" "${ZBX_STARTHISTORYPOLLERS}"

    update_config_var $ZBX_CONFIG "StartHTTPPollers" "${ZBX_STARTHTTPPOLLERS}"

    update_config_var $ZBX_CONFIG "StartODBCPollers" "${ZBX_STARTODBCPOLLERS}"


    update_config_var $ZBX_CONFIG "StartPreprocessors" "${ZBX_STARTPREPROCESSORS}"

    update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"

    update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"

    update_config_var $ZBX_CONFIG "StartAlerters" "${ZBX_STARTALERTERS}"

    update_config_var $ZBX_CONFIG "StartTimers" "${ZBX_STARTTIMERS}"

    update_config_var $ZBX_CONFIG "StartEscalators" "${ZBX_STARTESCALATORS}"


    update_config_var $ZBX_CONFIG "StartLLDProcessors" "${ZBX_STARTLLDPROCESSORS}"


    : ${ZBX_JAVAGATEWAY_ENABLE:="false"}

    if [ "${ZBX_JAVAGATEWAY_ENABLE,,}" == "true" ]; then

        update_config_var $ZBX_CONFIG "JavaGateway" "${ZBX_JAVAGATEWAY:-"zabbix-java-gateway"}"

        update_config_var $ZBX_CONFIG "JavaGatewayPort" "${ZBX_JAVAGATEWAYPORT}"

        update_config_var $ZBX_CONFIG "StartJavaPollers" "${ZBX_STARTJAVAPOLLERS:-"5"}"

    else

        update_config_var $ZBX_CONFIG "JavaGateway"

        update_config_var $ZBX_CONFIG "JavaGatewayPort"

        update_config_var $ZBX_CONFIG "StartJavaPollers"

    fi


    update_config_var $ZBX_CONFIG "StartVMwareCollectors" "${ZBX_STARTVMWARECOLLECTORS}"

    update_config_var $ZBX_CONFIG "VMwareFrequency" "${ZBX_VMWAREFREQUENCY}"

    update_config_var $ZBX_CONFIG "VMwarePerfFrequency" "${ZBX_VMWAREPERFFREQUENCY}"

    update_config_var $ZBX_CONFIG "VMwareCacheSize" "${ZBX_VMWARECACHESIZE}"

    update_config_var $ZBX_CONFIG "VMwareTimeout" "${ZBX_VMWARETIMEOUT}"


    : ${ZBX_ENABLE_SNMP_TRAPS:="false"}

    if [ "${ZBX_ENABLE_SNMP_TRAPS,,}" == "true" ]; then

        update_config_var $ZBX_CONFIG "SNMPTrapperFile" "${ZABBIX_USER_HOME_DIR}/snmptraps/snmptraps.log"

        update_config_var $ZBX_CONFIG "StartSNMPTrapper" "1"

    else

        update_config_var $ZBX_CONFIG "SNMPTrapperFile"

        update_config_var $ZBX_CONFIG "StartSNMPTrapper"

    fi


    update_config_var $ZBX_CONFIG "HousekeepingFrequency" "${ZBX_HOUSEKEEPINGFREQUENCY}"

    update_config_var $ZBX_CONFIG "MaxHousekeeperDelete" "${ZBX_MAXHOUSEKEEPERDELETE}"

    update_config_var $ZBX_CONFIG "ProblemHousekeepingFrequency" "${ZBX_PROBLEMHOUSEKEEPINGFREQUENCY}"


    update_config_var $ZBX_CONFIG "CacheSize" "${ZBX_CACHESIZE}"


    update_config_var $ZBX_CONFIG "CacheUpdateFrequency" "${ZBX_CACHEUPDATEFREQUENCY}"


    update_config_var $ZBX_CONFIG "StartDBSyncers" "${ZBX_STARTDBSYNCERS}"

    update_config_var $ZBX_CONFIG "HistoryCacheSize" "${ZBX_HISTORYCACHESIZE}"

    update_config_var $ZBX_CONFIG "HistoryIndexCacheSize" "${ZBX_HISTORYINDEXCACHESIZE}"


    update_config_var $ZBX_CONFIG "TrendCacheSize" "${ZBX_TRENDCACHESIZE}"

    update_config_var $ZBX_CONFIG "TrendFunctionCacheSize" "${ZBX_TRENDFUNCTIONCACHESIZE}"

    update_config_var $ZBX_CONFIG "ValueCacheSize" "${ZBX_VALUECACHESIZE}"


    update_config_var $ZBX_CONFIG "Timeout" "${ZBX_TIMEOUT}"

    update_config_var $ZBX_CONFIG "TrapperTimeout" "${ZBX_TRAPPERTIMEOUT}"

    update_config_var $ZBX_CONFIG "UnreachablePeriod" "${ZBX_UNREACHABLEPERIOD}"

    update_config_var $ZBX_CONFIG "UnavailableDelay" "${ZBX_UNAVAILABLEDELAY}"

    update_config_var $ZBX_CONFIG "UnreachableDelay" "${ZBX_UNREACHABLEDELAY}"


    update_config_var $ZBX_CONFIG "AlertScriptsPath" "/usr/lib/zabbix/alertscripts"

    update_config_var $ZBX_CONFIG "ExternalScripts" "/usr/lib/zabbix/externalscripts"


    if [ -n "${ZBX_EXPORTFILESIZE}" ]; then

        update_config_var $ZBX_CONFIG "ExportDir" "$ZABBIX_USER_HOME_DIR/export/"

        update_config_var $ZBX_CONFIG "ExportFileSize" "${ZBX_EXPORTFILESIZE}"

        update_config_var $ZBX_CONFIG "ExportType" "${ZBX_EXPORTTYPE}"

    fi


    update_config_var $ZBX_CONFIG "FpingLocation" "/usr/sbin/fping"

    update_config_var $ZBX_CONFIG "Fping6Location"


    update_config_var $ZBX_CONFIG "SSHKeyLocation" "$ZABBIX_USER_HOME_DIR/ssh_keys"

    update_config_var $ZBX_CONFIG "LogSlowQueries" "${ZBX_LOGSLOWQUERIES}"


    update_config_var $ZBX_CONFIG "StartProxyPollers" "${ZBX_STARTPROXYPOLLERS}"

    update_config_var $ZBX_CONFIG "ProxyConfigFrequency" "${ZBX_PROXYCONFIGFREQUENCY}"

    update_config_var $ZBX_CONFIG "ProxyDataFrequency" "${ZBX_PROXYDATAFREQUENCY}"


    update_config_var $ZBX_CONFIG "SSLCertLocation" "$ZABBIX_USER_HOME_DIR/ssl/certs/"

    update_config_var $ZBX_CONFIG "SSLKeyLocation" "$ZABBIX_USER_HOME_DIR/ssl/keys/"

    update_config_var $ZBX_CONFIG "SSLCALocation" "$ZABBIX_USER_HOME_DIR/ssl/ssl_ca/"

    update_config_var $ZBX_CONFIG "LoadModulePath" "$ZABBIX_USER_HOME_DIR/modules/"

    update_config_multiple_var $ZBX_CONFIG "LoadModule" "${ZBX_LOADMODULE}"


    update_config_var $ZBX_CONFIG "TLSCAFile" "${ZBX_TLSCAFILE}"

    update_config_var $ZBX_CONFIG "TLSCRLFile" "${ZBX_TLSCRLFILE}"


    update_config_var $ZBX_CONFIG "TLSCertFile" "${ZBX_TLSCERTFILE}"

    update_config_var $ZBX_CONFIG "TLSCipherAll" "${ZBX_TLSCIPHERALL}"

    update_config_var $ZBX_CONFIG "TLSCipherAll13" "${ZBX_TLSCIPHERALL13}"

    update_config_var $ZBX_CONFIG "TLSCipherCert" "${ZBX_TLSCIPHERCERT}"

    update_config_var $ZBX_CONFIG "TLSCipherCert13" "${ZBX_TLSCIPHERCERT13}"

    update_config_var $ZBX_CONFIG "TLSCipherPSK" "${ZBX_TLSCIPHERPSK}"

    update_config_var $ZBX_CONFIG "TLSCipherPSK13" "${ZBX_TLSCIPHERPSK13}"

    update_config_var $ZBX_CONFIG "TLSKeyFile" "${ZBX_TLSKEYFILE}"


    update_config_var $ZBX_CONFIG "TLSPSKIdentity" "${ZBX_TLSPSKIDENTITY}"

    update_config_var $ZBX_CONFIG "TLSPSKFile" "${ZBX_TLSPSKFILE}"


    update_config_var $ZBX_CONFIG "ServiceManagerSyncFrequency" "${ZBX_SERVICEMANAGERSYNCFREQUENCY}"


    if [ "${ZBX_AUTOHANODENAME}" == 'fqdn' ] && [ ! -n "${ZBX_HANODENAME}" ]; then

        update_config_var $ZBX_CONFIG "HANodeName" "$(hostname -f)"

    elif [ "${ZBX_AUTOHANODENAME}" == 'hostname' ] && [ ! -n "${ZBX_HANODENAME}" ]; then

        update_config_var $ZBX_CONFIG "HANodeName" "$(hostname)"

    else

        update_config_var $ZBX_CONFIG "HANodeName" "${ZBX_HANODENAME}"

    fi


    : ${ZBX_NODEADDRESSPORT:="10051"}

    if [ "${ZBX_AUTONODEADDRESS}" == 'fqdn' ] && [ ! -n "${ZBX_NODEADDRESS}" ]; then

        update_config_var $ZBX_CONFIG "NodeAddress" "$(hostname -f):${ZBX_NODEADDRESSPORT}"

    elif [ "${ZBX_AUTONODEADDRESS}" == 'hostname' ] && [ ! -n "${ZBX_NODEADDRESS}" ]; then

        update_config_var $ZBX_CONFIG "NodeAddress" "$(hostname):${ZBX_NODEADDRESSPORT}"

    else

        update_config_var $ZBX_CONFIG "NodeAddress" "${ZBX_NODEADDRESS}"

    fi


    if [ "$(id -u)" != '0' ]; then

        update_config_var $ZBX_CONFIG "User" "$(whoami)"

    else

        update_config_var $ZBX_CONFIG "AllowRoot" "1"

    fi

}

```

请先 登录 后评论
  • 2 关注
  • 0 收藏,2069 浏览
  • 大象 提出于 2024-01-31 11:46

相似问题