Ad Widget

Collapse

Issue with Zabbix connection to DB on Red Hat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfe4086
    Junior Member
    • Jul 2021
    • 10

    #1

    Issue with Zabbix connection to DB on Red Hat

    I am having issues getting my Zabbix server up on my VM running Red Hat. I can get the website up but get the error message that the server is not running. I went and took a look at the /var/log/zabbix and took a look at the server log and was getting the following error:

    569:20210723:115852.136 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)

    I verified the username and password were correct in the .conf and .php files

    I also was getting this error on the GUI:

    fsockopen(): Unable to connect to 127.0.0.1:10051 (Permission denied) [zabbix.php:22 → require_once() → ZBase->run() → ZBase->processRequest() → ZBase->processResponseFinal() → CView->getOutput() → include() → make_status_of_zbx() → get_status() → CZabbixServer->isRunning() → CZabbixServer->request() → CZabbixServer->connect() → fsockopen() in include/classes/server/CZabbixServer.php:577

    I am guessing that is a firewall issue(I will check that a bit later) but is the DB issue related? I am trying to solve one issue at a time and admittedly very rusty on Linux.
  • Glencoe
    Zabbix developer
    • Oct 2019
    • 152

    #2
    569:20210723:115852.136 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
    Double-check if you really specified the password in zabbix_server.conf. Chances that you didn't (e.g. forgot to uncomment DBPassword parameter, mistyped etc)

    Comment

    • Wolfe4086
      Junior Member
      • Jul 2021
      • 10

      #3
      Originally posted by Glencoe
      Double-check if you really specified the password in zabbix_server.conf. Chances that you didn't (e.g. forgot to uncomment DBPassword parameter, mistyped etc)
      I went through all that and ended up doing a reinstall from the ground up for the Red Hat server. Now I am getting this error.

      fsockopen(): Unable to connect to localhost:10051 (Connection refused) [zabbix.php:22 → require_once()

      It seems that that Zabbix install guide has gaps and I am wondering if there is a better install guide than the one here on the site.

      Comment

      • Glencoe
        Zabbix developer
        • Oct 2019
        • 152

        #4
        Originally posted by Wolfe4086
        It seems that that Zabbix install guide has gaps
        It's possible but unlikely, at least not for the typical configurations and requirements.

        1. Can you please post a screenshot with this error.

        2. Is your zabbix_server up and running?

        Comment

        • Wolfe4086
          Junior Member
          • Jul 2021
          • 10

          #5
          Originally posted by Glencoe
          It's possible but unlikely, at least not for the typical configurations and requirements.

          1. Can you please post a screenshot with this error.

          2. Is your zabbix_server up and running?
          Here is the exact error

          fsockopen(): Unable to connect to localhost:10051 (Connection refused) [zabbix.php:22 → require_once() → ZBase->run() → ZBase->processRequest() → ZBase->processResponseFinal() → CView->getOutput() → include() → make_status_of_zbx() → get_status() → CZabbixServer->isRunning() → CZabbixServer->request() → CZabbixServer->connect() → fsockopen() in include/classes/server/CZabbixServer.php:577]

          I did try disabling SELinux(its in a lab environment) and that did not correct the issue. I am checking the server and agent logs and not seeing any issues.

          Here are the agentd and server configurations


          ### Option: DBHost
          # Database host name.
          # If set to localhost, socket is used for MySQL.
          # If set to empty string, socket is used for PostgreSQL.
          # If set to empty string, the Net Service Name connection method is used to connect to Oracle database; also see
          # the TNS_ADMIN environment variable to specify the directory where the tnsnames.ora file is located.
          #
          # Mandatory: no
          # Default:
          DBHost=localhost

          ### Option: DBName
          # Database name.
          # If the Net Service Name connection method is used to connect to Oracle database, specify the service name from
          # the tnsnames.ora file or set to empty string; also see the TWO_TASK environment variable if DBName is set to
          # empty string.
          #
          # Mandatory: yes
          # Default:

          DBName=zabbix

          ### Option: DBSchema
          # Schema name. Used for PostgreSQL.
          #
          # Mandatory: no
          # Default:
          # DBSchema=

          ### Option: DBUser
          # Database user.
          #
          # Mandatory: no
          # Default:
          # DBUser=

          DBUser=zabbix

          ### Option: DBPassword
          # Database password.
          # Comment this line if no password is used.
          #
          # Mandatory: no
          # Default:
          DBPassword=*******

          ### Option: ListenIP
          # List of comma delimited IP addresses that the trapper should listen on.
          # Trapper will listen on all network interfaces if this parameter is missing.
          #
          # Mandatory: no
          # Default:
          ListenIP=192.168.58.137

          Not sure what I am missing to fix what looks to be the final issue.

          Comment

          • Glencoe
            Zabbix developer
            • Oct 2019
            • 152

            #6
            The problem is that you specified the exact listen IP (ListenIP=192.168.58.137) which means that the server doesn't listen on localhost's IP. Whereas your front end connects to localhost.

            That being said, errors like "fsockopen(): Unable to connect..." are usually presented in a more user-friendly way. That's why I asked for a screenshot of this error, not text. To get a better idea of the context. What version do you run?

            Comment

            • Wolfe4086
              Junior Member
              • Jul 2021
              • 10

              #7
              Originally posted by Glencoe
              The problem is that you specified the exact listen IP (ListenIP=192.168.58.137) which means that the server doesn't listen on localhost's IP. Whereas your front end connects to localhost.

              That being said, errors like "fsockopen(): Unable to connect..." are usually presented in a more user-friendly way. That's why I asked for a screenshot of this error, not text. To get a better idea of the context. What version do you run?
              Thanks for the assistance. Changing out that statement worked and now it is up and functioning. Now to start adding the rest of my lab network on for testing.

              Comment

              Working...