Zabbix monitoring mysql-How to use Zabbix's own template monitoring-nagios monitor MySQL master and slave

Source: Internet
Author: User

Use Zabbix to monitor MySQL (source installation) installation location in/usr/local/zabbix/


    1. Monitoring side (server):

      On the monitored side host, associate the template with the templates App MySQL

Chinese: Configuration---host---Name column click Go to template, click Link New template, add->template App mysql-> Archive

English: Configuration->hosts->name->templates,link new templates->add->template App MySQL->Save


2. The monitored side (agent):

1) in the source package: /zabbix-2.2.1/conf/zabbix_agentd/Copy Template

CP zabbix-2.2.1/conf/zabbix_agentd/userparameter_mysql.conf/usr/local/zabbix/etc/zabbix_agentd.conf.d/

2) Grant user rights to monitor MySQL information

Mysql> Grant Usage on * * to [e-mail protected] ' localhost ' identified by ' Zabbix ';

3) Modify MY.CNF

[Mysqladmin]host=localhostuser=zabbixpassword=zabbix[mysql]host=localhostuser=zabbixpassword=zabbix

4) Modify

Vim /usr/local/zabbix/etc/zabbix_agentd.conf.d/userparameter_mysql.confuserparameter=mysql.status[*],echo   "Show global status where variable_name= ';"  | HOME=/var/lib/zabbix mysql -uzabbix -pzabbix -hlocalhost -N |  awk  ' {print $$2} ' 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=/var/lib/zabbix mysql -uzabbix -pzabbix -hlocalhost -nuserparameter =mysql.ping,home=/var/lib/zabbix mysqladmin&nbSp;-uzabbix -pzabbix -hlocalhost ping | grep -c aliveuserparameter= Mysql.version,mysql -uzabbix -pzabbix -hlocalhost -v

5)

#/etc/init.d/mysqld restart#/etc/init.d/zabbix_agentd Restart

6) Viewing the image data on the server

monitoring->graphs->mysql Operations


Nagios monitors master and slave

ls /usr/local/nagios/etc/objects/commands.cfg# vim /usr/local/nagios/etc/objects/ Commands.cfgdefine command  {         command_name     check_mysql_slave         command_line    $USER 1$/check_mysql -h  $HOSTADDRESS $ -s -uzabbix -pzabbix  } Modify the configuration file on the monitored side # vim zabbix_agent.cfg  define service{         use                              local-service         host_name                        zabbix_agent         service_description             mysql_slave         check_command                    check_mysql_slave                      }/etc/init.d/nagios  restart



This article is from "Grasshopper Boy" blog, please make sure to keep this source http://zxlwz.blog.51cto.com/6952946/1853566

Zabbix monitoring mysql-How to use Zabbix's own template monitoring-nagios monitor MySQL master and slave

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.