Now I have to show how to check my zabbix mysql service. Another tutorial how to monitoring mysql service via zabbix. Zabbix is very important tools for database monitoring system. So I will configure step by step zabbix own server mysql monitor.
★ Install Zabbix server on ubuntu 16.04
★ How To Add Windows Host In Zabbix Server
Step #01: Open zabbix agent configure /etc/zabbix/zabbix_agentd.conf file.
root@zabbix-server:~# vim /etc/zabbix/zabbix_agentd.conf
Check user parameter file name as like below.
Step #02: Add zabbix user parameter for mysql server monitoring. Create userparameter_mysql.conf file into /etc/zabbix/zabbix_agent.d/ location. Open vim /etc/zabbix/zabbix_agent.d/userparameter_mysql.conf. Then insert below all lines.
# For all the following commands HOME should be set to the directory that has .my.cnf file with password information. # Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert]. # Key syntax is mysql.status[variable]. UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}' # Flexible parameter to determine database or table size. On the frontend side, use keys like mysql.size[zabbix,history,data]. # Key syntax is mysql.size[, ,]. # Database may be a database name or "all". Default is "all". # Table may be a table name or "all". Default is "all". # Type may be "data", "index", "free" or "both". Both is a sum of data and index. Default is "both". # Database is mandatory if a table is specified. Type may be specified always. # Returns value in bytes. # 'sum' on data_length or index_length alone needed when we are getting this information for whole database instead of a single table UserParameter=mysql.size[*],bash -c 'echo "select sum($(case "$3" in both|"") echo "data_length+index_length";; data|index) echo "$3_length";; free) echo "data_free";; esac)) from information_schema.tables$([[ "$1" = "all" || ! "$1" ]] || echo " where table_schema=\"$1\"")$([[ "$2" = "all" || ! "$2" ]] || echo "and table_name=\"$2\"");" | HOME=/var/lib/zabbix mysql -N' UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive UserParameter=mysql.version,mysql -V
Step #03: Type mysql -uroot -ppassw0rd for create database, drop database, create user, create table, drop user, drop table etc.
root@zabbix-server:~# mysql -uroot -ppassw0rd
See as like below.
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 21406 Server version: 5.5.55-0ubuntu0.14.04.1-log (Ubuntu) Copyright (c) 2000, 2017, 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>
Now create user for send data from mysql databases server with password.
mysql> create user ‘zabbix_user’@’localhost’ identified by ‘passw0rd’;
mysql> grant all privileges on *.* to ‘zabbix_user’@’localhost’;
mysql> flush privileges;
mysql> exit;
Step #04: Check userparameter_mysql.conf file on /var/lib/zabbix is blank. Now created .my.cnf file on the /var/lib/zabbix/ location.
Open .my.cnf file as below command.
root@zabbix-server:~# vim /var/lib/zabbix/.my.cnf
Then insert previously created mysql user and password on .my.cnf file.
[mysql] user=zabbix_user password=passw0rd host=localhost [mysqladmin] user=zabbix_user password=passw0rd host=localhost
Then zabbix agent restart and mysql service restart.
root@zabbix-server:~# service zabbix-agent restart
root@zabbix-server:~# service mysql restart
Step #05: Now goto your zabbix server and check latest data see all data as like below image.
Click Monitoring/Latest data then select Hosts “zabix server name” again click apply.
Thank You Very much.
- How To Install Zabbix Server 6.4 On AlmaLinux 8 Server - August 9, 2024
- How To Clear RAM Memory Cache Buffer Linux Server - February 29, 2024
- How To Install Apache Cloud Stack Management Server 4.17 On Ubuntu 22.04 - February 1, 2024
Leave a Comment