Monitor the performance of MySQL or MariaDB

Learn how to set up basic performance monitoring for MySQL or MariaDB

Introduction

Make sure you have the most recent version of cagent installed. Monitoring of MySQL or MariaDB requires cagent 1.3.2 or later version.

Add user and grant permissions

CloudRadar recommends creating a new user with a set of permissions, which will be used by an agent. In order to do so, you need to start your MySQL/MariaDB shell. Please note that in this example we are granting cagent user full root access in our database, but you can create a user with

mysql > CREATE USER cagent@localhost IDENTIFIED BY 'confidential';
mysql > GRANT USAGE ON *.* TO cagent@localhost

Configure database connection details

Open the file /etc/cagent/cagent.conf on Linux or C:\Program Files\cagent\cagent.conf on Windows with an editor and insert the following code:

[mysql_monitoring]
enabled = true
connect = "127.0.0.1:3306" # Use 127.0.0.1 or the path to the mysql.socket, connecting to remote databases is not supported
user = "cagent"
password = "confidential"
connect_timeout = 1.0

Restart now the cagent service on your monitored machine and you are all set. On Linux usesystemctl restart cagent

You can log in into CloudRadar web app now, go to the Latest Data and you'll see your database being monitored.