Alan
Alan

Reputation: 139

How to monitor databases from a distant server?

I have installed Zabbix on a server (Ubuntu 16.04), to monitor the performances of an other server. I can see its CPU usage, its memory usage, etc.

But, that server (Ubuntu 16.04) also contains a database, and I'd like to monitor its performances too (number of queries per minute, time of execution, etc). I haven't found how to do that using Zabbix.

Could someone guide me on how to do that? And if Zabbix can't do that, is there another tool that could monitor a remote database?

Thanks a lot.

Upvotes: 1

Views: 792

Answers (1)

André Schild
André Schild

Reputation: 4754

Zabbix consists of two components

  1. The Zabbix server where all the collected data is stored, triggers are processed and fired
  2. The Zabbix Agent which can be installed on most operating systems, which allow to collect in depth data from the system. The Agent then sends the collected data back to the Zabbix server

So in your case it would be best if you can install the zabbix agent on the DB server and then use the mysql monitoring stuff included in zabbix. This way you won't have to allow network access to your mysql server.

The most common problem, is that you will need to have a db user named zabbix (or what you define in the config file) which has read rights to the statistic stuff of mysql.

Here to create the mysql user and assign rights

root@web01:~# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.17-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> create user 'zabbix_admin'@'localhost' IDENTIFIED BY 'Password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT USAGE ON *.* TO 'zabbix_admin'@'localhost' IDENTIFIED BY 'Password';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

In the zabbix config folder you then specify the login information

root@web01:~# vi /etc/zabbix/.my.cnf
#
[mysql]
user=zabbix_admin
password=Password
[mysqladmin]
user=zabbix_admin
password=Password

And in the /etc/zabbix/zabbix_agentd.conf.d/userparameter_mysql.conf file you specify which things to monitor (Taken from a template) Here some more additional pointers:

Upvotes: 2

Related Questions