Run multiple queries to MySQL

I have my mysql.yml file configured to run two separate queries for collecting both processlist details and replication details:

- module: mysql
       - status
       - query
        - query: "SHOW SLAVE STATUS"
          response_format: "table"
          query_namespace: "replication_check"
        - query: "SHOW PROCESSLIST"
          response_format: "table"
          query_namespace: "processlist"

However when I have the 2nd query configured and un-commented, it seems to overtake the first query and I get no results back from the replication_check namespace. Is there a specific way these need to be formatted so they both run at the same time?

Hi @vPilot :slightly_smiling_face:

There's a limitation about the queries you can launch. You need to setup two configs for MySQL (no need of 2 processes).

You can take a look at the example in the SQL module SQL module | Metricbeat Reference [7.16] | Elastic which is what MySQL query metricset uses under the hood.

The docs for MySQL query metricset must be definitely updated.

After some poking and prodding, I was able to get it to work - it turns out that the way the query results were separating was causing some of my headache. So I had to do some additional adjustments when using Explore, as well as for my dashboards, and I was able to get it to work with the configuration I shared above.

Turns out it was mostly a user error :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.