mysql.conf 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. # slow queries
  2. template: mysql_10s_slow_queries
  3. on: mysql.queries
  4. class: Latency
  5. type: Database
  6. component: MySQL
  7. lookup: sum -10s of slow_queries
  8. units: slow queries
  9. every: 10s
  10. warn: $this > (($status >= $WARNING) ? (5) : (10))
  11. crit: $this > (($status == $CRITICAL) ? (10) : (20))
  12. delay: down 5m multiplier 1.5 max 1h
  13. info: number of slow queries in the last 10 seconds
  14. to: dba
  15. # -----------------------------------------------------------------------------
  16. # lock waits
  17. template: mysql_10s_table_locks_immediate
  18. on: mysql.table_locks
  19. class: Utilization
  20. type: Database
  21. component: MySQL
  22. lookup: sum -10s absolute of immediate
  23. units: immediate locks
  24. every: 10s
  25. info: number of table immediate locks in the last 10 seconds
  26. to: dba
  27. template: mysql_10s_table_locks_waited
  28. on: mysql.table_locks
  29. class: Latency
  30. type: Database
  31. component: MySQL
  32. lookup: sum -10s absolute of waited
  33. units: waited locks
  34. every: 10s
  35. info: number of table waited locks in the last 10 seconds
  36. to: dba
  37. template: mysql_10s_waited_locks_ratio
  38. on: mysql.table_locks
  39. class: Latency
  40. type: Database
  41. component: MySQL
  42. calc: ( ($mysql_10s_table_locks_waited + $mysql_10s_table_locks_immediate) > 0 ) ? (($mysql_10s_table_locks_waited * 100) / ($mysql_10s_table_locks_waited + $mysql_10s_table_locks_immediate)) : 0
  43. units: %
  44. every: 10s
  45. warn: $this > (($status >= $WARNING) ? (10) : (25))
  46. crit: $this > (($status == $CRITICAL) ? (25) : (50))
  47. delay: down 30m multiplier 1.5 max 1h
  48. info: ratio of waited table locks over the last 10 seconds
  49. to: dba
  50. # -----------------------------------------------------------------------------
  51. # connections
  52. template: mysql_connections
  53. on: mysql.connections_active
  54. class: Utilization
  55. type: Database
  56. component: MySQL
  57. calc: $active * 100 / $limit
  58. units: %
  59. every: 10s
  60. warn: $this > (($status >= $WARNING) ? (60) : (70))
  61. crit: $this > (($status == $CRITICAL) ? (80) : (90))
  62. delay: down 15m multiplier 1.5 max 1h
  63. info: client connections utilization
  64. to: dba
  65. # -----------------------------------------------------------------------------
  66. # replication
  67. template: mysql_replication
  68. on: mysql.slave_status
  69. class: Errors
  70. type: Database
  71. component: MySQL
  72. calc: ($sql_running <= 0 OR $io_running <= 0)?0:1
  73. units: ok/failed
  74. every: 10s
  75. crit: $this == 0
  76. delay: down 5m multiplier 1.5 max 1h
  77. info: replication status (0: stopped, 1: working)
  78. to: dba
  79. template: mysql_replication_lag
  80. on: mysql.slave_behind
  81. class: Latency
  82. type: Database
  83. component: MySQL
  84. calc: $seconds
  85. units: seconds
  86. every: 10s
  87. warn: $this > (($status >= $WARNING) ? (5) : (10))
  88. crit: $this > (($status == $CRITICAL) ? (10) : (30))
  89. delay: down 15m multiplier 1.5 max 1h
  90. info: difference between the timestamp of the latest transaction processed by the SQL thread and \
  91. the timestamp of the same transaction when it was processed on the master
  92. to: dba
  93. # -----------------------------------------------------------------------------
  94. # galera cluster size
  95. template: mysql_galera_cluster_size_max_2m
  96. on: mysql.galera_cluster_size
  97. class: Utilization
  98. type: Database
  99. component: MySQL
  100. lookup: max -2m at -1m unaligned
  101. units: nodes
  102. every: 10s
  103. info: maximum galera cluster size in the last 2 minutes starting one minute ago
  104. to: dba
  105. template: mysql_galera_cluster_size
  106. on: mysql.galera_cluster_size
  107. class: Utilization
  108. type: Database
  109. component: MySQL
  110. calc: $nodes
  111. units: nodes
  112. every: 10s
  113. warn: $this > $mysql_galera_cluster_size_max_2m
  114. crit: $this < $mysql_galera_cluster_size_max_2m
  115. delay: up 20s down 5m multiplier 1.5 max 1h
  116. info: current galera cluster size, compared to the maximum size in the last 2 minutes
  117. to: dba
  118. # galera node state
  119. template: mysql_galera_cluster_state_warn
  120. on: mysql.galera_cluster_state
  121. class: Errors
  122. type: Database
  123. component: MySQL
  124. calc: $donor + $joined
  125. every: 10s
  126. warn: $this != nan AND $this != 0
  127. delay: up 30s down 5m multiplier 1.5 max 1h
  128. info: galera node state is either Donor/Desynced or Joined.
  129. to: dba
  130. template: mysql_galera_cluster_state_crit
  131. on: mysql.galera_cluster_state
  132. class: Errors
  133. type: Database
  134. component: MySQL
  135. calc: $undefined + $joining + $error
  136. every: 10s
  137. crit: $this != nan AND $this != 0
  138. delay: up 30s down 5m multiplier 1.5 max 1h
  139. info: galera node state is either Undefined or Joining or Error.
  140. to: dba
  141. # galera node status
  142. template: mysql_galera_cluster_status
  143. on: mysql.galera_cluster_status
  144. class: Errors
  145. type: Database
  146. component: MySQL
  147. calc: $primary
  148. every: 10s
  149. crit: $this != nan AND $this != 1
  150. delay: up 30s down 5m multiplier 1.5 max 1h
  151. info: galera node is part of a nonoperational component. \
  152. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations.
  153. to: dba