mysql.conf 5.5 KB

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