Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

监控项增加、调整建议 #23

Open
ianholyoung opened this issue Jul 15, 2020 · 1 comment
Open

监控项增加、调整建议 #23

ianholyoung opened this issue Jul 15, 2020 · 1 comment

Comments

@ianholyoung
Copy link

ianholyoung commented Jul 15, 2020

  1. 增加监控状态、配置信息:read_only、server_id
    获取方式
    show variables like 'server_id'
    show global status like 'read_only'

  2. 用户会话非空闲状态的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

  3. 未提交事务最长持续时间
    建议监控未提交事务的状态,如果存在多值取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';
    展示数据建议使用用户与时间关联

@ianholyoung ianholyoung changed the title 监控项增加、调整 监控项增加、调整建议 Jul 15, 2020
@ColdWaterLW
Copy link

解决方案:

  1. 新增监控项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,默认开启
  2. 修改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>
  3. 新增未提交事务最长持续时间监控
    • 脚本新增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为开启,默认开启

re-f added a commit that referenced this issue Jul 24, 2020
re-f added a commit that referenced this issue Jul 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants