Zabbix using your own template to monitor MySQL

Source: Internet
Author: User

has been studying the use of Zabbix monitoring MySQL database, due to the Zabbix official template support monitoring MySQL, but the direct use of the template is not available, need to do some settings to be able to use. If your monitoring requirements for MySQL are simple, then use Zabbix's own templates directly, and if your monitoring needs are high then write your own scripts to implement them.


Here are the steps to monitor MySQL using the Zabbix template:

The environment is as follows: CentOS release 6.5 zabbix-2.2.9 mysql-5.1.73

1. Add the MySQL monitor template to the host in the Zabbix Web Access page (the default MySQL template name is:template Appmysql).

2. Add the following information in the Abbix client configuration file (ZABBIX_AGENTD.CNF): (The following make ZABBIX_AGENTD get MySQL data)

1. unsafeuserparameters=1                       #启用自定义KEY2 . userparameter=mysql.size[*],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=" $ ([[  "$"  =  "All"  | |  !  "$  ]] |" |  echo  "And table_name= '"); "  | home=/usr/local/zabbix/etc mysql -n3. userparameter=mysql.ping,home=/usr/local/ Zabbix/etc mysqladmin ping | grep -c alive4. userparameter=mysql.version, mysql -v5. userparameter=mysql.status[*],echo  "SHOW GLOBAL STATUS&NBsp;where variable_name= ' $ '; "  | HOME=/usr/local/zabbix/etc  mysql -N | awk  ' {print $$2} '

Note: home=/usr/local/zabbix/etc/in the above code is not error-prone for making ZABBIX_AGENTD access to the database

3. Configure the MySQL database to create a user to get the relevant data for monitoring mysql:

GRANT USAGE on *. mysql_data ' @ ' localhost ' identified by ' [email protected] '; Query OK, 0 rows Affected (0.00 sec) flush privileges; Query OK, 0 rows Affected (0.00 sec)

4. After adding the account, create a new/usr/local/zabbix/etc/.my.cnf to provide Zabbix AGENTD access to the database, as follows

# vim/usr/local/zabbix/etc/.my.cnf [mysql]host = Localhostuser = Mysql_datapassword = [email Protected]socket = /var/lib/mysql/mysql.sock[mysqladmin]host = Localhostuser = Mysql_datapassword = [email protected]socket =/var /lib/mysql/mysql.sock

5. After modifying the above information, restart ZABBIX_AGENTD.

6. After the above information is modified, you can view the MySQL monitoring information graph on the monitoring page.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/E1/wKiom1WKYdXgFClIAAQsrhvmlmo217.jpg "style=" width : 750px;height:188px; "title=" 2.png "width=" height= "188" border= "0" hspace= "0" vspace= "0" alt= " Wkiom1wkydxgfcliaaqsrhvmlmo217.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/E1/wKiom1WKYdWg-ghRAATm82AxV2k707.jpg "style=" width : 750px;height:224px; "title=" 3.png "width=" height= "224" border= "0" hspace= "0" vspace= "0" alt= " Wkiom1wkydwg-ghraatm82axv2k707.jpg "/>

How to install Zabbix and add a template link next article.

This article is from the "aestheticism" blog, make sure to keep this source http://cctian.blog.51cto.com/10445650/1665070

Zabbix using your own template to monitor MySQL

Related Article

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.