mysql

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2020 License: GPL-3.0 Imports: 11 Imported by: 1

README

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&...&paramN=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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chart added in v0.20.0

type Chart = module.Chart

type Charts

type Charts = module.Charts

type Config added in v0.20.0

type Config struct {
	DSN         string `yaml:"dsn"`
	MyCNF       string `yaml:"my.cnf"`
	UpdateEvery int    `yaml:"update_every"`
}

type Dims

type Dims = module.Dims

type MySQL

type MySQL struct {
	module.Base
	Config `yaml:",inline"`
	// contains filtered or unexported fields
}

func New

func New() *MySQL

func (*MySQL) Charts

func (m *MySQL) Charts() *Charts

func (*MySQL) Check

func (m *MySQL) Check() bool

func (*MySQL) Cleanup

func (m *MySQL) Cleanup()

func (*MySQL) Collect

func (m *MySQL) Collect() map[string]int64

func (*MySQL) Init

func (m *MySQL) Init() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL