Skip to content
MySQL Monitor Script
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
common
etc update doc about ignore_file (#43) Dec 27, 2018
fixtures
vendor
.gitignore update vendor and fix #38 Oct 18, 2018
CHANGES.md
LICENSE init Jun 1, 2015
Makefile
NOTICE add new features that running long time in xiaomi Aug 6, 2018
README.md
VERSION
const.go add new features that running long time in xiaomi Aug 6, 2018
doc.go add new features that running long time in xiaomi Aug 6, 2018
genver.sh update vendor and fix #38 Oct 18, 2018
main.go fix issue #17 & tag is_slave bug Aug 8, 2018
main_test.go add new features that running long time in xiaomi Aug 6, 2018
metalinter.json fix issue #17 & tag is_slave bug Aug 8, 2018
metric.go add debug and readme Oct 17, 2018
metric_test.go
metrics.txt init Jun 1, 2015
senddata.go add debug and readme Oct 17, 2018
senddata_test.go add new features that running long time in xiaomi Aug 6, 2018
show.go update vendor and fix #38 Oct 18, 2018
show_test.go update vendor and fix #38 Oct 18, 2018

README.md

README.md

Introduction

mymon(MySQL-Monitor) 是Open-Falcon用来监控MySQL数据库运行状态的一个插件,采集包括global status, global variables, slave status以及innodb status等MySQL运行状态信息。

Installation

# Build
go get -u github.com/open-falcon/mymon
cd $GOPATH/src/github.com/open-falcon/mymon
make

# Add to crontab
echo '* * * * * cd ${WORKPATH} && ./mymon -c etc/myMon.cfg' > /etc/cron.d/mymon

Configuration

配置文件采用INI标准。

[default]
basedir = . # 工作目录
log_dir = ./fixtures # 日志目录,默认日志文件为myMon.log,旧版本有log_file项,如果同时设置了,会优先采用log_file
ignore_file = ./falconignore # 配置忽略的metric项
snapshot_dir = ./snapshot # 保存快照(process, innodb status)的目录
snapshot_day = 10 # 保存快照的时间(日)
log_level  = 5 #  日志级别[RFC5424]
# 0 LevelEmergency
# 1 LevelAlert
# 2 LevelCritical
# 3 LevelError
# 4 LevelWarning
# 5 LevelNotice
# 6 LevelInformational
# 7 LevelDebug
falcon_client=http://127.0.0.1:1988/v1/push # falcon agent连接地址

[mysql]
user=root # 数据库用户名
password=1tIsB1g3rt # 您的数据库密码
host=127.0.0.1 # 数据库连接地址
port=3306 # 数据库端口

Metric

采集的metric信息,请参考./metrics.txt。该文件仅供参考,实际采集信息会根据MySQL版本、配置的不同而变化。

ignore项

ignore项配置,是用来屏蔽之前在falcon中设好的报警项,会将原有的metric更改名称之后上传,使原有的报警策略不再生效。由于falcon中的屏蔽策略,只能屏蔽endpoint级别,所以在mymon中的ignore功能是帮助提高了报警屏蔽粒度,而非忽略该metric的上报。

同步延迟

关于同步延迟检测的metric有两个: Seconds_Behind_MasterHeartbeats_Behind_Master

Seconds_Behind_Master是MySQLSHOW SLAVE STATUS输出的状态变量。由于低版本的MySQL还不支持HEARTBEAT_EVENT,在低版本的MySQL中该状态可能会由于IO线程假死导致测量不准确,因此mymon增加了Heartbeats_Behind_Master。它依赖于pt-heartbeat,统计基于pt-heartbeat生成的mysql.heartbeat表中的ts字段值与从库当前时间差。如果未配置pt-heartbeat,则该项上报-1值。

关于pt-heartbeat的配置使用,链接如下: https://www.percona.com/doc/percona-toolkit/LATEST/pt-heartbeat.html

Contributors

You can’t perform that action at this time.