Zabbix-3.0.3 using your own template to monitor MySQL

Source: Internet
Author: User

Guide Zabbix is an excellent, open-source, enterprise-class monitoring software that can monitor many of the services you want to monitor with two development, this article describes the use of Zabbix's own templates to monitor MySQL services.

Configure userparameter_mysql.conf

#移动到zabbix解压缩路径

Cd/usr/local/src/zabbix-3.0.3/conf/zabbix_agentd

#拷贝文件到/opt/zabbix/etc/zabbix_agentd.conf.d/#指定自己的zabbix安装目录

CP userparameter_mysql.conf/opt/zabbix/etc/zabbix_agentd.conf.d/

#添加用来关联mysql的配置文件my. CNF, and modify the MySQL path in the template configuration file

cd/opt/zabbix/etc/
Vim. my.cnf

# Zabbix Agent

[Mysql]host=localhostuser=zabbix[email protected]socket=/data/mysql/mysql.sock[mysqladmin]host=localhostuser= Zabbix[email Protected]socket=/data/mysql/mysql.sock

# Mysql.sock file Find path through Find/-name Mysql.sock

# Modify Userparameter_mysql.conf:

sudo sed-i ' [email protected]/var/lib/[email protected]/opt/zabbix/[email protected] '/opt/zabbix/etc/zabbix_ Agentd.d/userparameter_mysql.conf

# Modify complete userparameter_mysql.conf content as follows:

Userparameter=mysql.status[*],echo "show global status where Variable_name= ' $ ';" | Home=/opt/zabbix/etc Mysql-n | awk ' {print $$2} ' userparameter=mysql.size[*],bash-c ' echo ' Select SUM ($ (case "$ $" in both| "") echo "Data_length+index_length";; Data|index) echo "$3_length";; Free) echo "Data_free";; ESAC)) from information_schema.tables$ ([["$" = "All" | |! "$"] | | echo "Where table_schema=\" $1\ "") $ ([[["$] =" All "| |! "$"] | | echo "and table_name=\" $2\ ""); "| Home=/var/lib/zabbix mysql-n ' userparameter=mysql.ping,home=/opt/zabbix/etc mysqladmin ping | Grep-c Alive

#HOME目录为新增 the directory where the. my.cnf file is located

# Modify the zabbix_agentd.conf file and add the following line

include=/opt/zabbix/etc/zabbix_agentd.conf.d/

#重启zabbix-agentd

/etc/init.d/zabbix_agentd restart

#测试

#/opt/zabbix/bin/zabbix_get-s 127.0.0.1-p 10050-k mysql.ping1
#/opt/zabbix/bin/zabbix_get-s 127.0.0.1-p 10050-k mysql.version/data/mysql/bin/mysql Ver 14.14 Distrib 5.7.12, for Lin UX (x86_64) using Editline Wrapper

#注意: If the test error: Sh:mysql:command not Found,sh:mysqladmin:command not found, modify Userparameter_ The path to the Mysql,mysqladmin command in mysql.conf, using the absolute path.

zabbix-web Page Setup

#Configuration-hosts-zabbix server-tempaltes, search for MySQL, add pop-up templates, and then update

#Monitoring-graphs, select the group and select the host and the displayed graphic
#利用Zabbix自带模板监控MySQL完成.

Zabbix-3.0.3 using your own template to monitor MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.