MySQL Side settings:
The general version of the Zabbix is default with the MySQL monitoring project
Under the installation directory zabbix_agentd.d/userparameter_mysql.conf
[[email protected] zabbix_agentd.d]# more userparameter_mysql.conf # 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= ';" | 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>,<table>,<type>].# 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 tableUserParameter=mysql.size[*],echo "Select sum ($ (case " $ " in Both| "") echo "data_lEngth+index_length ";; data|index) echo "$3_length";; free) echo "Data_free";; &NBSP;ESAC) from information_schema.tables$ ([[ "$" = "All" | | ! "$ ]] |" | echo " where table_schema=" $ ([[ "$" = "All" | | ! "$ ]] |" | echo "And table_name= '"); " | HOME=/var/lib/zabbix mysql -NUserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c aliveuserparameter=mysql.version,mysql -v[[email protected] zabbix_agentd.d]#
MySQL connection password needs to be saved in/VAR/LIB/ZABBIX/.MY.CNF
[Email protected] ~]# MORE/VAR/LIB/ZABBIX/.MY.CNF [mysql]host=127.0.0.1port=3306user=rootpassword=passwd[[email Protected] ~]#
This file is used to develop how the Zabbix agent obtains MySQL data
Zabbix server side need to add templates, the new version has been brought in, if not please download the template below
Template_app_mysql-2.2.0.xml
then on the front-end Web interface of the Zabbix serverConfiguration -Templatespage, selectImport into
So we're done with the settings on the monitored side, and now we just need to add the MySQL template to the Zabbix front end to start monitoring with the host item that needs to be monitored.
Using Zabbix to monitor MySQL services