mysqld_exporter是mysql信息1、背景2、prometheus访问mysqld_exporter1,安装mysqld_exporter2,将mysqld_exporter用户
一.背景
使用mysqld_exporter获取mysql的度量信息。
二. prometheus访问mysqld_exporter 1,安装mysqld_exporter #,然后单击mysqld _ exporter wget https://github.com/Prometheus 下载mysqld _ eeer mysqld _ exporter-0.12.1.Darwin-amd64.tar.gz # tar-zxvf mysqld _ exporter-0.12.1
2、创建mysqld_exporter用户,然后创建create user ' mysqld _ exporter ' @ ' localhost ' identified by ' mysqld exporter 1993 ' with max注意:
创建用户时,建议您运行MAX_USER_CONNECTIONS参数。 这样做是为了防止数据库连接数过多,导致数据库压力过大。
3 .创建my.cnf配置文件在与mysqld_exporter文件相同级别的文件夹中创建my.cnf文件。 文件的内容如下。
将[ client ] user=mysqld _ exporter password=mysqld exporter 1993 host=localhost port=3306,mysqld_exporternohup/user --config.my-CNF='/users/Huan/soft/Prometheus/mysqld _ exporter/my.cn f '- weetheus
参数说明-config.config.my-CNF指定配置文件的路径。 -web.listen-address指定监听地址,端口-log.level指定日志级别5,捕获的mysql度量信息http://localhost 33609088/localhost
6、prometheus中的scrape _ configs 3360-job _ name : ' mysqld-exporter ' static _ configs 3360-targets 3360 [ ' locets 3360 ]
三、 部分警告指标groups :-name : galeraalertsrules :-alert : mysqlgaleranotreadyexpr : MySQL _ global _ status _ wsreeation 3360 warning annotations : description : ' { $ labels.job } } on { $ labels.instan ns } is not ready.' summary : galeraclusternodenotready-alert : mysqlgaleraoutofsyncexpr : (MySQL _ global _ status _ statu stus ) ables _ ws rep _ de sync==0(for :5 mlabels 3360 severity : warning annotations 3360 descriptions=4) . ' summary : galeraclusternodeoutofsync-alert : mysqlgaleradonorfallingbehindexpr : (MySQL _ global _ stus _ watu watu stus ) SQL _ global _ status _ ws rep _ local _ recv _ queue 100 ) for :5 mlabels 3360 severity 3360 warning annotations 3360 descr rity 3360 warningannotations 3360 on { $ labels.instance } isadonor(hotbackup ) andisfallingbehind (queuesize { $ value } ) ) . ' summary 3360 xtradbclusterdonornodefallingbehind-alert : mysqlreplicationnotrunningexpr : MySQL _ slave _ stu status==0for :2 mlabels 3360 severity 3360 critical annotations 3360 description ) hasbeendownformorethan2minutes.summary 3360 slavere 60 mysqlreplicationlagexpr 3360 (instancancing lave _ lag _ seconds 30 (andon (instance ) ) predict_linear ) instance : 60*2(0) ) for :1 mlabels 3360 severity : critical annotations : description : themysqlslavereplicationhasfallenbehindandisnotrecovorecovon eplicationislagging-alert : mysqlreplicationlagexpr : (instance : MySQL _ heart beat _ lag () )。 andon(instance(predict_linear ) instance : MySQL _ heart beat _ lag _ seconds [ 5m ], 60*2(0) ) for :1 mlabels 3360 severity : critical annotations : description : themysqlslavereplicationhasfallenbehindandisnotrecovorecovon eplicationislagging-alert : mysqlinnodblogwaitsexpr : rate (MySQL _ global _ status _ innn odb (10 labels : serits severitity n : theinnodblogsarewaitingfordiskatarateof { $ value }/second summary 3360 mysqlinnodblogwritesstalling参考连接: https://githuting
四.参考链接1、mysqld_exporter的github地址
2、创建mysql的部分报警