Use Zabbix to monitor MySQL (source installation) installation location in/usr/local/zabbix/
-
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