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