zabbix-docker/Dockerfiles/web-apache-mysql/centos/conf/etc/zabbix/web/zabbix.conf.php

108 lines
3.9 KiB
PHP
Raw Normal View History

2016-08-03 10:09:49 +02:00
<?php
// Zabbix GUI configuration file.
2018-06-01 11:02:20 +02:00
global $DB, $HISTORY;
2016-08-03 10:09:49 +02:00
2020-09-10 14:05:17 +02:00
$DB['TYPE'] = getenv('DB_SERVER_TYPE');
$DB['SERVER'] = getenv('DB_SERVER_HOST');
$DB['PORT'] = getenv('DB_SERVER_PORT');
$DB['DATABASE'] = getenv('DB_SERVER_DBNAME');
2021-11-04 14:42:05 +01:00
$DB['USER'] = (! getenv('VAULT_TOKEN') || ! getenv('ZBX_VAULTURL')) ? getenv('DB_SERVER_USER') : '';
$DB['PASSWORD'] = (! getenv('VAULT_TOKEN') || ! getenv('ZBX_VAULTURL')) ? getenv('DB_SERVER_PASS') : '';
2016-08-03 10:09:49 +02:00
2020-10-08 11:05:12 +02:00
// Schema name. Used for PostgreSQL.
2020-09-10 14:05:17 +02:00
$DB['SCHEMA'] = getenv('DB_SERVER_SCHEMA');
2016-08-03 10:09:49 +02:00
2021-11-17 09:31:10 +01:00
if (getenv('ZBX_SERVER_HOST')) {
$ZBX_SERVER = getenv('ZBX_SERVER_HOST');
$ZBX_SERVER_PORT = getenv('ZBX_SERVER_PORT');
}
2020-09-10 14:05:17 +02:00
$ZBX_SERVER_NAME = getenv('ZBX_SERVER_NAME');
2016-08-03 10:09:49 +02:00
// Used for TLS connection.
$DB['ENCRYPTION'] = getenv('ZBX_DB_ENCRYPTION') == 'true' ? true: false;
$DB['KEY_FILE'] = getenv('ZBX_DB_KEY_FILE');
$DB['CERT_FILE'] = getenv('ZBX_DB_CERT_FILE');
$DB['CA_FILE'] = getenv('ZBX_DB_CA_FILE');
$DB['VERIFY_HOST'] = getenv('ZBX_DB_VERIFY_HOST') == 'true' ? true: false;
$DB['CIPHER_LIST'] = getenv('ZBX_DB_CIPHER_LIST') ? getenv('ZBX_DB_CIPHER_LIST') : '';
2020-10-08 11:05:12 +02:00
// Vault configuration. Used if database credentials are stored in Vault secrets manager.
$DB['VAULT'] = getenv('ZBX_VAULT');
$DB['VAULT_URL'] = getenv('ZBX_VAULTURL');
$DB['VAULT_DB_PATH'] = getenv('ZBX_VAULTDBPATH');
$DB['VAULT_TOKEN'] = getenv('VAULT_TOKEN');
2023-01-22 09:11:51 +01:00
if (file_exists('/etc/zabbix/web/certs/vault.crt')) {
2024-04-26 08:43:18 +02:00
$DB['VAULT_CERT_FILE'] = '/etc/zabbix/web/certs/vault.crt';
}
elseif (file_exists(getenv('ZBX_VAULTCERTFILE'))) {
$DB['VAULT_CERT_FILE'] = getenv('ZBX_VAULTCERTFILE');
}
else {
$DB['VAULT_CERT_FILE'] = '';
}
if (file_exists('/etc/zabbix/web/certs/vault.key')) {
$DB['VAULT_KEY_FILE'] = '/etc/zabbix/web/certs/vault.key';
}
elseif (file_exists(getenv('ZBX_VAULTKEYFILE'))) {
$DB['VAULT_KEY_FILE'] = getenv('ZBX_VAULTKEYFILE');
}
else {
$DB['VAULT_KEY_FILE'] = '';
}
$DB['VAULT_CACHE'] = getenv('ZBX_VAULTCACHE') == 'true' ? true: false;
2020-10-08 11:05:12 +02:00
// Use IEEE754 compatible value range for 64-bit Numeric (float) history values.
// This option is enabled by default for new Zabbix installations.
// For upgraded installations, please read database upgrade notes before enabling this option.
$DB['DOUBLE_IEEE754'] = getenv('DB_DOUBLE_IEEE754') == 'true' ? true: false;
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
2018-06-01 11:02:20 +02:00
// Elasticsearch url (can be string if same url is used for all types).
2020-09-11 09:39:21 +02:00
$history_url = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGEURL'));
2020-09-12 14:15:07 +02:00
$HISTORY['url'] = (json_decode($history_url)) ? json_decode($history_url, true) : $history_url;
2018-06-01 11:02:20 +02:00
// Value types stored in Elasticsearch.
2020-09-11 09:39:21 +02:00
$storage_types = str_replace("'","\"",getenv('ZBX_HISTORYSTORAGETYPES'));
2020-09-12 14:15:07 +02:00
$HISTORY['types'] = (json_decode($storage_types)) ? json_decode($storage_types, true) : array();
2020-09-11 09:39:21 +02:00
// Used for SAML authentication.
if (file_exists('/etc/zabbix/web/certs/sp.key')) {
$SSO['SP_KEY'] = '/etc/zabbix/web/certs/sp.key';
}
elseif (file_exists(getenv('ZBX_SSO_SP_KEY'))) {
$SSO['SP_KEY'] = getenv('ZBX_SSO_SP_KEY');
}
else {
$SSO['SP_KEY'] = '';
}
if (file_exists('/etc/zabbix/web/certs/sp.crt')) {
$SSO['SP_CERT'] = '/etc/zabbix/web/certs/sp.crt';
}
elseif (file_exists(getenv('ZBX_SSO_SP_CERT'))) {
$SSO['SP_CERT'] = getenv('ZBX_SSO_SP_CERT');
}
else {
$SSO['SP_CERT'] = '';
}
if (file_exists('/etc/zabbix/web/certs/idp.crt')) {
$SSO['IDP_CERT'] = '/etc/zabbix/web/certs/idp.crt';
}
elseif (file_exists(getenv('ZBX_SSO_IDP_CERT'))) {
$SSO['IDP_CERT'] = getenv('ZBX_SSO_IDP_CERT');
}
else {
$SSO['IDP_CERT'] = '';
}
2020-09-11 09:39:21 +02:00
$sso_settings = str_replace("'","\"",getenv('ZBX_SSO_SETTINGS'));
$SSO['SETTINGS'] = (json_decode($sso_settings)) ? json_decode($sso_settings, true) : array();
$ALLOW_HTTP_AUTH = getenv('ZBX_ALLOW_HTTP_AUTH') == 'true' ? true: false;