Monitor MySQL or MariaDB Databases using Netdata on CentOS 7 or RHEL 7

In this article, we’ll show you how to Monitor MySQL or MariaDB Databases using Netdata on CentOS 7 or RHEL 7. Netdata support various plugins which are used for monitoring system, applications or services. After installation, you’ll be able to monitor metrics such as queries, issues, connections, binlog, threads metrics, handlers, bandwidth, etc.

Prerequisite:

  • CentOS 7 or RHEL 7 with minimal installation
  • Databases server MySQL or MariaDB

Steps to Install MariaDB Database Server on CentOS 7

Step 1: Add MariaDB YUM repository

vi /etc/yum.repos.d/MariaDB.repo

On CentOS 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

On RHEL 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Step 2: Install MariaDB Server and MariaDB client 

$ yum install MariaDB-server MySQL-python MariaDB-client -y

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7

Sample Output:

[root@linux-dev system]# yum install MariaDB-server MySQL-python MariaDB-client -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: download.nus.edu.sg
* epel-source: download.nus.edu.sg
* extras: mirrors.piconets.webwerks.in
* updates: mirror-hk.koddos.net
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.1.48-1.el7.centos will be installed
--> Processing Dependency: MariaDB-common for package: MariaDB-client-10.1.48-1.el7.centos.x86_64
---> Package MariaDB-server.x86_64 0:10.1.48-1.el7.centos will be installed
--> Processing Dependency: perl(DBI) for package: MariaDB-server-10.1.48-1.el7.centos.x86_64
--> Processing Dependency: galera for package: MariaDB-server-10.1.48-1.el7.centos.x86_64
--> Processing Dependency: libjemalloc.so.1()(64bit) for package: MariaDB-server-10.1.48-1.el7.centos.x86_64
--> Running transaction check
---> Package MariaDB-common.x86_64 0:10.1.48-1.el7.centos will be installed
---> Package galera.x86_64 0:25.3.31-1.el7.centos will be installed
--> Processing Dependency: libboost_program_options.so.1.53.0()(64bit) for package: galera-25.3.31-1.el7.centos.x86_64
---> Package jemalloc.x86_64 0:3.6.0-1.el7 will be installed
---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
--> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
--> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
--> Running transaction check
---> Package boost-program-options.x86_64 0:1.53.0-28.el7 will be installed
---> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
--> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
--> Running transaction check
---> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
--> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
--> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
---> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
--> Running transaction check
---> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
---> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================================
Installing:
MariaDB-client x86_64 10.1.48-1.el7.centos mariadb 10 M
MariaDB-server x86_64 10.1.48-1.el7.centos mariadb 24 M
Installing for dependencies:
MariaDB-common x86_64 10.1.48-1.el7.centos mariadb 68 k
boost-program-options x86_64 1.53.0-28.el7 base 156 k
galera x86_64 25.3.31-1.el7.centos mariadb 8.1 M
jemalloc x86_64 3.6.0-1.el7 epel 105 k
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k

Transaction Summary
=============================================================================================================================================================================
Install 2 Packages (+10 Dependent packages)

