配置好prometheus数据源
wget-t1000-chttps://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz tarzxvfmysqld_exporter-0.12.1.linux-amd64.tar.gz-C/opt/ cd/opt/mysqld_exporter-0.12.1.linux-amd64 exportDATA_SOURCE_NAME= exporter:mima@(localhost:3306)/ ./mysqld_exporter 这里配置用户名暗码是通过情况变量的形式, set to true to collect user statistics --collect.info_schema.clientstats Ifrunning with userstat=1,info,设置好prometheus数据源。
set to true to collect table statistics --collect.info_schema.schemastats Ifrunning with userstat=1, mysqld_exporter是用于获取mysql实例的指标处事, 安装 mysql授权 CREATE USER exporter@localhostidentified by mima ; GRANT PROCESS,error,fatal] --log.format=logger:stderr Set thelogtarget and format.Example: logger:syslog?appname=boblocal=7 or logger:stdout?json=true --versionShowapplicationversion. 陈设处事 直接注册成systemd处事,有人已经设置好了图形可以通过grafana官方下的dashboard找到mysqld_exporter相关的dashboard就可以直接利用了, set to true to collectclient statistics --collect.info_schema.tablestats Ifrunning with userstat=1,warn。
原文地点:https://www.toutiao.com/i6911310105698943491/ , or * for all --collect.mysql.user.privileges Enablecollecting user privileges from mysql. user --collect.perf_schema.eventsstatements.limit=250 Limitthenumber of eventsstatementsdigests by response time --collect.perf_schema.eventsstatements.timelimit=86400 Limithowoldthe last_seen eventsstatementscanbe, SELECT ON *.* TO exporter @ localhost WITH MAX_USER_CONNECTIONS3; flush privileges ; 直接通过呼吁下载就可以了,REPLICATIONCLIENT,直接导入grafana就可以直接展示了, --helpShowcontext-sensitivehelp(alsotry--help-longand--help-man). --exporter.lock_wait_timeout=2 Set alock_wait_timeout on the connection to avoidlongmetadatalocking. --exporter.log_slow_filter Add alog_slow_filter to avoidslowquerylogging of scrapes.NOTE: Not supported by OracleMySQL. --collect.heartbeat.database=heartbeat Database from where to collectheartbeatdata --collect.heartbeat.table=heartbeat Table from where to collectheartbeatdata --collect.info_schema.processlist.min_time=0 Minimum time athreadmustbe in eachstate to becounted --collect.info_schema.processlist.processes_by_user Enablecollectingthenumber of processes by user --collect.info_schema.processlist.processes_by_host Enablecollectingthenumber of processes by host --collect.info_schema.tables.databases=* Thelist of databases to collect table stats for ,可以直接利用grafana,也可以利用参数--config.my-cnf=/opt/mysqld_exporter/.my.cnf 举办配置, ./mysqld_exporter --config.my-cnf=/opt/mysqld_exporter/.my.cnf 其他参数 usage:mysqld_exporter[flags] Flags: -h, set to true to collect schema statistics --collect.perf_schema.file_events Collectmetrics from performance_schema.file_summary_by_event_name --collect.perf_schema.file_instances Collectmetrics from performance_schema.file_summary_by_instance --collect.perf_schema.replication_group_member_stats Collectmetrics from performance_schema.replication_group_member_stats --collect.perf_schema.replication_applier_status_by_worker Collectmetrics from performance_schema.replication_applier_status_by_worker --collect.engine_innodb_status Collect from SHOWENGINEINNODBSTATUS --collect.heartbeatCollectfromheartbeat --collect.slave_hostsScrapeinformationfromSHOWSLAVEHOSTS --collect.info_schema.innodb_cmp Collectmetrics from information_schema.innodb_cmp --collect.info_schema.innodb_cmpmem Collectmetrics from information_schema.innodb_cmpmem --collect.info_schema.query_response_time Collectqueryresponse time distributionifquery_response_time_stats is ON . --collect.engine_tokudb_status Collect from SHOWENGINETOKUDBSTATUS --log.level=infoOnlylogmessageswiththegivenseverityorabove.Validlevels:[debug, ```bash #!/bin/bash VERSION= 0.12.1 wget-t100-chttps://github.com/prometheus/mysqld_exporter/releases/download/v${VERSION}/mysqld_exporter-${VERSION}.linux-amd64.tar.gz if[!-emysqld_exporter-${VERSION}.linux-amd64.tar.gz] then echo 安装包下载失败 exit1 fi tarxvfzmysqld_exporter-${VERSION}.linux-amd64.tar.gz-C/opt/ cd/opt ln-smysqld_exporter-${VERSION}.linux-amd64mysqld_exporter cat/etc/systemd/system/mysqld_exporter.serviceEOF [Unit] Description=mysqld_exporter After =network.target [Service] Type=simple WorkingDirectory=http://www.zzvips.com/opt/mysqld_exporter ExecStart=http://www.zzvips.com/opt/mysqld_exporter/mysqld_exporter --config.my-cnf=/opt/mysqld_exporter/.my.cnf LimitNOFILE=65536 PrivateTmp= true RestartSec=2 StartLimitInterval=0 Restart=always [Install] WantedBy=multi- user .target EOF ``` systemctldaemon-reload systemctlenablemysqld_exporter systemctlstartmysqld_exporter 设置prometheus Job 默认端口是9104 -job_name: mysqld_exporter #metrics_pathdefaults to /metrics #schemedefaults to http . static_configs: -targets:[ localhost:9104 ] 指标展示 指标可以通过prometheus的WebUI举办查察 [prometheserverip]:9090 假如需要绘图,默认找的设置文件是~/.my.cnf,也可以用设置文件。
in seconds --collect.perf_schema.eventsstatements.digest_text_limit=120 Maximumlength of thenormalizedstatementtext --collect.perf_schema.file_instances.filter=.* RegExfile_namefilter for performance_schema.file_summary_by_instance --collect.perf_schema.file_instances.remove_prefix=/var/lib/mysql/ Removepathprefix in performance_schema.file_summary_by_instance --web.listen-address=:9104 Address to listen on for webinterface and telemetry. --web.telemetry-path=/metrics Pathunderwhich to exposemetrics. --timeout-offset=0.25Offsettosubtractfromtimeoutinseconds. --config.my-cnf=/home/jalright/.my.cnf Path to .my.cnffile to read MySQLcredentials from . --collect.mysql.userCollectdatafrommysql.user --collect.info_schema.tables Collectmetrics from information_schema.tables --collect.info_schema.innodb_tablespaces Collectmetrics from information_schema.innodb_sys_tablespaces --collect.info_schema.innodb_metrics Collectmetrics from information_schema.innodb_metrics --collect.global_statusCollectfromSHOWGLOBALSTATUS --collect.global_variables Collect from SHOW GLOBAL VARIABLES --collect.slave_statusCollectfromSHOWSLAVESTATUS --collect.info_schema.processlist Collect current threadstatecounts from theinformation_schema.processlist --collect.perf_schema.tablelocks Collectmetrics from performance_schema.table_lock_waits_summary_by_table --collect.perf_schema.eventsstatements Collectmetrics from performance_schema.events_statements_summary_by_digest --collect.perf_schema.eventsstatementssum Collectmetrics of grandsums from performance_schema.events_statements_summary_by_digest --collect.perf_schema.eventswaits Collectmetrics from performance_schema.events_waits_summary_global_by_event_name --collect.auto_increment.columns Collectauto_incrementcolumns and max values from information_schema --collect.binlog_sizeCollectthecurrentsizeofallregisteredbinlogfiles --collect.perf_schema.tableiowaits Collectmetrics from performance_schema.table_io_waits_summary_by_table --collect.perf_schema.indexiowaits Collectmetrics from performance_schema.table_io_waits_summary_by_index_usage --collect.info_schema.userstats Ifrunning with userstat=1,。
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/xt/linux/12929.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
并进行了数次优化更改
时间:2021-01-23
-
在Linus发表文章的第二年
时间:2021-01-23
-
当一个文件被加载时
时间:2021-01-21
-
与--delete 呼应的是--exis
时间:2021-01-21
-
$top top-18:50:38up6days
时间:2021-01-21
-
CLI和程序包管理器使开发
时间:2021-01-20
-
但是有时候这个系统上跑
时间:2021-01-20
-
配置好prometheus数据源
时间:2021-01-20
热门文章
-
Anki:让记忆更轻松的开源神器
时间:2020-12-22
-
配置好prometheus数据源
时间:2021-01-20
-
如何在Linux启动时自动启动LXD容器
时间:2020-12-22
-
使用Vi/Vim编辑器:基础篇
时间:2020-12-22
-
linux系统比windows系统声音小怎么办?
时间:2021-01-08
-
使用parallel利用起你的所有CPU资源
时间:2020-12-22
-
Zsync:一个仅下载文件新的部分的传输工
时间:2020-12-22
-
Linux SecureCRT显示乱码解决方案
时间:2021-01-05
-
linux 防御SYN攻击步骤详解
时间:2020-12-23
-
在Linus发表文章的第二年
时间:2021-01-23
