自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

運維監(jiān)控系統(tǒng)之Prometheus-MySQLl監(jiān)控

運維 系統(tǒng)運維
mysqld_exporter是用于獲取mysql實例的指標(biāo)服務(wù)。

 簡介

mysqld_exporter是用于獲取mysql實例的指標(biāo)服務(wù)。


安裝

mysql授權(quán)

  1. CREATE USER exporter@localhost identified by "mima"
  2. GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost' WITH MAX_USER_CONNECTIONS 3; 
  3. flush privileges

 直接通過命令下載就可以了。

  1. wget -t 1000 -c https://github.com/prometheus/mysqld_exporter/releases/download/v0.12.1/mysqld_exporter-0.12.1.linux-amd64.tar.gz 
  2. tar zxvf  mysqld_exporter-0.12.1.linux-amd64.tar.gz -C /opt/ 
  3. cd /opt/mysqld_exporter-0.12.1.linux-amd64 
  4. export DATA_SOURCE_NAME='exporter:mima@(localhost:3306)/' 
  5. ./mysqld_exporter 

 這里設(shè)置用戶名密碼是通過環(huán)境變量的形式,也可以用配置文件,默認(rèn)找的配置文件是~/.my.cnf,也可以使用參數(shù)--config.my-cnf="/opt/mysqld_exporter/.my.cnf" 進(jìn)行設(shè)置。

  1. ./mysqld_exporter --config.my-cnf="/opt/mysqld_exporter/.my.cnf" 

其他參數(shù)

  1. usage: mysqld_exporter [<flags>] 
  2.  
  3. Flags: 
  4.   -h, --help                   Show context-sensitive help (also try --help-long and --help-man). 
  5.       --exporter.lock_wait_timeout=2   
  6.                                Set a lock_wait_timeout on the connection to avoid long metadata locking. 
  7.       --exporter.log_slow_filter   
  8.                                Add a log_slow_filter to avoid slow query logging of scrapes. NOTE: Not supported by Oracle MySQL. 
  9.       --collect.heartbeat.database="heartbeat"   
  10.                                Database from where to collect heartbeat data 
  11.       --collect.heartbeat.table="heartbeat"   
  12.                                Table from where to collect heartbeat data 
  13.       --collect.info_schema.processlist.min_time=0   
  14.                                Minimum time a thread must be in each state to be counted 
  15.       --collect.info_schema.processlist.processes_by_user   
  16.                                Enable collecting the number of processes by user 
  17.       --collect.info_schema.processlist.processes_by_host   
  18.                                Enable collecting the number of processes by host 
  19.       --collect.info_schema.tables.databases="*"   
  20.                                The list of databases to collect table stats foror '*' for all 
  21.       --collect.mysql.user.privileges   
  22.                                Enable collecting user privileges from mysql.user 
  23.       --collect.perf_schema.eventsstatements.limit=250   
  24.                                Limit the number of events statements digests by response time 
  25.       --collect.perf_schema.eventsstatements.timelimit=86400   
  26.                                Limit how old the 'last_seen' events statements can be, in seconds 
  27.       --collect.perf_schema.eventsstatements.digest_text_limit=120   
  28.                                Maximum length of the normalized statement text 
  29.       --collect.perf_schema.file_instances.filter=".*"   
  30.                                RegEx file_name filter for performance_schema.file_summary_by_instance 
  31.       --collect.perf_schema.file_instances.remove_prefix="/var/lib/mysql/"   
  32.                                Remove path prefix in performance_schema.file_summary_by_instance 
  33.       --web.listen-address=":9104"   
  34.                                Address to listen on for web interface and telemetry. 
  35.       --web.telemetry-path="/metrics"   
  36.                                Path under which to expose metrics. 
  37.       --timeout-offset=0.25    Offset to subtract from timeout in seconds. 
  38.       --config.my-cnf="/home/jalright/.my.cnf"   
  39.                                Path to .my.cnf file to read MySQL credentials from
  40.       --collect.mysql.user     Collect data from mysql.user 
  41.       --collect.info_schema.tables   
  42.                                Collect metrics from information_schema.tables 
  43.       --collect.info_schema.innodb_tablespaces   
  44.                                Collect metrics from information_schema.innodb_sys_tablespaces 
  45.       --collect.info_schema.innodb_metrics   
  46.                                Collect metrics from information_schema.innodb_metrics 
  47.       --collect.global_status  Collect from SHOW GLOBAL STATUS 
  48.       --collect.global_variables   
  49.                                Collect from SHOW GLOBAL VARIABLES 
  50.       --collect.slave_status   Collect from SHOW SLAVE STATUS 
  51.       --collect.info_schema.processlist   
  52.                                Collect current thread state counts from the information_schema.processlist 
  53.       --collect.perf_schema.tablelocks   
  54.                                Collect metrics from performance_schema.table_lock_waits_summary_by_table 
  55.       --collect.perf_schema.eventsstatements   
  56.                                Collect metrics from performance_schema.events_statements_summary_by_digest 
  57.       --collect.perf_schema.eventsstatementssum   
  58.                                Collect metrics of grand sums from performance_schema.events_statements_summary_by_digest 
  59.       --collect.perf_schema.eventswaits   
  60.                                Collect metrics from performance_schema.events_waits_summary_global_by_event_name 
  61.       --collect.auto_increment.columns   
  62.                                Collect auto_increment columns and max values from information_schema 
  63.       --collect.binlog_size    Collect the current size of all registered binlog files 
  64.       --collect.perf_schema.tableiowaits   
  65.                                Collect metrics from performance_schema.table_io_waits_summary_by_table 
  66.       --collect.perf_schema.indexiowaits   
  67.                                Collect metrics from performance_schema.table_io_waits_summary_by_index_usage 
  68.       --collect.info_schema.userstats   
  69.                                If running with userstat=1, set to true to collect user statistics 
  70.       --collect.info_schema.clientstats   
  71.                                If running with userstat=1, set to true to collect client statistics 
  72.       --collect.info_schema.tablestats   
  73.                                If running with userstat=1, set to true to collect table statistics 
  74.       --collect.info_schema.schemastats   
  75.                                If running with userstat=1, set to true to collect schema statistics 
  76.       --collect.perf_schema.file_events   
  77.                                Collect metrics from performance_schema.file_summary_by_event_name 
  78.       --collect.perf_schema.file_instances   
  79.                                Collect metrics from performance_schema.file_summary_by_instance 
  80.       --collect.perf_schema.replication_group_member_stats   
  81.                                Collect metrics from performance_schema.replication_group_member_stats 
  82.       --collect.perf_schema.replication_applier_status_by_worker   
  83.                                Collect metrics from performance_schema.replication_applier_status_by_worker 
  84.       --collect.engine_innodb_status   
  85.                                Collect from SHOW ENGINE INNODB STATUS 
  86.       --collect.heartbeat      Collect from heartbeat 
  87.       --collect.slave_hosts    Scrape information from 'SHOW SLAVE HOSTS' 
  88.       --collect.info_schema.innodb_cmp   
  89.                                Collect metrics from information_schema.innodb_cmp 
  90.       --collect.info_schema.innodb_cmpmem   
  91.                                Collect metrics from information_schema.innodb_cmpmem 
  92.       --collect.info_schema.query_response_time   
  93.                                Collect query response time distribution if query_response_time_stats is ON
  94.       --collect.engine_tokudb_status   
  95.                                Collect from SHOW ENGINE TOKUDB STATUS 
  96.       --log.level="info"       Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] 
  97.       --log.format="logger:stderr"   
  98.                                Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" 
  99.       --version                Show application version. 

 部署服務(wù)

