MySQL monitoring with Netdata
MySQL
is an open-source relational database management system.
This module monitors one or more MySQL
servers, depending on your configuration.
Requirements
Executed queries:
SELECT VERSION();
SHOW GLOBAL STATUS;
SHOW GLOBAL VARIABLES;
SHOW SLAVE STATUS;
or SHOW ALL SLAVES STATUS;
(MariaDBv10.2+)
SHOW USER_STATISTICS;
(MariaDBv10.1.1+)
User Statistics query is MariaDB
specific.
MySQL
user should have the following permissions:
To create the netdata
user with these permissions, execute the following in the MySQL
shell:
CREATE USER 'netdata'@'localhost';
GRANT USAGE, REPLICATION CLIENT, PROCESS ON *.* TO 'netdata'@'localhost';
FLUSH PRIVILEGES;
The netdata
user will have the ability to connect to the MySQL
server on localhost without a password.
It will only be able to gather statistics without being able to alter or affect operations in any way.
Charts
It produces the following charts:
- Bandwidth in
kilobits/s
- Queries in
queries/s
- Queries By Type in
queries/s
- Handlers in
handlers/s
- Table Locks in
locks/s
- Table Select Join Issues in
joins/s
- Table Sort Issues in
joins/s
- Tmp Operations in
events/s
- Connections in
connections/s
- Active Connections in
connections
- Binlog Cache in
transactions/s
- Threads in
threads
- Threads Creation Rate in
threads/s
- Threads Cache Misses in
misses
- InnoDB I/O Bandwidth in
KiB/s
- InnoDB I/O Operations in
operations/s
- InnoDB Pending I/O Operations in
operations
- InnoDB Log Operations in
operations/s
- InnoDB OS Log Pending Operations in
operations
- InnoDB OS Log Operations in
operations/s
- InnoDB OS Log Bandwidth in
KiB/s
- InnoDB Current Row Locks in
operations
- InnoDB Row Operations in
operations/s
- InnoDB Buffer Pool Pages in
pages
- InnoDB Buffer Pool Flush Pages Requests in
requests/s
- InnoDB Buffer Pool Bytes in
MiB
- InnoDB Buffer Pool Operations in
operations/s
- MyISAM Key Cache Blocks in
blocks
- MyISAM Key Cache Requests in
requests/s
- MyISAM Key Cache Disk Operations in
operations/s
- Open Files in
files
- Opened Files Rate in
files/s
- Binlog Statement Cache in
statements/s
- Connection Errors in
errors/s
- Opened Tables in
tables/s
- Open Tables in
tables
If Query Cache metrics are available (MariaDB
and old versions of MySQL
):
- QCache Operations in
queries/s
- QCache Queries in Cache in
queries
- QCache Free Memory in
MiB
- QCache Memory Blocks in
blocks
If WSRep metrics are available:
- Replicated Writesets in
writesets/s
- Replicated Bytes in
KiB/s
- Galera Queue in
writesets
- Replication Conflicts in
transactions
- Flow Control in
ms
- Cluster Component Status in
status
- Cluster Component State in
state
- Number of Nodes in the Cluster in
num
- The Total Weight of the Current Members in the Cluster in
weight
- Cluster Connection Status in
boolean
- Accept Queries Readiness Status in
boolean
- Open Transactions in
num
- Total Number of WSRep (applier/rollbacker) Threads in
num
If Slave Status metrics are available:
- Slave Behind Seconds in
seconds
- I/O / SQL Thread Running State in
boolean
If User Statistics metrics are available:
- User CPU Time in
percentage
- Rows Operations in
operations/s
- Commands in
commands/s
Configuration
Edit the go.d/mysql.conf
configuration file using edit-config
from your agent's config
directory, which is typically at /etc/netdata
.
cd /etc/netdata # Replace this path with your Netdata config directory
sudo ./edit-config go.d/mysql.conf
DSN syntax in details.
jobs:
- name: local
dsn: [username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
# username:password@protocol(address)/dbname?param=value
# user:password@/dbname
# Examples:
# - name: local
# dsn: user:pass@unix(/usr/local/var/mysql/mysql.sock)/
# - name: remote
# dsn: user:pass5@localhost/mydb?charset=utf8
For all available options see module configuration file.
Troubleshooting
Check the module debug output. Run the following command as netdata
user:
./go.d.plugin -d -m mysql