Ad Widget

Collapse

Can I connect zabbix_server to MySQL through non standard port?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zabbix_es
    Senior Member
    • Apr 2007
    • 153

    #1

    Can I connect zabbix_server to MySQL through non standard port?

    I want to connect zabbix_server to MySQL database through port 4040 instead of doing through standard socket.

    Can I do it?
    Which parameteres must I configure in zabbix_server.conf?
    I did'n found them.

    Thank you!
  • spoi
    Junior Member
    • Feb 2007
    • 2

    #2
    I don't know the exact solution for your problem but if the mysql Server is running on the same machine as the zabbix server, then socket connection is probebly a posibility

    DBSocket=/tmp/mysql.sock

    Comment

    • Calimero
      Senior Member
      • Nov 2006
      • 481

      #3
      Try this:
      DBHost=192.168.42.42
      DBPort=4040

      That's what the source code is looking for.

      Comment

      • zabbix_es
        Senior Member
        • Apr 2007
        • 153

        #4
        It looks that DBPort does not work.

        The reason because I need to route queries through other port (not socket) is passing them to an external query analyzer.

        I whish to have this possibility ...

        Comment

        • Calimero
          Senior Member
          • Nov 2006
          • 481

          #5
          If I add "DBPort=3308" (instead of 3306) to my zabbix_server.conf file, zabbix_server fails to connect to MySQL. So I think DBPort works.

          Comment

          • zabbix_es
            Senior Member
            • Apr 2007
            • 153

            #6
            It’s strange.
            I am trying MySQL Enterprise Monitor with Query Analyzer and I want to route zabbix queries through port 4040 in order to be monitored by Query Analyzer, but I can’t see any query neither zabbix_server nor zabbix front-end despite I have configured both with this port.


            Nevertheless when I check Query Analyzer from MySQL client, it Works fine.

            I will try to debug better.


            Thank you!

            Comment

            • zabbix_es
              Senior Member
              • Apr 2007
              • 153

              #7
              First, I have tried to put
              DBHost=localhost
              DBPort=4040
              DBSocket=/var/lib/mysql/socket
              (without delete DBSocket) and MySQL Query Analyzer did not retrieve any query.

              Next, I have put
              DBHost=localhost
              DBPort=4040
              DBSocket=

              (blank) and zabbix_server could not connect to database so I suppose that DBSocket has more priority than others parameters.

              After that, I have commented DBSocket parameter and Query Analyzer did not see anything.
              In the end, I have set
              DBHost=192.168.1.32
              DBPort=4040
              And then Query Analyzer began monitoring queries.


              Comment

              • Calimero
                Senior Member
                • Nov 2006
                • 481

                #8
                "localhost" has a special meaning for mysql API.

                It's interpreted as local unix socket.

                If you want to force TCP over loopback you should set it to "127.0.0.1".

                Originally posted by MySQL 5 Reference Manual
                The value of host may be either a host name or an IP address. If host is NULL or the string "localhost", a connection to the local host is assumed. For Windows, the client connects using a shared-memory connection, if the server has shared-memory connections enabled. Otherwise, TCP/IP is used. For Unix, the client connects using a Unix socket file. For local connections, you can also influence the type of connection to use with the MYSQL_OPT_PROTOCOL or MYSQL_OPT_NAMED_PIPE options to mysql_options(). The type of connection must be supported by the server. For a host value of "." on Windows, the client connects using a named pipe, if the server has named-pipe connections enabled. If named-pipe connections are not enabled, an error occurs.
                Last edited by Calimero; 20-02-2009, 15:31.

                Comment

                • fatiha
                  Member
                  • Nov 2007
                  • 78

                  #9
                  Originally posted by Calimero
                  If I add "DBPort=3308" (instead of 3306) to my zabbix_server.conf file, zabbix_server fails to connect to MySQL. So I think DBPort works.
                  Thank you very much, I had the same problem and I found nowhere that variable "DBPort". They shoud add it in Zabbix manual !

                  Comment

                  Working...