Total size: 44 M
Total download size: 43 M
Installed size: 209 M
Downloading packages:
No Presto metadata available for mariadb
No Presto metadata available for base
epel/x86_64/prestodelta | 4.0 kB 00:00:06
(1/9): MariaDB-common-10.1.48-1.el7.centos.x86_64.rpm | 68 kB 00:00:01
(2/9): boost-program-options-1.53.0-28.el7.x86_64.rpm | 156 kB 00:00:05
(3/9): MariaDB-server-10.1.48-1.el7.centos.x86_64.rpm | 24 MB 00:00:26
(4/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm | 51 kB 00:00:01
(5/9): perl-IO-Compress-2.061-2.el7.noarch.rpm | 260 kB 00:00:01
(6/9): jemalloc-3.6.0-1.el7.x86_64.rpm | 105 kB 00:00:01
(7/9): perl-PlRPC-0.2020-14.el7.noarch.rpm | 36 kB 00:00:00
(8/9): galera-25.3.31-1.el7.centos.x86_64.rpm | 8.1 MB 00:00:08
(9/9): MariaDB-client-10.1.48-1.el7.centos.x86_64.rpm | 10 MB 00:00:37
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.1 MB/s | 43 MB 00:00:37
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : MariaDB-common-10.1.48-1.el7.centos.x86_64 1/12
Installing : MariaDB-client-10.1.48-1.el7.centos.x86_64 2/12
Installing : boost-program-options-1.53.0-28.el7.x86_64 3/12
Installing : galera-25.3.31-1.el7.centos.x86_64 4/12
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 5/12
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 6/12
Installing : perl-IO-Compress-2.061-2.el7.noarch 7/12
Installing : jemalloc-3.6.0-1.el7.x86_64 8/12
Installing : perl-Net-Daemon-0.48-5.el7.noarch 9/12
Installing : perl-PlRPC-0.2020-14.el7.noarch 10/12
Installing : perl-DBI-1.627-4.el7.x86_64 11/12
Installing : MariaDB-server-10.1.48-1.el7.centos.x86_64 12/12
2021-05-13 9:20:57 140138370812160 [Note] /usr/sbin/mysqld (mysqld 10.1.48-MariaDB) starting as process 9081 ...
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: The InnoDB memory heap is disabled
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Compressed tables use zlib 1.2.7
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Using Linux native AIO
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Using SSE crc32 instructions
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Completed initialization of buffer pool
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2021-05-13 9:20:57 140138370812160 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2021-05-13 9:20:58 140138370812160 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2021-05-13 9:21:00 140138370812160 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2021-05-13 9:21:01 140138370812160 [Warning] InnoDB: New log files created, LSN=45780
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Doublewrite buffer not found: creating new
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Doublewrite buffer created
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: 128 rollback segment(s) are active.
2021-05-13 9:21:01 140138370812160 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Foreign key constraint system tables created
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Creating tablespace and datafile system tables.
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Tablespace and datafile system tables created.
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Waiting for purge to start
2021-05-13 9:21:01 140138370812160 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.49-89.0 started; log sequence number 0
2021-05-13 9:21:01 140137577051904 [Note] InnoDB: Dumping buffer pool(s) not yet started
2021-05-13 9:21:13 140685952735488 [Note] /usr/sbin/mysqld (mysqld 10.1.48-MariaDB) starting as process 9120 ...
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: The InnoDB memory heap is disabled
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Compressed tables use zlib 1.2.7
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Using Linux native AIO
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Using SSE crc32 instructions
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Completed initialization of buffer pool
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Highest supported file format is Barracuda.
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: 128 rollback segment(s) are active.
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Waiting for purge to start
2021-05-13 9:21:13 140685952735488 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.49-89.0 started; log sequence number 1616693
2021-05-13 9:21:13 140685156022016 [Note] InnoDB: Dumping buffer pool(s) not yet started
2021-05-13 9:21:16 140465506691328 [Note] /usr/sbin/mysqld (mysqld 10.1.48-MariaDB) starting as process 9151 ...
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.

2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: The InnoDB memory heap is disabled
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Compressed tables use zlib 1.2.7
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Using Linux native AIO
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Using SSE crc32 instructions
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Completed initialization of buffer pool
2021-05-13 9:21:16 140465506691328 [Note] InnoDB: Highest supported file format is Barracuda.
2021-05-13 9:21:17 140465506691328 [Note] InnoDB: 128 rollback segment(s) are active.
2021-05-13 9:21:17 140465506691328 [Note] InnoDB: Waiting for purge to start
2021-05-13 9:21:17 140465506691328 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.49-89.0 started; log sequence number 1616703
2021-05-13 9:21:17 140464715986688 [Note] InnoDB: Dumping buffer pool(s) not yet started

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h linux-dev password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

Verifying : galera-25.3.31-1.el7.centos.x86_64 1/12
Verifying : perl-Net-Daemon-0.48-5.el7.noarch 2/12
Verifying : jemalloc-3.6.0-1.el7.x86_64 3/12
Verifying : perl-PlRPC-0.2020-14.el7.noarch 4/12
Verifying : MariaDB-common-10.1.48-1.el7.centos.x86_64 5/12
Verifying : MariaDB-server-10.1.48-1.el7.centos.x86_64 6/12
Verifying : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64 7/12
Verifying : MariaDB-client-10.1.48-1.el7.centos.x86_64 8/12
Verifying : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64 9/12
Verifying : perl-DBI-1.627-4.el7.x86_64 10/12
Verifying : perl-IO-Compress-2.061-2.el7.noarch 11/12
Verifying : boost-program-options-1.53.0-28.el7.x86_64 12/12

Installed:
MariaDB-client.x86_64 0:10.1.48-1.el7.centos MariaDB-server.x86_64 0:10.1.48-1.el7.centos

Dependency Installed:
MariaDB-common.x86_64 0:10.1.48-1.el7.centos boost-program-options.x86_64 0:1.53.0-28.el7 galera.x86_64 0:25.3.31-1.el7.centos jemalloc.x86_64 0:3.6.0-1.el7
perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBI.x86_64 0:1.627-4.el7 perl-IO-Compress.noarch 0:2.061-2.el7
perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7

Complete!
[root@linux-dev system]#

Step 3: Start and enable MariaDB service

# systemctl start mariadb

# systemctl enable mariadb

Sample Output:

[root@linux-dev system]# systemctl start mariadb
[root@linux-dev system]# systemctl enable mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@linux-dev system]#

Step 4: Verify MariaDB service status

# systemctl status mariadb

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7

Sample Output:

[root@linux-dev system]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.1.48 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Thu 2021-05-13 09:27:30 EDT; 4s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 9489 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 9450 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 9444 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Main PID: 9461 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 26
CGroup: /system.slice/mariadb.service
└─9461 /usr/sbin/mysqld

May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] InnoDB: Highest supported file format is Barracuda.
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] InnoDB: 128 rollback segment(s) are active.
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] InnoDB: Waiting for purge to start
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.49-89.0 started; log se...ber 1616723
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] Plugin 'FEEDBACK' is disabled.
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139853274539776 [Note] InnoDB: Dumping buffer pool(s) not yet started
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] Server socket created on IP: '::'.
May 13 09:27:30 linux-dev mysqld[9461]: 2021-05-13 9:27:30 139854056204544 [Note] /usr/sbin/mysqld: ready for connections.
May 13 09:27:30 linux-dev mysqld[9461]: Version: '10.1.48-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
May 13 09:27:30 linux-dev systemd[1]: Started MariaDB 10.1.48 database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@linux-dev system]#