直接注冊成systemd服務(wù)。

  1. ```bash 
  2. #!/bin/bash 
  3.  
  4. VERSION="0.12.1" 
  5.  
  6. wget  -t 100  -c  https://github.com/prometheus/mysqld_exporter/releases/download/v${VERSION}/mysqld_exporter-${VERSION}.linux-amd64.tar.gz 
  7.  
  8. if [ ! -e mysqld_exporter-${VERSION}.linux-amd64.tar.gz ] 
  9. then 
  10.     echo "安裝包下載失敗" 
  11.     exit 1 
  12. fi 
  13. tar xvfz mysqld_exporter-${VERSION}.linux-amd64.tar.gz -C /opt/ 
  14. cd /opt 
  15. ln -s mysqld_exporter-${VERSION}.linux-amd64  mysqld_exporter 
  16. cat > /etc/systemd/system/mysqld_exporter.service <<EOF 
  17.  
  18. [Unit] 
  19. Description=mysqld_exporter 
  20. After=network.target 
  21.  
  22. [Service] 
  23. Type=simple 
  24. WorkingDirectory=/opt/mysqld_exporter 
  25. ExecStart=/opt/mysqld_exporter/mysqld_exporter --config.my-cnf="/opt/mysqld_exporter/.my.cnf" 
  26. LimitNOFILE=65536 
  27. PrivateTmp=true 
  28. RestartSec=2 
  29. StartLimitInterval=0 
  30. Restart=always 
  31.  
  32. [Install] 
  33. WantedBy=multi-user.target 
  34. EOF 
  35. ​``` 
  36. systemctl daemon-reload 
  37. systemctl enable mysqld_exporter 
  38. systemctl start mysqld_exporter 

 配置prometheus Job

默認(rèn)端口是9104

  1. - job_name: 'mysqld_exporter' 
  2.  
  3.   # metrics_path defaults to '/metrics' 
  4.   # scheme defaults to 'http'
  5.  
  6.   static_configs: 
  7.   - targets: ['localhost:9104'

 指標(biāo)展示

指標(biāo)可以通過prometheus的WebUI進(jìn)行查看

  1. http://[promethe server ip]:9090 

如果需要畫圖,可以直接使用grafana,有人已經(jīng)配置好了圖形可以通過grafana官方下的dashboard找到mysqld_exporter相關(guān)的dashboard就可以直接使用了,配置好prometheus數(shù)據(jù)源,直接導(dǎo)入grafana就可以直接展示了。

 

責(zé)任編輯:姜華 來源: 今日頭條
相關(guān)推薦

2020-12-30 08:09:46

運維Prometheus 監(jiān)控

2020-12-28 10:13:32

運維Prometheus監(jiān)控

2021-07-07 05:46:46

運維監(jiān)控Prometheus

2020-12-17 09:25:46

運維Prometheus監(jiān)控

2020-12-30 05:34:25

監(jiān)控PrometheusGrafana

2022-07-11 13:43:51

Prometheus監(jiān)控

2011-03-21 14:43:42

2023-10-11 09:58:07

2013-04-12 13:30:47

2016-04-06 10:02:23

手機(jī)微博運維監(jiān)控

2014-07-22 10:06:43

運維監(jiān)控虛擬化

2018-09-27 08:59:29

2011-03-25 13:54:00

Nagios

2010-07-09 12:09:34

IT運維Mocha BSM摩卡軟件

2011-01-05 15:39:44

2022-02-08 10:21:17

運維應(yīng)用監(jiān)控

2015-09-23 16:46:54

架構(gòu)監(jiān)控運維自動化

2022-11-08 00:00:00

監(jiān)控系統(tǒng)Prometheus

2020-11-26 09:10:36

Prometheus

2015-09-21 13:41:47

高可用監(jiān)控系統(tǒng)運維自動化
點贊
收藏

51CTO技術(shù)棧公眾號