Zabbix-3.0.3 monitor MySQL with built-in templates

Source: Internet
Author: User

Zabbix-3.0.3 monitor MySQL with built-in templates
GuideZabbix is an excellent, open-source, enterprise-level monitoring software. You can monitor many services you want to monitor through secondary development. This article describes how to monitor MySQL services using the template that comes with Zabbix.

Configure userparameter_mysql.conf

# Move to the zabbix decompression path

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

# Copy the file to/opt/zabbix/etc/zabbix_agentd.conf.d/# specify your own zabbix installation directory

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

# Add the configuration file my. cnf used to associate mysql, and modify the mysql path in the template configuration file

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

# Zabbix Agent

[mysql]host=localhostuser=zabbixpassword=@Zabbix..0socket=/data/mysql/mysql.sock[mysqladmin]host=localhostuser=zabbixpassword=@Zabbix..0socket=/data/mysql/mysql.sock

# Use the find/-name mysql. sock file to find the path

# Modify userparameter_mysql.conf:

sudo sed -i ‘s@/var/lib/zabbix@/opt/zabbix/etc@g‘ /opt/zabbix/etc/zabbix_agentd.d/userparameter_mysql.conf

# Modify userparameter_mysql.conf as follows:

UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/opt/zabbix/etc mysql -N | awk '{print $$2}'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=/opt/zabbix/etc mysqladmin ping | grep -c alive

# The HOME directory is the directory where the. my. cnf file is added.

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

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

# Restart zabbix-agentd

/etc/init.d/zabbix_agentd restart

# Test

# /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 Linux (x86_64) using EditLine wrapper

# Note: if the following error is reported during the test: sh: mysql: command not found, sh: mysqladmin: command not found, modify the path of mysql and mysqladmin commands in userparameter_mysql.conf and use the absolute path.

Zabbix-web page settings

# Configuration-Hosts-Zabbix server-Tempaltes, search for MySQL, add the pop-up template, and then update

# Monitoring-Graphs: select a group, and then select host and the displayed image.
# Use the Zabbix built-in template to monitor MySQL.

Original address: http://www.linuxprobe.com/monitor-mysql-with-zabbix.html


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.