Ad Widget

Collapse

Long query time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stelios
    Junior Member
    • Oct 2007
    • 13

    #1

    Long query time

    Hi all,

    I've got in a host that I monitor with latest Zabbix the following among others:

    # Enable the slow query log to see queries with especially long duration
    slow_query_log_file = /var/log/mysql/mariadb-slow.log
    long_query_time = 10
    log_slow_rate_limit = 1000
    log_slow_verbosity = query_plan
    log-queries-not-using-indexes​

    The mariadb-slow.log has no slow queries on it but on Zabbix I do get a warning about "MySQL: Server has slow queries (over 3 for 5m)".
    My question is where to go to edit that trigger in order to increase the long_query_time or whatever is related with it to not have that warning unless there is actually something written under mariadb-slow.log

    Thanks in advance
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1782

    #2
    According to https://git.zabbix.com/projects/ZBX/...db/mysql_agent it should use long_query_time value. Have you enabled slow_query_log? https://mariadb.com/kb/en/slow-query-log-overview/ says:

    The slow query log is disabled by default.
    To enable the slow query log, set the slow_query_log system variable to 1.
    Markku

    Comment

    • stelios
      Junior Member
      • Oct 2007
      • 13

      #3
      Even if I set the variable it doesn't seem that it takes the change. I did also a restart but same results; the variable doesn't change from off (tried with 1 and On under slow_query_log).

      MariaDB [mysql]> SET GLOBAL slow_query_log=1;
      Query OK, 0 rows affected (0.000 sec)

      MariaDB [mysql]> SHOW VARIABLES LIKE 'slow_query_log';
      +----------------+-------+
      | Variable_name | Value |
      +----------------+-------+
      | slow_query_log | OFF |
      +----------------+-------+
      1 row in set (0.001 sec)

      MariaDB [mysql]>​

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1782

        #4
        https://mariadb.com/kb/en/set/#global-session says:

        SHOW VARIABLES will by default return the session value​
        Markku

        Comment

        Working...