这篇文章给大家介绍zabbix监控mysql的步骤是什么,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
cat /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
UserParameter=mysql.ping,HOME=/var/lib/zabbix mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
UserParameter=mysql_innodb_locks,/data/mysql/bin/mysql -udba -BNe " SELECT count(1) FROM INFORMATION_SCHEMA.INNODB_LOCKS;"
UserParameter=mysql_innodb_waits,/data/mysql/bin/mysql -udba -BNe " SELECT count(1) FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;"
UserParameter=mysql_waitting_flush,/data/mysql/bin/mysql -udba -BNe " select count(1) from information_schema.processlist where state like '%Waiting for table%';"
UserParameter=mysql_master_status,/data/mysql/bin/mysql -udba -e 'show slave status/G' |grep -E "Slave_IO_Running|Slave_SQL_Running"|awk '{print $2}'|grep -c Yes
UserParameter=Seconds_Behind_Master,/data/mysql/bin/mysql -udba -e 'show slave status/G' |grep -E "Seconds_Behind_Master"|awk '{print $2}'
zabbix_get -s 10.102.3.17 -k mysql_master_status
创建mysql监控模板,创建项目,创建触发器
关于zabbix监控mysql的步骤是什么就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/199885.html