actiontech_zabbix_mysql_monitor
actiontech_zabbix_mysql_monitor copied to clipboard
监控项增加、调整建议
-
增加监控状态、配置信息:read_only、server_id 获取方式 show variables like 'server_id' show global status like 'read_only'
-
用户会话非空闲状态的top3持续时间 目前进取show processlist或select * from Information_schema.processlist输出中time字段,并未进行过滤 建议 获取show processlist或select * from Information_schema.processlist输出中time字段,根据以下条件过滤 states not in ('','sleep') and user not in ('root','repl') 并且展示数据建议使用用户与时间关联,而非TOP
-
未提交事务最长持续时间 建议监控未提交事务的状态,如果存在多值取top3即可。 SELECT p.user,p.time FROM information_schema.innodb_trx t INNER JOIN information_schema.processlist p ON t.trx_mysql_thread_id = p.id WHERE t.trx_state = 'RUNNING' AND p.time > 10 AND p.command = 'Sleep'; 展示数据建议使用用户与时间关联
解决方案:
- 新增监控项read_only、server_id
- 脚本新增item:read_only、server_id
- actiontech_zbx_3.4_template_mysql_server.xml模板新增两个<item_prototype>,分别展示read only(text类型)、server_id(numeric unsigned类型)
- 开启方式同其它获取方式为show variables的item,默认开启
- 修改item为Time_top_1~Time_top_10的监控项
- 获取数据的sql:SELECT time FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state NOT IN ('','sleep') AND user != 'root' AND db != 'NULL'
- item名称及数量不改变
- actiontech_zbx_3.4_template_mysql_server.xml模板删减Time_top_4~Time_top_10的<item_prototype>
- 新增未提交事务最长持续时间监控
- 脚本新增item:uncommitted_trx_duration_top_1、uncommitted_trx_duration_top_2、uncommitted_trx_duration_top_3
- actiontech_zbx_3.4_template_mysql_server.xml模板新增三个<item_prototype>,分别展示uncommitted_trx_duration_top_1、uncommitted_trx_duration_top_2、uncommitted_trx_duration_top_3(numeric unsigned类型)
- 脚本监控开关参数“--get_uctrx_dur_mysql”,false为不开启,true为开启,默认开启