3.1.5 Using the Agent Proxy

There are three different ways of feeding Query Analyzer using the proxy component of the MySQL Enterprise Monitor Agent:

  • Change your MySQL client application to talk to the Proxy port you configured during installation. This requires changing your MySQL client application code, and may require that you stop and restart your MySQL client application, but does not require any changes to the MySQL server. For more information, see Section, “Enabling Query Analyzer by Changing the MySQL Client Application”.

  • Change your MySQL server to listen on a different port, and configure the proxy to listen on the original MySQL server port. This does not require any changes to your MySQL client application, but requires shutting down and restarting the MySQL server, which might affect its cache and cause a temporary performance drop. For more information, see Section, “Enabling Query Analyzer by Changing MySQL Server”.

  • Use IP tables to redirect the network packets to the proxy.

Example 3.1 Routing with Proxy and IP tables on Linux

This example assumes that default ports are used, it's on localhost, the proxy is installed on to the database box itself, and that it will not work on an intermediary server.

Enabling (with -I):

sudo iptables -t nat -I PREROUTING -s ! -p tcp --dport 3306 -j REDIRECT --to-ports 6446

Disabling (with -D):

sudo iptables -t nat -D PREROUTING -s ! -p tcp --dport 3306 -j REDIRECT --to-ports 6446


MySQL Query Analyzer gathers query performance information from a variety of sources. Query Analyzer uses a new agent plug-in to proxy your queries and collect performance data that is then transmitted to the Enterprise Monitor. This is a new role for the Agent: it is no longer just monitoring, it is now optionally between your MySQL client application and the MySQL server.

Depending upon your system load, it is possible to overload the proxy or have the proxy/agent consume system resources needed by mysql itself. In particular, the memory needed by the MySQL Agent for basic monitoring is fairly small and consistent and depends on the number of rules you have enabled. However, when the Query Analyzer is enabled, the Agent can use significantly more memory to monitor and analyze whatever queries you direct through it. In this case, the amount of memory used depends on the number of unique normalized queries, example queries and example EXPLAINs being processed plus the network bandwidth required to send this query performance data to the Service Manager. In general, the amount of memory used for the Query Analyzer is well-bounded, but under heavy load or, in some cases under older versions of linux, RAM usage by Query Analyzer could be too high for your environment and load.

Therefore, we advise you to use this release of Query Analyzer extensively in development, test and stage environments under load for an extended period of time before considering usage in a production environment. For all deployments:

  1. Carefully monitor the Agent's resource consumption using the new graph Memory Usage - Agent graphs available on the Graph tab. You can also add an SMTP or SNMP notification to the new Heat Chart rule MySQL Agent Memory Usage Excessive.

  2. If the amount of memory consumed is too high, consider sampling queries during nonpeak hours or monitoring only a subset of queries on this system.

Note: zone-specific memory usage is not available for 32-bit Solaris operating systems.

If you experience any problems with Query Analyzer, we are interested in working with you closely and quickly to resolve them. Please open a service request right away. We are working hard on optimizing Agent/proxy RAM usage.

Note that you must enable Query Analyzer within the proxy during agent installation. If you did not enable Query Analyzer during the installation of the agent, check the following elements within the main mysql-monitor-agent.ini configuration file:

  • Add the proxy keyword to the plugins parameter. For example:

  • Ensure that the quan.lua items file is enabled in the agent-item-files configuration property:

    agent-item-files = share/mysql-monitor-agent/items/quan.lua,share/mysql-monitor-agent/items/items-mysql-monitor.xml
  • Check and set the proxy-address, proxy-backend-addresses, and proxy-lua-script settings are configured:

    proxy-backend-addresses =
    proxy-lua-script        = share/mysql-monitor-agent/quan.lua

For more information on these configuration options, see Section C.2.1, “MySQL Enterprise Monitor Agent Configurable Options”.

You might also need to make some additional changes to the security configuration on your server to ensure that queries are correctly reported to MySQL Enterprise Service Manager:

  • Check the authorization for each user ID used in the connect strings for MySQL client applications that connect through the proxy. Each such user ID must be allowed to connect to the MySQL server from the host on which the agent is running. When the application connects to the server with the proxy as an intermediary, the client host name is the host name of the system running the agent.


    Because the proxy is providing the immediate connectivity to the MySQL server, authentication must use the proxy hostname, not the client hostname.

    To update your user credentials, use the GRANT statement. For example:

    mysql> GRANT SELECT,UPDATE,INSERT on database.* to 'user'@'localhost' IDENTIFIED BY 'password';
  • The MySQL client application user must have SELECT privileges on the mysql.inventory table. This table contains the server UUID; it is required to report the Query Analyzer data to the MySQL Enterprise Service Manager. Use the GRANT statement. For example:

    mysql> GRANT SELECT on mysql.inventory to 'user'@'localhost' IDENTIFIED BY 'password';

Download this Manual
PDF (US Ltr) - 4.0Mb
PDF (A4) - 4.0Mb
EPUB - 3.2Mb
HTML Download (TGZ) - 3.1Mb
HTML Download (Zip) - 3.1Mb
User Comments
Sign Up Login You must be logged in to post a comment.