Step 5: Secure MySQL installation 

By default MySQL installation is unsecure you need to secure it as follows:

  • Settings root password
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test database
# mysql_secure_installation
[root@linux-dev system]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@linux-dev system]#

Step 6: Configure database user 

Netdata required access to collect/monitor the MariaDB database to create a user and provide required access to it.

In my case, I am creating a database user with the name “netdata”.

# mysql -u root -p

MariaDB [(none)]> CREATE USER 'netdata'@'localhost';

MariaDB [(none)]> GRANT USAGE on *.* to 'netdata'@'localhost';

MariaDB [(none)]> FLUSH PRIVILEGES;

MariaDB [(none)]> exit

Sample Output:

[root@linux-dev system]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 10.1.48-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE USER 'netdata'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT USAGE on *.* to 'netdata'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@linux-dev system]#

Step 7: Install Netdata to Monitor MySQL Database Performance

# bash <(curl -Ss https://my-netdata.io/kickstart.sh) all

The “all” option will install all required packages and plugins

It will be installed at these locations:

  • the daemon at /usr/sbin/netdata
  • config files in /etc/netdata
  • web files in /usr/share/netdata
  • plugins in /usr/libexec/netdata
  • cache files in /var/cache/netdata
  • db files in /var/lib/netdata
  • log files in /var/log/netdata
  • pid file at /var/run/netdata.pid
  • logrotate file at /etc/logrotate.d/netdata

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7

Step 8: Configure firewall 

By default Netdata listens on the 19999 port, To access Netdata UI on the web browser you need to open 19999 port.

# firewall-cmd --permanent --add-port=19999/tcp

# firewall-cmd --reload 

Verify the list:

[root@linux-dev system]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: dhcpv6-client http ssh
ports: 19999/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@linux-dev system]#

Step 9: Configure Netdata to Monitor MariaDB or MySQL database

# cat /etc/netdata/python.d/mysql.conf
localhost:
name : 'local'
user : 'netdata'
port : '3306'

If you do any changes then you need to restart the Netdata service with the below command.

# systemctl restart netdata

Step 10: Access Netdata

Access Netdata on your web browser with http://SERVER_IP:19999

On the right-hand side, search plugin “MySQL local” and click on it.

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7

Scroll down.

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7

Monitor MySQL or MariaDB Databases using Netdata on CentOS 7End of the article, we’ve explained how to Monitor MySQL or MariaDB Databases using Netdata on CentOS 7 or RHEL 7.

See also:

List of monitoring tools 

Linux Blogs

AWS Cloud Blogs

Database Blogs

DevOps Blogs

Interview Questions & Answers

Docker Blogs

Google Cloud Blogs