Ad Widget

Collapse

The connection to Zabbix server "localhost" failed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CDThibaut
    Junior Member
    • Aug 2020
    • 2

    #1

    The connection to Zabbix server "localhost" failed


    Hello,
    I created a new zabbix server on Zabbix 5, the sql server and the application are on two separate servers. When I log into the web interface, I have the error:

    The connection to Zabbix server "localhost" failed. Possible reasons:
    • 1. Incorrect server IP / DNS in "zabbix.conf.php";
    • 2. Incorrect DNS server configuration.
    • Connection refused

    Zabbix server is running on CentOS 8, SELinux is disabled and the firewall too

    The zabbix server service is running:

    Code:
    zabbix-server.service - Zabbix Server
    Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Mon 2020-08-10 09:57:53 CEST; 7s ago
    Process: 339749 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
    Process: 339830 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
    Main PID: 339832 (zabbix_server)
    Tasks: 1 (limit: 49770)
    Memory: 2.9M
    CGroup: /system.slice/zabbix-server.service
    └─339832 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf

    Here is the content of the zabbix.conf.php :

    PHP Code:
    <?php
    // Zabbix GUI configuration file.

    $DB['TYPE'] = 'MYSQL';
    $DB['SERVER'] = 'bddserver';
    $DB['PORT'] = '3306';
    $DB['DATABASE'] = 'zabbix';
    $DB['USER'] = 'user';
    $DB['PASSWORD'] = 'xxx';

    // Schema name. Used for PostgreSQL.
    $DB['SCHEMA'] = '';

    // Used for TLS connection.
    $DB['ENCRYPTION'] = true;
    $DB['KEY_FILE'] = '';
    $DB['CERT_FILE'] = '';
    $DB['CA_FILE'] = '';
    $DB['VERIFY_HOST'] = true;
    $DB['CIPHER_LIST'] = '';

    // 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'] = true;

    $ZBX_SERVER 'localhost';
    $ZBX_SERVER_PORT '10051';
    $ZBX_SERVER_NAME '';

    $IMAGE_FORMAT_DEFAULT IMAGE_FORMAT_PNG;

    // Uncomment this block only if you are using Elasticsearch.
    // Elasticsearch url (can be string if same url is used for all types).
    //$HISTORY['url'] = [
    // 'uint' => 'http://localhost:9200',
    // 'text' => 'http://localhost:9200'
    //];
    // Value types stored in Elasticsearch.
    //$HISTORY['types'] = ['uint', 'text'];

    // Used for SAML authentication.
    // Uncomment to override the default paths to SP private key, SP and IdP X.509 certificates, and to set extra settings.
    //$SSO['SP_KEY'] = 'conf/certs/sp.key';
    //$SSO['SP_CERT'] = 'conf/certs/sp.crt';
    //$SSO['IDP_CERT'] = 'conf/certs/idp.crt';
    //$SSO['SETTINGS'] = [];

    Does anyone have any idea where the problem is?
  • CaveatL
    Junior Member
    • Jan 2022
    • 2

    #2
    In zabbix.conf.php, the below variable:

    Code:
    $ZBX_SERVER = 'localhost';
    should reference the IP address of the Zabbix Server (not localhost).

    Comment

    • sewet
      Junior Member
      • Mar 2023
      • 1

      #3
      Hello,

      I know this is an old post but how do you save the config file after editing?

      Thanks

      Comment

      Working...