国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

利用Prometheus與Grafana對Mysql服務(wù)器的性能監(jiān)控詳解

2024-07-24 12:52:23
字體:
供稿:網(wǎng)友

概述

Prometheus是一個開源的服務(wù)監(jiān)控系統(tǒng),它通過HTTP協(xié)議從遠(yuǎn)程的機(jī)器收集數(shù)據(jù)并存儲在本地的時序數(shù)據(jù)庫上。它提供了一個簡單的網(wǎng)頁界面、一個功能強(qiáng)大的查詢語言以及HTTP接口等等。Prometheus通過安裝在遠(yuǎn)程機(jī)器上的exporter來收集監(jiān)控數(shù)據(jù),這里用到了以下兩個exporter:

    node_exporter – 用于機(jī)器系統(tǒng)數(shù)據(jù) mysqld_exporter – 用于Mysql服務(wù)器數(shù)據(jù)

    Grafana是一個開源的功能豐富的數(shù)據(jù)可視化平臺,通常用于時序數(shù)據(jù)的可視化。它內(nèi)置了以下數(shù)據(jù)源的支持:

    并可以通過插件擴(kuò)展支持的數(shù)據(jù)源。

    架構(gòu)圖

    下面是本次部署的架構(gòu)圖

    安裝并運(yùn)行Prometheus

    1.在 Monitor 上安裝 Prometheus

    安裝至/opt/prometheus

    $ wget https://github.com/prometheus/prometheus/releases/download/v1.5.2/prometheus-1.5.2.linux-amd64.tar.gz$ tar zxvf prometheus-1.5.2.linux-amd64.tar.gz$ mv prometheus-1.5.2.linux-amd64 /opt/prometheus

    2.在安裝目下編輯配置文件 prometheus.yml

    vim /opt/prometheus/prometheus.yml
    # my global configglobal: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: monitor: 'codelab-monitor'# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.rule_files: # - "first.rules" # - "second.rules"# A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.scrape_configs: # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] # 以下是添加的部分 - job_name: linux static_configs: - targets: ['172.30.251.214:9100'] labels: instance: db1 - job_name: mysql static_configs: - targets: ['172.30.251.214:9104'] labels: instance: db1

    其中:172.30.251.214是MySQL的IP,端口則是對應(yīng)的exporter的監(jiān)聽端口。

    3.啟動Prometheus

    [loya@centos6 prometheus]$ ./prometheusINFO[0000] Starting prometheus (version=1.5.2, branch=master, revision=bd1182d29f462c39544f94cc822830e1c64cf55b) source=main.go:75INFO[0000] Build context (go=go1.7.5, user=root@a8af9200f95d, date=20170210-14:41:22) source=main.go:76INFO[0000] Loading configuration file prometheus.yml source=main.go:248INFO[0000] Loading series map and head chunks... source=storage.go:373INFO[0000] 0 series loaded. source=storage.go:378INFO[0000] Starting target manager... source=targetmanager.go:61INFO[0000] Listening on :9090 source=web.go:259
    發(fā)表評論 共有條評論
    用戶名: 密碼:
    驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 电白县| 英德市| 苏尼特左旗| 济源市| 柘荣县| 越西县| 独山县| 读书| 岚皋县| 东城区| 洛隆县| 兴文县| 武乡县| 正定县| 宾阳县| 商洛市| 祁门县| 宜兰市| 长岛县| 蓝山县| 洛隆县| 监利县| 云霄县| 临泉县| 阜阳市| 通化县| 南投县| 乐至县| 蓝山县| 左权县| 金昌市| 故城县| 沾益县| 光泽县| 揭东县| 易门县| 长沙县| 乐陵市| 兖州市| 枝江市| 阳城县|