master
yaml 1,331 lines 57 KB
Raw
1 plugin_name: go.d.plugin
2 modules:
3 - &module
4 meta: &meta
5 id: collector-go.d.plugin-mysql
6 plugin_name: go.d.plugin
7 module_name: mysql
8 monitored_instance:
9 name: MySQL
10 link: https://www.mysql.com/
11 categories:
12 - data-collection.databases
13 icon_filename: mysql.svg
14 related_resources:
15 integrations:
16 list:
17 - plugin_name: apps.plugin
18 module_name: apps
19 - plugin_name: cgroups.plugin
20 module_name: /sys/fs/cgroup
21 monitored_instance_name: Containers
22 info_provided_to_referring_integrations:
23 description: ""
24 keywords:
25 - "db"
26 - "database"
27 - "mysql"
28 - "maria"
29 - "mariadb"
30 - "sql"
31 overview:
32 multi_instance: true
33 data_collection:
34 metrics_description: |
35 This collector monitors the health and performance of MySQL servers and collects general statistics, replication and user metrics.
36 method_description: |
37 It connects to the MySQL instance via a TCP or UNIX socket and executes the following commands:
38
39 Executed queries:
40
41 - `SELECT VERSION();`
42 - `SHOW GLOBAL STATUS;`
43 - `SHOW ENGINE INNODB STATUS;`
44 - `SHOW GLOBAL VARIABLES;`
45 - `SHOW SLAVE STATUS;` or `SHOW ALL SLAVES STATUS;` (MariaDBv10.2+) or `SHOW REPLICA STATUS;` (MySQL 8.0.22+)
46 - `SHOW USER_STATISTICS;` (MariaDBv10.1.1+)
47 - `SELECT TIME,USER FROM INFORMATION_SCHEMA.PROCESSLIST;`
48 default_behavior:
49 auto_detection:
50 description: |
51 By default, it detects instances running on localhost by trying to connect as root and netdata using known MySQL TCP sockets:
52
53 - 127.0.0.1:3306
54 - "[::1]:3306"
55 limits:
56 description: ""
57 performance_impact:
58 description: ""
59 additional_permissions:
60 description: ""
61 supported_platforms:
62 include: []
63 exclude: []
64 setup:
65 prerequisites:
66 list:
67 - title: Create netdata user
68 description: |
69 A user account should have the following [permissions](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html):
70
71 - [`USAGE`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_usage)
72 - [`REPLICATION CLIENT`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_replication-client)
73 - [`PROCESS`](https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#priv_process)
74
75 To create the `netdata` user with these permissions, execute the following in the MySQL shell:
76
77 - **MySQL and MariaDB < 10.5.9**
78
79 ```mysql
80 CREATE USER 'netdata'@'localhost';
81 GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost';
82 FLUSH PRIVILEGES;
83 ```
84
85 - **MariaDB >= 10.5.9**
86
87 For MariaDB 10.5.9 and later, use the `SLAVE MONITOR` privilege instead of `REPLICATION CLIENT`:
88
89 ```mysql
90 CREATE USER 'netdata'@'localhost';
91 GRANT USAGE, SLAVE MONITOR, PROCESS ON *.* TO 'netdata'@'localhost';
92 FLUSH PRIVILEGES;
93 ```
94
95 The `netdata` user will have the ability to connect to the MySQL server on localhost without a password.
96 It will only be able to gather statistics without being able to alter or affect operations in any way.
97 - title: Enable User Statistics (optional)
98 description: |
99 To collect per-user statistics, the [User Statistics](https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/query-optimizations/statistics-for-optimizing-queries/user-statistics) plugin must be enabled.
100 This is available for **MariaDB** and **Percona**, not for MySQL.
101
102 By default, statistics are not collected. To enable the plugin, set the `userstat` system variable.
103
104 - **In a configuration file** (persistent, requires restart):
105
106 ```ini
107 [mariadb]
108 userstat = 1
109 ```
110
111 - **Dynamically** (takes effect immediately, does not persist across restarts):
112
113 ```mysql
114 SET GLOBAL userstat=1;
115 ```
116 configuration:
117 file:
118 name: go.d/mysql.conf
119 options:
120 description: |
121 The following options can be defined globally: update_every, autodetection_retry.
122 folding:
123 title: Config options
124 enabled: true
125 list:
126 - name: update_every
127 description: Data collection interval (seconds).
128 default_value: 5
129 required: false
130 group: Collection
131 - name: autodetection_retry
132 description: Autodetection retry interval (seconds). Set 0 to disable.
133 default_value: 0
134 required: false
135 group: Collection
136
137 - name: dsn
138 description: "MySQL server DSN (Data Source Name). See [DSN syntax](https://github.com/go-sql-driver/mysql#dsn-data-source-name)."
139 default_value: root@tcp(localhost:3306)/
140 required: true
141 group: Target
142 - name: my.cnf
143 description: Path to a `my.cnf` file to read connection settings from the `[client]` section.
144 default_value: ""
145 required: false
146 group: Target
147 - name: timeout
148 description: Query timeout (seconds).
149 default_value: 1
150 required: false
151 group: Target
152
153 - name: functions.top_queries.disabled
154 description: Disable the [top-queries](#top-queries) function.
155 default_value: false
156 required: false
157 group: Functions
158 - name: functions.top_queries.timeout
159 description: Query timeout (seconds). Uses collector timeout if not set.
160 default_value: ""
161 required: false
162 group: Functions
163 - name: functions.top_queries.limit
164 description: Maximum number of queries to return.
165 default_value: 500
166 required: false
167 group: Functions
168
169 - name: functions.deadlock_info.disabled
170 description: Disable the [deadlock-info](#deadlock-info) function.
171 default_value: false
172 required: false
173 group: Functions
174 - name: functions.deadlock_info.timeout
175 description: Query timeout (seconds). Uses collector timeout if not set.
176 default_value: ""
177 required: false
178 group: Functions
179
180 - name: functions.error_info.disabled
181 description: Disable the [error-info](#error-info) function.
182 default_value: false
183 required: false
184 group: Functions
185 - name: functions.error_info.timeout
186 description: Query timeout (seconds). Uses collector timeout if not set.
187 default_value: ""
188 required: false
189 group: Functions
190
191 - name: vnode
192 description: Associates this data collection job with a [Virtual Node](https://learn.netdata.cloud/docs/netdata-agent/configuration/organize-systems-metrics-and-alerts#virtual-nodes).
193 default_value: ""
194 required: false
195 group: Virtual Node
196 examples:
197 folding:
198 title: Config
199 enabled: true
200 list:
201 - name: TCP socket
202 description: An example configuration.
203 config: |
204 jobs:
205 - name: local
206 dsn: netdata@tcp(127.0.0.1:3306)/
207 - name: Unix socket
208 description: An example configuration.
209 config: |
210 jobs:
211 - name: local
212 dsn: netdata@unix(/var/lib/mysql/mysql.sock)/
213 - name: Connection with password
214 description: An example configuration.
215 config: |
216 jobs:
217 - name: local
218 dsn: netconfig:password@tcp(127.0.0.1:3306)/
219 - name: my.cnf
220 description: An example configuration.
221 config: |
222 jobs:
223 - name: local
224 my.cnf: '/etc/my.cnf'
225 - name: Multi-instance
226 description: |
227 > **Note**: When you define multiple jobs, their names must be unique.
228
229 Local and remote instances.
230 config: |
231 jobs:
232 - name: local
233 dsn: netdata@tcp(127.0.0.1:3306)/
234
235 - name: remote
236 dsn: netconfig:password@tcp(203.0.113.0:3306)/
237 troubleshooting:
238 problems:
239 list: []
240 alerts:
241 - name: mysql_10s_slow_queries
242 metric: mysql.queries
243 info: number of slow queries in the last 10 seconds
244 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
245 - name: mysql_10s_table_locks_immediate
246 metric: mysql.table_locks
247 info: number of table immediate locks in the last 10 seconds
248 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
249 - name: mysql_10s_table_locks_waited
250 metric: mysql.table_locks
251 info: number of table waited locks in the last 10 seconds
252 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
253 - name: mysql_10s_waited_locks_ratio
254 metric: mysql.table_locks
255 info: ratio of waited table locks over the last 10 seconds
256 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
257 - name: mysql_connections
258 metric: mysql.connections_active
259 info: client connections utilization
260 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
261 - name: mysql_replication
262 metric: mysql.slave_status
263 info: "replication status (0: stopped, 1: working)"
264 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
265 - name: mysql_replication_lag
266 metric: mysql.slave_behind
267 info: difference between the timestamp of the latest transaction processed by the SQL thread and the timestamp of the same transaction when it was processed on the master
268 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
269 - name: mysql_galera_cluster_size_max_2m
270 metric: mysql.galera_cluster_size
271 info: maximum galera cluster size in the last 2 minutes starting one minute ago
272 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
273 - name: mysql_galera_cluster_size
274 metric: mysql.galera_cluster_size
275 info: current galera cluster size, compared to the maximum size in the last 2 minutes
276 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
277 - name: mysql_galera_cluster_state_warn
278 metric: mysql.galera_cluster_state
279 info: galera node state is either Donor/Desynced or Joined
280 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
281 - name: mysql_galera_cluster_state_crit
282 metric: mysql.galera_cluster_state
283 info: galera node state is either Undefined or Joining or Error
284 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
285 - name: mysql_galera_cluster_status
286 metric: mysql.galera_cluster_status
287 info: galera node is part of a nonoperational component. This occurs in cases of multiple membership changes that result in a loss of Quorum or in cases of split-brain situations.
288 link: https://github.com/netdata/netdata/blob/master/src/health/health.d/mysql.conf
289 functions:
290 description: |
291 This collector exposes real-time functions for interactive troubleshooting in the Live tab.
292 list:
293 - id: top-queries
294 name: Top Queries
295 description: |
296 Retrieves aggregated SQL query performance metrics from MySQL [performance_schema.events_statements_summary_by_digest](https://dev.mysql.com/doc/refman/8.4/en/performance-schema-statement-summary-tables.html) table.
297
298 This function queries the `events_statements_summary_by_digest` table which contains aggregated statistics for SQL statements grouped by their digest (normalized query pattern). The function dynamically detects available columns based on your MySQL/MariaDB version.
299
300 Use cases:
301 - Identify slow queries that consume the most execution time
302 - Find frequently executed queries that may benefit from optimization
303 - Detect queries with high lock time, errors, or table scans
304
305 Query text is truncated at 4096 characters for display purposes.
306 parameters:
307 - id: __sort
308 name: Filter By
309 description: Select the primary sort column. The available options depend on your MySQL/MariaDB version and include metrics like total execution time, number of calls, lock time, errors, rows examined, and more. Defaults to total execution time.
310 type: select
311 required: true
312 default: totalTime
313 options: []
314 returns:
315 description: Aggregated statement statistics from Performance Schema, grouped by query digest. Each row represents a unique query pattern with cumulative metrics across all executions.
316 columns:
317 - name: Digest
318 type: string
319 unit: ""
320 visibility: hidden
321 description: "Unique hash identifier for the normalized query pattern. Queries with the same structure (different literal values) share the same digest."
322 - name: Query
323 type: string
324 unit: ""
325 description: "Normalized SQL query text with literals replaced by placeholders (e.g., '?' for values). Truncated to 4096 characters."
326 - name: Schema
327 type: string
328 unit: ""
329 description: "Database schema name where the query was executed. Empty string for queries without a schema context."
330 - name: Calls
331 type: integer
332 unit: ""
333 description: "Total number of times this query pattern has been executed since server startup or since the digest table was last truncated."
334 - name: Total Time
335 type: duration
336 unit: "milliseconds"
337 description: "Cumulative execution time across all executions. High values indicate queries that consume significant server resources."
338 - name: Min Time
339 type: duration
340 unit: "milliseconds"
341 visibility: hidden
342 description: "Minimum execution time observed for a single execution. Helps identify variability in query performance."
343 - name: Avg Time
344 type: duration
345 unit: "milliseconds"
346 description: "Average execution time (total time divided by calls). Use this to compare performance across different query patterns."
347 - name: Max Time
348 type: duration
349 unit: "milliseconds"
350 visibility: hidden
351 description: "Maximum execution time observed for a single execution. Large gaps between min and max may indicate performance instability."
352 - name: Lock Time
353 type: duration
354 unit: "milliseconds"
355 description: "Total time spent waiting for table locks across all executions. High lock time may indicate contention from concurrent transactions."
356 - name: Errors
357 type: integer
358 unit: ""
359 description: "Total number of times this query pattern resulted in an error. Non-zero values require investigation into the underlying issue."
360 - name: Warnings
361 type: integer
362 unit: ""
363 description: "Total number of times this query pattern generated warnings. Warnings may indicate data type conversions, NULL handling issues, or other non-critical problems."
364 - name: Error Attribution
365 type: string
366 unit: ""
367 description: "Status of error detail attribution for this query. Values: enabled (error details available), no_data (no recent error for this digest), not_enabled (statement history consumers disabled), not_supported (required columns unavailable)."
368 - name: Error Number
369 type: integer
370 unit: ""
371 description: "Most recent error number observed for this query digest (when error attribution is enabled)."
372 - name: SQL State
373 type: string
374 unit: ""
375 visibility: hidden
376 description: "SQLSTATE code for the most recent error (when error attribution is enabled)."
377 - name: Error Message
378 type: string
379 unit: ""
380 description: "Most recent error message for this query digest (when error attribution is enabled)."
381 - name: Rows Affected
382 type: integer
383 unit: ""
384 description: "Total number of rows modified by INSERT, UPDATE, DELETE, or REPLACE statements. Useful for tracking write workloads."
385 - name: Rows Sent
386 type: integer
387 unit: ""
388 description: "Total number of rows returned to the client by SELECT statements. High values may indicate result sets that are too large."
389 - name: Rows Examined
390 type: integer
391 unit: ""
392 description: "Total number of rows read during query execution. A high ratio of rows examined to rows sent suggests missing or inefficient indexes."
393 - name: Temp Disk Tables
394 type: integer
395 unit: ""
396 description: "Total number of temporary tables created on disk across all executions. Disk-based temporary tables are significantly slower than in-memory tables and may indicate memory pressure or complex operations requiring sorting/grouping."
397 - name: Temp Tables
398 type: integer
399 unit: ""
400 description: "Total number of temporary tables created (both in-memory and on-disk). High values suggest frequent sorting, grouping, or DISTINCT operations."
401 - name: Full Joins
402 type: integer
403 unit: ""
404 description: "Total number of joins that performed a full table scan without using an index. These are typically very expensive operations that should be optimized."
405 - name: Full Range Joins
406 type: integer
407 unit: ""
408 visibility: hidden
409 description: "Total number of joins that used a range scan on the first table. Less efficient than indexed joins but better than full scans."
410 - name: Select Range
411 type: integer
412 unit: ""
413 visibility: hidden
414 description: "Total number of joins that used a range on the first table for row selection."
415 - name: Select Range Check
416 type: integer
417 unit: ""
418 visibility: hidden
419 description: "Total number of joins that checked each row after scanning for key ranges. Very inefficient operation."
420 - name: Select Scan
421 type: integer
422 unit: ""
423 description: "Total number of joins that performed a full scan of the first table. Indicates missing indexes or suboptimal join order."
424 - name: Sort Merge Passes
425 type: integer
426 unit: ""
427 visibility: hidden
428 description: "Total number of merge passes performed during sort operations. More passes indicate larger datasets that exceed sort buffer size."
429 - name: Sort Range
430 type: integer
431 unit: ""
432 visibility: hidden
433 description: "Total number of sorts that used a range scan."
434 - name: Sort Rows
435 type: integer
436 unit: ""
437 description: "Total number of rows sorted across all executions. High values indicate frequent sorting operations on large datasets."
438 - name: Sort Scan
439 type: integer
440 unit: ""
441 visibility: hidden
442 description: "Total number of sorts that required a full table scan."
443 - name: No Index Used
444 type: integer
445 unit: ""
446 description: "Total number of executions where no index was used for table access. These queries are prime candidates for index optimization."
447 - name: No Good Index Used
448 type: integer
449 unit: ""
450 visibility: hidden
451 description: "Total number of executions where a non-optimal index was used. Indicates that while an index exists, a better one might improve performance."
452 - name: First Seen
453 type: string
454 unit: ""
455 visibility: hidden
456 description: "Timestamp when this query pattern was first observed. Helps identify new queries that may have been introduced by application changes."
457 - name: Last Seen
458 type: string
459 unit: ""
460 visibility: hidden
461 description: "Timestamp when this query pattern was last executed. Can help identify stale queries that are no longer in use."
462 - name: P95 Time
463 type: duration
464 unit: "milliseconds"
465 description: "95th percentile execution time. 95% of executions completed within this time. Available in MySQL 8.0+. Useful for understanding typical performance."
466 - name: P99 Time
467 type: duration
468 unit: "milliseconds"
469 description: "99th percentile execution time. 99% of executions completed within this time. Available in MySQL 8.0+. Helps identify outlier slow executions."
470 - name: P99.9 Time
471 type: duration
472 unit: "milliseconds"
473 visibility: hidden
474 description: "99.9th percentile execution time. Available in MySQL 8.0+. Identifies extreme outliers in query performance."
475 - name: Sample Query
476 type: string
477 unit: ""
478 visibility: hidden
479 description: "Example of an actual query execution with literal values preserved. Available in MySQL 8.0+. Helpful for understanding the exact queries being executed."
480 - name: Sample Seen
481 type: string
482 unit: ""
483 visibility: hidden
484 description: "Timestamp when the sample query was captured. Available in MySQL 8.0+."
485 - name: Sample Time
486 type: duration
487 unit: "milliseconds"
488 visibility: hidden
489 description: "Execution time of the captured sample query. Available in MySQL 8.0+."
490 - name: CPU Time
491 type: duration
492 unit: "milliseconds"
493 description: "Total CPU time consumed across all executions. Available in MySQL 8.0.28+. Helps identify CPU-intensive queries."
494 - name: Max Controlled Memory
495 type: integer
496 unit: ""
497 description: "Maximum memory controlled by the query executor for this query pattern. Available in MySQL 8.0.31+. Helps identify memory-intensive operations."
498 - name: Max Total Memory
499 type: integer
500 unit: ""
501 description: "Maximum total memory used by this query pattern including both controlled and uncontrolled allocations. Available in MySQL 8.0.31+."
502 performance: |
503 Queries the `events_statements_summary_by_digest` table:<br/>• On busy servers with high query throughput, the digest table can grow large<br/>• Default limit of 500 rows balances usefulness with performance
504 security: |
505 Query text may contain unmasked literal values including potentially sensitive data:<br/>• Personal information in WHERE clauses or INSERT values<br/>• Business data and internal identifiers<br/>• Access should be restricted to authorized personnel only
506 prerequisites:
507 list:
508 - title: Enable performance_schema statement digest collection
509 description: |
510 Performance Schema must be enabled and statement instrumentation must be configured to collect digest statistics.
511
512 1. Check if Performance Schema is enabled:
513 ```sql
514 SELECT @@performance_schema;
515 ```
516
517 2. Check statement instrumentation configuration:
518 ```sql
519 SELECT * FROM performance_schema.setup_consumers
520 WHERE NAME LIKE '%statement%';
521 ```
522
523 3. The following consumer should be enabled:
524 - `events_statements_summary_by_digest`
525
526 4. Enable statement consumers if needed:
527 ```sql
528 UPDATE performance_schema.setup_consumers
529 SET ENABLED = 'YES'
530 WHERE NAME LIKE 'events_statements%';
531 ```
532
533 :::info
534
535 - Changes to `setup_consumers` take effect immediately without requiring a server restart.
536 - MariaDB also supports the `events_statements_summary_by_digest` table. Exact consumer names may vary by MariaDB version, so checking `setup_consumers` first as shown above is recommended.
537
538 :::
539
540 5. Verify digest table contains data:
541 ```sql
542 SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
543 ```
544
545 Note: Statement digest data is accumulated since server startup or since the table was last truncated. To reset statistics:
546 ```sql
547 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
548 ```
549
550 Ensure that statement instruments are enabled in the Performance Schema so that statement digest statistics are collected. Refer to your MySQL or MariaDB version documentation for the appropriate configuration options.
551 - title: Grant SELECT permission on Performance Schema tables
552 description: |
553 The netdata user must have SELECT permission on Performance Schema tables. The standard collector permissions
554 (USAGE, REPLICATION CLIENT, PROCESS) do not automatically include Performance Schema access.
555
556 1. Grant the required permission:
557 ```sql
558 GRANT SELECT ON performance_schema.* TO 'netdata'@'localhost';
559 FLUSH PRIVILEGES;
560 ```
561
562 :::info
563
564 The host part (`'localhost'`) should match how the netdata user connects. If connecting via TCP/IP, you may need `'netdata'@'%'` or a specific IP address instead.
565
566 :::
567
568 2. Verify access:
569 ```sql
570 -- As the netdata user:
571 SELECT COUNT(*) FROM performance_schema.events_statements_summary_by_digest;
572 ```
573 availability: |
574 Available when:<br/>• The collector has successfully connected to MySQL<br/>• Performance Schema is enabled with statement digest collection<br/>• Returns HTTP 503 if collector is still initializing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out
575 require_cloud: true
576 - id: deadlock-info
577 name: Deadlock Info
578 description: |
579 Retrieves the latest detected InnoDB deadlock from `SHOW ENGINE INNODB STATUS`.
580
581 The output is parsed to attribute the deadlock to the participating transactions and their query text, lock mode, lock status, and wait resource.
582
583 Use cases:
584 - Identify which query was chosen as the deadlock victim
585 - Inspect the waiting lock resource and lock mode
586 - Correlate deadlocks with application changes or deployment events
587
588 Query text is truncated at 4096 characters for display purposes.
589 parameters: []
590 returns:
591 description: Parsed deadlock participants from the latest detected deadlock. Each row represents one transaction involved in the deadlock.
592 columns:
593 - name: Row ID
594 type: string
595 unit: ""
596 visibility: hidden
597 description: "Unique row identifier composed of deadlock ID and process ID."
598 - name: Deadlock ID
599 type: string
600 unit: ""
601 description: "Identifier for the deadlock event, used to group participating transactions."
602 - name: Timestamp
603 type: timestamp
604 unit: ""
605 description: "Timestamp of the deadlock event. Parsed from the deadlock section when available; otherwise the function execution time."
606 - name: Process ID
607 type: string
608 unit: ""
609 description: "MySQL thread id of the transaction involved in the deadlock."
610 - name: Connection ID
611 type: integer
612 unit: ""
613 description: "Numeric connection identifier when the process id is numeric."
614 - name: ECID
615 type: integer
616 unit: ""
617 description: "Execution context id (engine-specific). This is typically null for MySQL and reserved for cross-engine consistency."
618 - name: Victim
619 type: string
620 unit: ""
621 description: "\"true\" when the transaction was chosen as the deadlock victim and rolled back; otherwise \"false\"."
622 - name: Query
623 type: string
624 unit: ""
625 description: "SQL query text for the transaction involved in the deadlock. Truncated to 4096 characters."
626 - name: Lock Mode
627 type: string
628 unit: ""
629 description: "Lock mode reported for the waiting lock (for example X or S)."
630 - name: Lock Status
631 type: string
632 unit: ""
633 description: "Lock status for the transaction. WAITING indicates the transaction was waiting on a lock."
634 - name: Wait Resource
635 type: string
636 unit: ""
637 description: "Lock resource line from InnoDB status showing what the transaction was waiting on."
638 - name: Database
639 type: string
640 unit: ""
641 description: "Database name when it can be inferred. This may be empty or null depending on the deadlock output."
642 performance: |
643 Executes `SHOW ENGINE INNODB STATUS` on demand:<br/>• Not part of regular collection<br/>• Query cost depends on server load and the size of the InnoDB status output
644 security: |
645 Query text and wait resource strings may include unmasked literal values including sensitive data (PII/secrets):<br/>• SQL literals such as emails, IDs, or tokens<br/>• Schema and table names that may be sensitive in some environments<br/>• Restrict dashboard access to authorized personnel only
646 prerequisites:
647 list:
648 - title: Enable deadlock-info function in Netdata
649 description: |
650 Set `deadlock_info_function_enabled: true` in the `go.d/mysql.conf` job.
651 - title: Grant PROCESS privilege
652 description: |
653 The monitoring user must have PROCESS privilege to run `SHOW ENGINE INNODB STATUS`.
654 availability: |
655 Available when:<br/>• The collector has successfully connected to MySQL<br/>• `deadlock_info_function_enabled` is true<br/>• The account can run `SHOW ENGINE INNODB STATUS` (PROCESS privilege)<br/>• Returns HTTP 200 with empty data when no deadlock is found<br/>• Returns HTTP 403 when PROCESS privilege is missing<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out<br/>• Returns HTTP 561 when the deadlock section cannot be parsed<br/>• Returns HTTP 503 if the collector is still initializing or the function is disabled
656 require_cloud: true
657 - id: error-info
658 name: Error Info
659 description: |
660 Retrieves recent SQL errors from Performance Schema statement history tables.
661
662 This function reads `performance_schema.events_statements_history_long` when enabled,
663 otherwise falls back to `performance_schema.events_statements_history`. It reports the
664 most recent error per query digest, including error number, SQLSTATE, and message.
665
666 Use cases:
667 - Identify recent query errors and their messages
668 - Correlate errors to query patterns (digest)
669 - Validate error rates seen in top-queries
670
671 Error messages are truncated by Performance Schema (usually 128 characters).
672 parameters: []
673 returns:
674 description: Most recent error per query digest from Performance Schema history tables.
675 columns:
676 - name: Digest
677 type: string
678 unit: ""
679 visibility: hidden
680 description: "Unique hash identifier for the normalized query pattern."
681 - name: Query
682 type: string
683 unit: ""
684 description: "Normalized query text when available (digest text or SQL text)."
685 - name: Schema
686 type: string
687 unit: ""
688 description: "Database schema name when available."
689 - name: Error Number
690 type: integer
691 unit: ""
692 description: "MySQL error number for the most recent error of this digest."
693 - name: SQL State
694 type: string
695 unit: ""
696 description: "SQLSTATE code for the most recent error."
697 - name: Error Message
698 type: string
699 unit: ""
700 description: "Error message for the most recent error."
701 performance: |
702 Reads Performance Schema statement history tables on demand:<br/>• Not part of regular collection<br/>• Query cost depends on history table size and server load
703 security: |
704 Error messages and query text may include unmasked literals (PII/secrets).<br/>• Restrict dashboard access to authorized personnel only
705 prerequisites:
706 list:
707 - title: Enable error-info function in Netdata
708 description: |
709 Set `error_info_function_enabled: true` in the `go.d/mysql.conf` job.
710 - title: Enable statement history consumers
711 description: |
712 Ensure `events_statements_history` and/or `events_statements_history_long` consumers are enabled.
713 - title: Grant SELECT on Performance Schema
714 description: |
715 The monitoring user must have SELECT on `performance_schema.*` to read statement history tables.
716 availability: |
717 Available when:<br/>• The collector has successfully connected to MySQL<br/>• `error_info_function_enabled` is true<br/>• Performance Schema statement history consumers are enabled (history and/or history_long)<br/>• Returns HTTP 200 with empty data when no errors are found<br/>• Returns HTTP 503 when required consumers are not enabled or function disabled<br/>• Returns HTTP 500 if the query fails<br/>• Returns HTTP 504 if the query times out
718 require_cloud: true
719 metrics:
720 folding:
721 title: Metrics
722 enabled: false
723 description: ""
724 availability:
725 - MySQL
726 - MariaDB
727 - Percona
728 scopes:
729 - name: global
730 description: These metrics refer to the entire monitored application.
731 labels: []
732 metrics:
733 - name: mysql.net
734 description: Bandwidth
735 unit: kilobits/s
736 chart_type: area
737 dimensions:
738 - name: in
739 - name: out
740 - name: mysql.queries
741 description: Queries
742 unit: queries/s
743 chart_type: line
744 dimensions:
745 - name: queries
746 - name: questions
747 - name: slow_queries
748 - name: mysql.queries_type
749 description: Queries By Type
750 unit: queries/s
751 chart_type: stacked
752 dimensions:
753 - name: select
754 - name: delete
755 - name: update
756 - name: insert
757 - name: replace
758 - name: mysql.handlers
759 description: Handlers
760 unit: handlers/s
761 chart_type: line
762 dimensions:
763 - name: commit
764 - name: delete
765 - name: prepare
766 - name: read_first
767 - name: read_key
768 - name: read_next
769 - name: read_prev
770 - name: read_rnd
771 - name: read_rnd_next
772 - name: rollback
773 - name: savepoint
774 - name: savepointrollback
775 - name: update
776 - name: write
777 - name: mysql.table_open_cache_overflows
778 description: Table open cache overflows
779 unit: overflows/s
780 chart_type: line
781 dimensions:
782 - name: open_cache
783 - name: mysql.table_locks
784 description: Table Locks
785 unit: locks/s
786 chart_type: line
787 dimensions:
788 - name: immediate
789 - name: waited
790 - name: mysql.join_issues
791 description: Table Select Join Issues
792 unit: joins/s
793 chart_type: line
794 dimensions:
795 - name: full_join
796 - name: full_range_join
797 - name: range
798 - name: range_check
799 - name: scan
800 - name: mysql.sort_issues
801 description: Table Sort Issues
802 unit: issues/s
803 chart_type: line
804 dimensions:
805 - name: merge_passes
806 - name: range
807 - name: scan
808 - name: mysql.tmp
809 description: Tmp Operations
810 unit: events/s
811 chart_type: line
812 dimensions:
813 - name: disk_tables
814 - name: files
815 - name: tables
816 - name: mysql.connections
817 description: Connections
818 unit: connections/s
819 chart_type: line
820 dimensions:
821 - name: all
822 - name: aborted
823 - name: mysql.connections_active
824 description: Active Connections
825 unit: connections
826 chart_type: line
827 dimensions:
828 - name: active
829 - name: limit
830 - name: max_active
831 - name: mysql.threads
832 description: Threads
833 unit: threads
834 chart_type: line
835 dimensions:
836 - name: connected
837 - name: cached
838 - name: running
839 - name: mysql.threads_created
840 description: Threads Creation Rate
841 unit: threads/s
842 chart_type: line
843 dimensions:
844 - name: created
845 - name: mysql.thread_cache_misses
846 description: Threads Cache Misses
847 unit: misses
848 chart_type: line
849 dimensions:
850 - name: misses
851 - name: mysql.innodb_io
852 description: InnoDB I/O Bandwidth
853 unit: KiB/s
854 chart_type: line
855 dimensions:
856 - name: read
857 - name: write
858 - name: mysql.innodb_io_ops
859 description: InnoDB I/O Operations
860 unit: operations/s
861 chart_type: line
862 dimensions:
863 - name: reads
864 - name: writes
865 - name: fsyncs
866 - name: mysql.innodb_io_pending_ops
867 description: InnoDB Pending I/O Operations
868 unit: operations
869 chart_type: line
870 dimensions:
871 - name: reads
872 - name: writes
873 - name: fsyncs
874 - name: mysql.innodb_log
875 description: InnoDB Log Operations
876 unit: operations/s
877 chart_type: line
878 dimensions:
879 - name: waits
880 - name: write_requests
881 - name: writes
882 - name: mysql.innodb_redo_log_activity
883 description: InnoDB Redo Log Activity
884 unit: B/s
885 chart_type: line
886 dimensions:
887 - name: redo_written
888 - name: checkpointed
889 - name: mysql.innodb_redo_log_occupancy
890 description: InnoDB Redo Log Occupancy
891 unit: percentage
892 chart_type: area
893 dimensions:
894 - name: occupancy
895 - name: mysql.innodb_redo_log_checkpoint_age
896 description: InnoDB Redo Log Checkpoint Age
897 unit: B
898 chart_type: line
899 dimensions:
900 - name: age
901 - name: mysql.innodb_cur_row_lock
902 description: InnoDB Current Row Locks
903 unit: operations
904 chart_type: line
905 dimensions:
906 - name: current waits
907 - name: mysql.innodb_rows
908 description: InnoDB Row Operations
909 unit: operations/s
910 chart_type: area
911 dimensions:
912 - name: inserted
913 - name: read
914 - name: updated
915 - name: deleted
916 - name: mysql.innodb_buffer_pool_pages
917 description: InnoDB Buffer Pool Pages
918 unit: pages
919 chart_type: line
920 dimensions:
921 - name: data
922 - name: dirty
923 - name: free
924 - name: misc
925 - name: total
926 - name: mysql.innodb_buffer_pool_pages_flushed
927 description: InnoDB Buffer Pool Flush Pages Requests
928 unit: requests/s
929 chart_type: line
930 dimensions:
931 - name: flush_pages
932 - name: mysql.innodb_buffer_pool_bytes
933 description: InnoDB Buffer Pool Bytes
934 unit: MiB
935 chart_type: line
936 dimensions:
937 - name: data
938 - name: dirty
939 - name: mysql.innodb_buffer_pool_read_ahead
940 description: InnoDB Buffer Pool Read Pages
941 unit: pages/s
942 chart_type: line
943 dimensions:
944 - name: all
945 - name: evicted
946 - name: mysql.innodb_buffer_pool_read_ahead_rnd
947 description: InnoDB Buffer Pool Random Read-Aheads
948 unit: operations/s
949 chart_type: line
950 dimensions:
951 - name: read-ahead
952 - name: mysql.innodb_buffer_pool_ops
953 description: InnoDB Buffer Pool Operations
954 unit: operations/s
955 chart_type: area
956 dimensions:
957 - name: disk_reads
958 - name: wait_free
959 - name: mysql.innodb_os_log
960 description: InnoDB OS Log Pending Operations
961 unit: operations
962 chart_type: line
963 dimensions:
964 - name: fsyncs
965 - name: writes
966 - name: mysql.innodb_os_log_fsync_writes
967 description: InnoDB OS Log Operations
968 unit: operations/s
969 chart_type: line
970 dimensions:
971 - name: fsyncs
972 - name: mysql.innodb_os_log_io
973 description: InnoDB OS Log Bandwidth
974 unit: KiB/s
975 chart_type: area
976 dimensions:
977 - name: write
978 - name: mysql.innodb_deadlocks
979 description: InnoDB Deadlocks
980 unit: operations/s
981 chart_type: area
982 dimensions:
983 - name: deadlocks
984 - name: mysql.files
985 description: Open Files
986 unit: files
987 chart_type: line
988 dimensions:
989 - name: files
990 - name: mysql.files_rate
991 description: Opened Files Rate
992 unit: files/s
993 chart_type: line
994 dimensions:
995 - name: files
996 - name: mysql.connection_errors
997 description: Connection Errors
998 unit: errors/s
999 chart_type: line
1000 dimensions:
1001 - name: accept
1002 - name: internal
1003 - name: max
1004 - name: peer_addr
1005 - name: select
1006 - name: tcpwrap
1007 - name: mysql.opened_tables
1008 description: Opened Tables
1009 unit: tables/s
1010 chart_type: line
1011 dimensions:
1012 - name: tables
1013 - name: mysql.open_tables
1014 description: Open Tables
1015 unit: tables
1016 chart_type: area
1017 dimensions:
1018 - name: cache
1019 - name: tables
1020 - name: mysql.process_list_fetch_query_duration
1021 description: Process List Fetch Duration
1022 unit: milliseconds
1023 chart_type: line
1024 dimensions:
1025 - name: duration
1026 - name: mysql.process_list_queries_count
1027 description: Queries Count
1028 unit: queries
1029 chart_type: stacked
1030 dimensions:
1031 - name: system
1032 - name: user
1033 - name: mysql.process_list_longest_query_duration
1034 description: Longest Query Duration
1035 unit: seconds
1036 chart_type: line
1037 dimensions:
1038 - name: duration
1039 - name: mysql.qcache_ops
1040 description: QCache Operations
1041 unit: queries/s
1042 chart_type: line
1043 dimensions:
1044 - name: hits
1045 - name: lowmem_prunes
1046 - name: inserts
1047 - name: not_cached
1048 - name: mysql.qcache
1049 description: QCache Queries in Cache
1050 unit: queries
1051 chart_type: line
1052 dimensions:
1053 - name: queries
1054 - name: mysql.qcache_freemem
1055 description: QCache Free Memory
1056 unit: MiB
1057 chart_type: area
1058 dimensions:
1059 - name: free
1060 - name: mysql.qcache_memblocks
1061 description: QCache Memory Blocks
1062 unit: blocks
1063 chart_type: line
1064 dimensions:
1065 - name: free
1066 - name: total
1067 - name: mysql.galera_writesets
1068 description: Replicated Writesets
1069 unit: writesets/s
1070 chart_type: line
1071 dimensions:
1072 - name: rx
1073 - name: tx
1074 - name: mysql.galera_bytes
1075 description: Replicated Bytes
1076 unit: KiB/s
1077 chart_type: area
1078 dimensions:
1079 - name: rx
1080 - name: tx
1081 - name: mysql.galera_queue
1082 description: Galera Queue
1083 unit: writesets
1084 chart_type: line
1085 dimensions:
1086 - name: rx
1087 - name: tx
1088 - name: mysql.galera_conflicts
1089 description: Replication Conflicts
1090 unit: transactions
1091 chart_type: area
1092 dimensions:
1093 - name: bf_aborts
1094 - name: cert_fails
1095 - name: mysql.galera_flow_control
1096 description: Flow Control
1097 unit: ms
1098 chart_type: area
1099 dimensions:
1100 - name: paused
1101 - name: mysql.galera_cluster_status
1102 description: Cluster Component Status
1103 unit: status
1104 chart_type: line
1105 dimensions:
1106 - name: primary
1107 - name: non_primary
1108 - name: disconnected
1109 - name: mysql.galera_cluster_state
1110 description: Cluster Component State
1111 unit: state
1112 chart_type: line
1113 dimensions:
1114 - name: undefined
1115 - name: joining
1116 - name: donor
1117 - name: joined
1118 - name: synced
1119 - name: error
1120 - name: mysql.galera_cluster_size
1121 description: Number of Nodes in the Cluster
1122 unit: nodes
1123 chart_type: line
1124 dimensions:
1125 - name: nodes
1126 - name: mysql.galera_cluster_weight
1127 description: The Total Weight of the Current Members in the Cluster
1128 unit: weight
1129 chart_type: line
1130 dimensions:
1131 - name: weight
1132 - name: mysql.galera_connected
1133 description: Cluster Connection Status
1134 unit: boolean
1135 chart_type: line
1136 dimensions:
1137 - name: connected
1138 - name: mysql.galera_ready
1139 description: Accept Queries Readiness Status
1140 unit: boolean
1141 chart_type: line
1142 dimensions:
1143 - name: ready
1144 - name: mysql.galera_open_transactions
1145 description: Open Transactions
1146 unit: transactions
1147 chart_type: line
1148 dimensions:
1149 - name: open
1150 - name: mysql.galera_thread_count
1151 description: Total Number of WSRep (applier/rollbacker) Threads
1152 unit: threads
1153 chart_type: line
1154 dimensions:
1155 - name: threads
1156 - name: mysql.key_blocks
1157 description: MyISAM Key Cache Blocks
1158 unit: blocks
1159 chart_type: line
1160 dimensions:
1161 - name: unused
1162 - name: used
1163 - name: not_flushed
1164 - name: mysql.key_requests
1165 description: MyISAM Key Cache Requests
1166 unit: requests/s
1167 chart_type: area
1168 dimensions:
1169 - name: reads
1170 - name: writes
1171 - name: mysql.key_disk_ops
1172 description: MyISAM Key Cache Disk Operations
1173 unit: operations/s
1174 chart_type: area
1175 dimensions:
1176 - name: reads
1177 - name: writes
1178 - name: mysql.binlog_cache
1179 description: Binlog Cache
1180 unit: transactions/s
1181 chart_type: line
1182 dimensions:
1183 - name: disk
1184 - name: all
1185 - name: mysql.binlog_stmt_cache
1186 description: Binlog Statement Cache
1187 unit: statements/s
1188 chart_type: line
1189 dimensions:
1190 - name: disk
1191 - name: all
1192 - name: connection
1193 description: These metrics refer to the replication connection.
1194 labels: []
1195 metrics:
1196 - name: mysql.slave_behind
1197 description: Slave Behind Seconds
1198 unit: seconds
1199 chart_type: line
1200 dimensions:
1201 - name: seconds
1202 - name: mysql.slave_status
1203 description: I/O / SQL Thread Running State
1204 unit: boolean
1205 chart_type: line
1206 dimensions:
1207 - name: sql_running
1208 - name: io_running
1209 - name: user
1210 description: These metrics refer to the MySQL user.
1211 labels:
1212 - name: user
1213 description: username
1214 metrics:
1215 - name: mysql.userstats_cpu
1216 description: User CPU Time
1217 unit: percentage
1218 chart_type: line
1219 availability:
1220 - MariaDB
1221 - Percona
1222 dimensions:
1223 - name: used
1224 - name: mysql.userstats_rows
1225 description: User Rows Operations
1226 unit: operations/s
1227 chart_type: stacked
1228 availability:
1229 - MariaDB
1230 - Percona
1231 dimensions:
1232 - name: read
1233 - name: sent
1234 - name: updated
1235 - name: inserted
1236 - name: deleted
1237 - name: mysql.userstats_commands
1238 description: User Commands
1239 unit: commands/s
1240 chart_type: stacked
1241 availability:
1242 - MariaDB
1243 - Percona
1244 dimensions:
1245 - name: select
1246 - name: update
1247 - name: other
1248 - name: mysql.userstats_denied_commands
1249 description: User Denied Commands
1250 unit: commands/s
1251 chart_type: stacked
1252 availability:
1253 - MariaDB
1254 - Percona
1255 dimensions:
1256 - name: denied
1257 - name: mysql.userstats_created_transactions
1258 description: User Transactions
1259 unit: transactions/s
1260 chart_type: area
1261 availability:
1262 - MariaDB
1263 - Percona
1264 dimensions:
1265 - name: commit
1266 - name: rollback
1267 - name: mysql.userstats_binlog_written
1268 description: User Binlog Written
1269 unit: B/s
1270 chart_type: line
1271 availability:
1272 - MariaDB
1273 - Percona
1274 dimensions:
1275 - name: written
1276 - name: mysql.userstats_empty_queries
1277 description: User Empty Queries
1278 unit: queries/s
1279 chart_type: line
1280 availability:
1281 - MariaDB
1282 - Percona
1283 dimensions:
1284 - name: empty
1285 - name: mysql.userstats_connections
1286 description: User Created Connections
1287 unit: connections/s
1288 chart_type: line
1289 availability:
1290 - MariaDB
1291 - Percona
1292 dimensions:
1293 - name: created
1294 - name: mysql.userstats_lost_connections
1295 description: User Lost Connections
1296 unit: connections/s
1297 chart_type: line
1298 availability:
1299 - MariaDB
1300 - Percona
1301 dimensions:
1302 - name: lost
1303 - name: mysql.userstats_denied_connections
1304 description: User Denied Connections
1305 unit: connections/s
1306 chart_type: line
1307 availability:
1308 - MariaDB
1309 - Percona
1310 dimensions:
1311 - name: denied
1312 - <<: *module
1313 meta:
1314 <<: *meta
1315 id: collector-go.d.plugin-mariadb
1316 monitored_instance:
1317 name: MariaDB
1318 link: https://mariadb.org/
1319 icon_filename: mariadb.svg
1320 categories:
1321 - data-collection.databases
1322 - <<: *module
1323 meta:
1324 <<: *meta
1325 id: collector-go.d.plugin-percona_mysql
1326 monitored_instance:
1327 name: Percona MySQL
1328 link: https://www.percona.com/software/mysql-database/percona-server
1329 icon_filename: percona.svg
1330 categories:
1331 - data-collection.databases