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

圖文結(jié)合丨Prometheus+Grafana+GreatSQL性能監(jiān)控系統(tǒng)搭建指南

數(shù)據(jù)庫 其他數(shù)據(jù)庫
Push Gateway : 主要用于短期的 jobs。由于這類 jobs 存在時(shí)間較短,可能在 Prometheus 來 pull 之前就消失了。為此,這次 jobs 可以直接向 Prometheus server 端推送它們的 metrics。這種方式主要用于服務(wù)層面的metrics,對于機(jī)器層面的 metrices,需要使用 node exporter。

一、環(huán)境介紹

本文環(huán)境,以及本文所采用數(shù)據(jù)庫為GreatSQL 8.0.32-24

$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
$ uname -a
Linux gip 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
$ ldd --version
ldd (GNU libc) 2.17

二、手動安裝

0.簡單介紹

  • Prometheus Server : 用于收集和存儲時(shí)間序列數(shù)據(jù)。
  • Client Library : 客戶端庫,為需要監(jiān)控的服務(wù)生成相應(yīng)的 metrics 并暴露給 Prometheus server。當(dāng)Prometheus server 來 pull 時(shí),直接返回實(shí)時(shí)狀態(tài)的 metrics。
  • Push Gateway : 主要用于短期的 jobs。由于這類 jobs 存在時(shí)間較短,可能在 Prometheus 來 pull 之前就消失了。為此,這次 jobs 可以直接向 Prometheus server 端推送它們的 metrics。這種方式主要用于服務(wù)層面的metrics,對于機(jī)器層面的 metrices,需要使用 node exporter。
  • Exporters : 用于暴露已有的第三方服務(wù)的 metrics 給 Prometheus。
  • Alertmanager : 從 Prometheus server 端接收到 alerts 后,會進(jìn)行去除重復(fù)數(shù)據(jù),分組,并路由到對收的接收方式,發(fā)出報(bào)警。常見的接收方式有:電子郵件,pagerduty,OpsGenie, webhook 等。

網(wǎng)上介紹很多這里就不再過多介紹了

1.安裝Prometheus

官網(wǎng)下載最新二進(jìn)制安裝包? https://prometheus.io/download/

可以看到有很多的版本,這里選擇LTS的版本,LTS在軟件版本中通常表示Long Term Support,即長期支持版本。

對于Prometheus來說。LTS版本表示這個(gè)版本會獲得更長期的支持和維護(hù),而非LTS版本則更新頻繁。新特性來得快。但穩(wěn)定性和支持周期較短,所以在追求穩(wěn)定的生產(chǎn)環(huán)境中。建議優(yōu)先考慮使用LTS長期支持版本。

圖片圖片

這里選擇二進(jìn)制軟件包prometheus-2.45.0.linux-amd64.tar.gz

$ mkdir /usr/local/prometheus
$ cd /usr/local/prometheus
$ wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz

下載完成后,用sha256sum校驗(yàn)一下安裝包,沒問題的話解壓即可

$ sha256sum prometheus-2.45.0.linux-amd64.tar.gz
1c7f489a3cc919c1ed0df2ae673a280309dc4a3eaa6ee3411e7d1f4bdec4d4c5
$ tar xvf prometheus-2.45.0.linux-amd64.tar.gz

建議使用Systemd來管理守護(hù)進(jìn)程Prometheus服務(wù)

若文件路徑或名字和本文不同記得修改

$ vi /lib/systemd/system/prometheus.service
[Unit]
Descriptinotallow=Prometheus server
Documentatinotallow=https://prometheus.io/docs/introduction/overview/
After=network-online.target

[Service]
Type=simple
User=root
Group=root
Restart=on-abnormal
ExecStart=/usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus \
  --config.file=/usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml \
  --storage.tsdb.path=/usr/local/prometheus/prometheus-2.45.0.linux-amd64/data \
  --storage.tsdb.retention.time=60d \
  --web.enable-lifecycle

[Install]
WantedBy=multi-user.target

使用$ ./prometheus -h 就可以看到幫助信息

通知Systemd重新加載配置文件

$ systemctl daemon-reload

以下為相關(guān)Systemd命令$ systemctl enable prometheus # 設(shè)置為開機(jī)自啟$ systemctl disable prometheus # 關(guān)閉開機(jī)自啟$ systemctl start prometheus # 開啟服務(wù)$ systemctl status prometheus # 查看狀態(tài)$ systemctl restart prometheus # 重啟服務(wù)$ systemctl stop prometheus # 停止服務(wù)

啟動Prometheus server,并查看是否啟動成功active (running)

$ systemctl start prometheus.service

$ systemctl status prometheus.service
● prometheus.service - Prometheus server
   Loaded: loaded (/usr/lib/systemd/system/prometheus.service; disabled; vendor preset: disabled)
   Active: active (running) since 三 2023-09-06 16:14:34 CST; 2s ago
     Docs: https://prometheus.io/docs/introduction/overview/
 Main PID: 21472 (prometheus)
   CGroup: /system.slice/prometheus.service
           └─21472 /usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus --config.file=/usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml --storage.tsdb.path=/usr/local/pr...
#下方省略

若啟動失敗可自行排查 $ journalctl -u prometheus.service -f

訪問地址

名稱

地址

prometheus

http://172.17.137.104:9090/

監(jiān)控指標(biāo)

http://172.17.137.104:9090/metrics

界面如下

安裝完成Prometheus,接下來安裝Alertmanager

2.安裝Alertmanager

官網(wǎng)下載? https://prometheus.io/download/

這里我們選擇alertmanager-0.26.0.linux-amd64.tar.gz

$ cd /usr/local/prometheus
$ wget https://github.com/prometheus/alertmanager/releases/download/v0.26.0/alertmanager-0.26.0.linux-amd64.tar.gz

下載完成后,用sha256sum校驗(yàn)一下安裝包,沒問題的話解壓即可

$ sha256sum alertmanager-0.26.0.linux-amd64.tar.gz
abd73e2ee6bf67d3888699660abbecba7b076bf1f9459a3a8999d493b149ffa6
$ tar xvf alertmanager-0.26.0.linux-amd64.tar.gz

建議使用Systemd來管理守護(hù)進(jìn)程Alertmanager服務(wù)

若文件路徑或名字,和下方示例不同記得修改

$ vi /lib/systemd/system/alertmanager.service
[Unit]
Descriptinotallow=Alert Manager
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=root
Group=root
Restart=always
ExecStart=/usr/local/prometheus/alertmanager-0.26.0.linux-amd64/alertmanager \
  --config.file=/usr/local/prometheus/alertmanager-0.26.0.linux-amd64/alertmanager.yml \
  --storage.path=/usr/local/prometheus/alertmanager-0.26.0.linux-amd64/data

[Install]
WantedBy=multi-user.target

通知Systemd重新加載配置文件

$ systemctl daemon-reload

啟動alertmanager.service

$ systemctl start alertmanager.service

若啟動失敗可自行排查journalctl -u alertmanager.service -f

訪問地址

應(yīng)用名稱

地址

Alertmanager

http://172.17.137.104:9093/

Alertmanager界面如下

添加Prometheus配置

因?yàn)槲覀儼惭b了Alertmanager,所以需要添加到Prometheus里面

$ vi /usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml

把# - alertmanager:9093修改為localhost:9093

因?yàn)槲覀兪茄b在同一個(gè)機(jī)器上,所以是localhost,若安裝不在同一個(gè)機(jī)器上請修改為正確IP地址

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          - localhost:9093 <--修改這里,注意縮進(jìn)

注意!yml文件是有縮進(jìn)格式的,修改時(shí)不要打亂原有格式

在rule_files:添加- "alert.yml",前面縮進(jìn)只需保留兩格!

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - "alert.yml"  <--添加這里,注意縮進(jìn)2格即可
  # - "first_rules.yml"
  # - "second_rules.yml"

增加觸發(fā)器配置文件

編輯新文件alert.yml添加以下內(nèi)容,注意格式縮進(jìn)

$ vi /usr/local/prometheus/prometheus-2.45.0.linux-amd64/alert.yml

groups:
- name: Prometheus alert
  rules:
  # 任何實(shí)例超過30s無法聯(lián)系的情況發(fā)出告警
  - alert: 服務(wù)告警
    expr: up == 0
    for: 30s
    labels:
      severity: critical
    annotations:
      instance: "{{ $labels.instance  }}"
      description: "{{ $labels.job  }} 服務(wù)已關(guān)閉"

檢查一下配置文件,與下方一致即為成功

$ cd /usr/local/prometheus/prometheus-2.45.0.linux-amd64
$ ./promtool check config prometheus.yml
Checking prometheus.yml
  SUCCESS: 1 rule files found
 SUCCESS: prometheus.yml is valid prometheus config file syntax

Checking alert.yml
  SUCCESS: 1 rules found

接下來重啟一下Prometheus或重新加載配置文件

$ systemctl restart prometheus
# 二選一即可
$ curl -X POST http://localhost:9090/-/reload

再次訪問http://172.17.137.104:9093/,并檢查Status,確認(rèn)沒有問題

圖片圖片

3.安裝Grafana

官網(wǎng)下載Grafana? https://grafana.com/grafana/download

進(jìn)入官網(wǎng)后選擇Linux,下方會展示出安裝方式,這里選擇二進(jìn)制的方式安裝

$ wget https://dl.grafana.com/enterprise/release/grafana-enterprise-10.1.1.linux-amd64.tar.gz
$ tar -zxvf grafana-enterprise-10.1.1.linux-amd64.tar.gz

創(chuàng)建 Systemd 服務(wù)

$ vi /lib/systemd/system/grafana-server.service
[Unit]
Descriptinotallow=Grafana server
Documentatinotallow=https://doce.grafana.org

[Service]
Type=simple
User=root
Group=root
Restart=on-abnormal
ExecStart=/usr/local/prometheus/grafana-10.1.1/bin/grafana-server \
  --cnotallow=/usr/local/prometheus/grafana-10.1.1/conf/defaults.ini \
  --homepath=/usr/local/prometheus/grafana-10.1.1

[Install]
WantedBy=multi-user.target

通知 Systemd 重新加載配置文件

$ systemctl daemon-reload

啟動grafana-server.service

$ systemctl start grafana-server.service

若啟動失敗可自行排查journalctl -u grafana-server.service -f

訪問地址:

應(yīng)用名稱

地址

Grafana

http://172.17.137.104:3000/

圖片圖片

沒問題安裝成功!

4.安裝node_exporter

下載node_exporter? https://prometheus.io/download/

下拉網(wǎng)頁找到node_exporter選擇對應(yīng)文件名下載即可

$ wget https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
#驗(yàn)證一下是否下載完整
$ sha256sum node_exporter-1.6.1.linux-amd64.tar.gz
$ tar -xvf node_exporter-1.6.1.linux-amd64.tar.gz

創(chuàng)建 Systemd 服務(wù)

$ vi /lib/systemd/system/node_exporter.service
[Unit]
Descriptinotallow=node_exporter
Documentatinotallow=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=root
Group=root
Restart=on-abnormal
ExecStart=/usr/local/prometheus/node_exporter-1.6.1.linux-amd64/node_exporter

[Install]
WantedBy=multi-user.target

通知 Systemd 重新加載配置文件

$ systemctl daemon-reload

啟動alertmanager.service

$ systemctl start node_exporter.service

若啟動失敗可自行排查journalctl -u node_exporter.service -f

node_exporter訪問地址

應(yīng)用名稱

地址

node_exporter

http://172.17.137.104:9100/metrics

添加Prometheus配置

安裝完成后還需要添加Prometheus配置,為避免大家打錯(cuò),這里采用追加寫入

$ cat >> /usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml <<"EOF"
# 在scrape_configs這行下面添加配置
  - job_name: "node-exporter"
    scrape_interval: 15s
    static_configs:
      - targets: ["localhost:9100"]
        labels:
          instance: prometheus服務(wù)器
EOF

重載Prometheus配置

$ curl -X POST http://localhost:9090/-/reload

Prometheus web上檢查一下 http://172.17.137.104:9090/點(diǎn)擊Status->Targets

可以看到有node_exporter,以及可以檢查下我們配置的觸發(fā)器Alerts->勾選Inactive

至此,通過二進(jìn)制安裝Prometheus就到此完成!

三、使用Grafana

1. 添加Prometheus數(shù)據(jù)源

我們可以進(jìn)入Grafana對監(jiān)控的內(nèi)容做一個(gè)圖形的展示,登入http://172.17.137.104:3000/

圖片圖片

輸入默認(rèn)用戶名admin,默認(rèn)密碼admin,之后會提示你修改密碼,然后就成功登入Grafana

圖片圖片

進(jìn)入后添加Prometheus的數(shù)據(jù)源,在Connections里有Data sources,總之找到Data sources即可

圖片圖片

點(diǎn)擊Add data source選擇Prometheus,進(jìn)入配置

在紅框處填寫Prometheus地址,因?yàn)楸疚牟渴鹪诒緳C(jī),所以是localhost,填寫完成后滑動頁面到最下方,點(diǎn)擊Save & test保存和測試

2.導(dǎo)入Grafana儀表盤

下載Grafana儀表盤? https://grafana.com/grafana/dashboards/

圖片圖片

紅框框起來的就是我們需要下載的Node Exporter Full,如果首頁沒有展示的話,可以直接搜索

點(diǎn)擊進(jìn)去,選擇Copy ID to clipboard復(fù)制ID

圖片圖片

進(jìn)入http://172.17.137.104:3000/到Grafana上,選擇Dashboards,點(diǎn)擊New

選擇Import

在紅框處粘貼剛剛復(fù)制的,其實(shí)也就是1860,接著點(diǎn)擊LOAD加載

圖片圖片

可以修改一下名字,在選擇下Prometheus點(diǎn)擊Import導(dǎo)入即可

圖片圖片

這樣就完成了Grafana對Prometheus數(shù)據(jù)的展示

四、監(jiān)控GreatSQL

不建議采用GreatSQL的root用戶監(jiān)控,因?yàn)閞oot的權(quán)限非常大,所以我們進(jìn)入GreatSQL先創(chuàng)建一個(gè)用于監(jiān)控的用戶

greatsql> CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'GreatSQL@666';
greatsql> GRANT PROCESS,REPLICATION CLIENT,SELECT ON *.* TO 'exporter'@'localhost';

接下來需要安裝mysqld_exporter,本文依舊采用二進(jìn)制方式安裝

在https://prometheus.io/download/中找到mysqld_exporter,下載即可

$ wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.15.0/mysqld_exporter-0.15.0.linux-amd64.tar.gz
#驗(yàn)證一下是否下載完整
$ sha256sum mysqld_exporter-0.15.0.linux-amd64.tar.gz
$ tar -xvf mysqld_exporter-0.15.0.linux-amd64.tar.gz

創(chuàng)建一個(gè)連接數(shù)據(jù)庫的文件.mysqld_exporter.cnf

$ vi /usr/local/prometheus/mysqld_exporter-0.15.0.linux-amd64/.mysqld_exporter.cnf
#填入以下內(nèi)容即可
[client]
user=exporter
password=GreatSQL@666
host=localhost
port=3306

創(chuàng)建 Systemd 服務(wù)

$ vi /lib/systemd/system/mysqld_exporter.service
[Unit]
Descriptinotallow=Prometheus GreatSQL
After=network.target

[Service]
Type=simple
User=root
Group=root
Restart=always
ExecStart=/usr/local/prometheus/mysqld_exporter-0.15.0.linux-amd64/mysqld_exporter \
  --config.my-cnf=/usr/local/prometheus/mysqld_exporter-0.15.0.linux-amd64/.mysqld_exporter.cnf \
  --collect.global_status \
  --collect.auto_increment.columns \
  --collect.info_schema.processlist \
  --collect.binlog_size \
  --collect.info_schema.tablestats \
  --collect.global_variables \
  --collect.info_schema.innodb_metrics \
  --collect.info_schema.query_response_time \
  --collect.info_schema.userstats \
  --collect.info_schema.tables \
  --collect.perf_schema.tablelocks \
  --collect.perf_schema.file_events \
  --collect.perf_schema.eventswaits \
  --collect.perf_schema.indexiowaits \
  --collect.perf_schema.tableiowaits \
  --collect.slave_status \
  --collect.perf_schema.replication_group_members \
  --collect.perf_schema.replication_group_member_stats \
  --web.listen-address=0.0.0.0:9104

[Install]
WantedBy=multi-user.target

通知 Systemd 重新加載配置文件

$ systemctl daemon-reload

啟動alertmanager.service

$ systemctl start mysqld_exporter.service

若啟動失敗可自行排查journalctl -u mysqld_exporter.service -f

訪問一下看看能否成功http://172.17.137.104:9104

1.添加Prometheus配置

安裝完成后還需要添加Prometheus配置,為避免大家打錯(cuò),這里采用追加寫入

$ cat >> /usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml <<"EOF"
# mysqld-exporter配置
  - job_name: "mysqld-exporter"
    static_configs:
      - targets: ["localhost:9104"]
        labels:
          instance: prometheus服務(wù)器
EOF

重載Prometheus配置

$ curl -X POST http://localhost:9090/-/reload

Prometheus web上檢查一下 http://172.17.137.104:9090/,點(diǎn)擊Status->Targets

圖片

2.增加觸發(fā)器配置文件

編輯prometheus.yml在rule_files:添加- "alert.yml",前面縮進(jìn)只需保留兩格!

$ vi /usr/local/prometheus/prometheus-2.45.0.linux-amd64/prometheus.yml

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  - "alert.yml"
  - "rules/*.yml"  <-添加這里,注意縮進(jìn)2格即可
  # - "first_rules.yml"
  # - "second_rules.yml"

表示把rules文件夾下的所有yml文件都導(dǎo)入進(jìn)來

$ mkdir /usr/local/prometheus/prometheus-2.45.0.linux-amd64/rules
$ vi /usr/local/prometheus/prometheus-2.45.0.linux-amd64/rules/mysqld.yml
groups:
- name: GreatSQL
  rules:
  # 任何實(shí)例超過30s無法聯(lián)系的情況發(fā)出告警
  - alert: GreatSQLDown
    expr: mysql_up == 0
    for: 30s
    labels:
      severity: critical
    annotations:
      summary: "GreatSQL Down,實(shí)例:{{ $labels.instance }}"
      description: "連接不上GreatSQL了,當(dāng)前狀態(tài)為:{{ $value }}"

類似的告警信息都可以自行編寫

檢查一下配置文件,出現(xiàn)SUCCESS: prometheus.yml is valid prometheus config file syntax即為成功

$ cd /usr/local/prometheus/prometheus-2.45.0.linux-amd64
$ ./promtool check config prometheus.yml
Checking prometheus.yml
  SUCCESS: 2 rule files found
 SUCCESS: prometheus.yml is valid prometheus config file syntax
Checking alert.yml
  SUCCESS: 1 rules found
Checking rules/mysqld.yml
  SUCCESS: 1 rules found

接下來重啟一下 Prometheus 或重新加載配置文件

$ systemctl restart prometheus
# 二選一即可
$ curl -X POST http://localhost:9090/-/reload

再次訪問http://172.17.137.104:9093/,并檢查Status,確認(rèn)沒有問題

3.導(dǎo)入Grafana儀表盤

展示 Prometheus 從 mysql_exporter 收集到的數(shù)據(jù),添加儀表盤ID7362

圖片圖片

修改名稱后點(diǎn)擊Import即可

圖片圖片

可以看到頁面中已經(jīng)展示了許多內(nèi)容,例如GreatSQL數(shù)據(jù)庫運(yùn)行的時(shí)間,QPS值,InnoDB Buffer Pool Size,Buffer Poll of Total RAM等

這里Buffer Poll of Total RAM值有些低,說明設(shè)置的InnoDB buffer pool大小不對,應(yīng)該設(shè)置約占用總內(nèi)存的50%到75%,這樣可以合理利用內(nèi)存,提高緩存命中率。

來簡單看幾個(gè)監(jiān)控項(xiàng)目的意義和內(nèi)容

  • MySQL Connections,監(jiān)控GreatSQL的連接數(shù),有最大連接數(shù)及最大使用連接數(shù)
  • MySQL Client Thread Activity,監(jiān)控GreatSQL的活動線程數(shù),有連接線程數(shù)(Threads Connected)和運(yùn)行線程數(shù)(Threads Running)
  • MySQL Table Locks,監(jiān)控GreatSQL的表鎖,我們可以看到GreatSQL從存儲引擎請求了多少表級鎖。在InnoDB的情況下,很多時(shí)候鎖實(shí)際上可能是行鎖,因?yàn)樗辉谏贁?shù)特定情況下使用表級鎖。比較“立即鎖定”和“等待鎖定”最有用。如果等待的鎖數(shù)正在上升,則表示存在鎖爭用。否則,鎖立即上升和下降是正?;顒印?/li>

查看下QPS是如何監(jiān)控的,鼠標(biāo)移動到內(nèi)容的右上角,會出現(xiàn)三個(gè)點(diǎn),點(diǎn)擊Edit,進(jìn)入編輯

圖片圖片

可以看到如下內(nèi)容

圖片圖片

這段監(jiān)控規(guī)則中使用了rate()和irate()函數(shù)來計(jì)算GreatSQL queries狀態(tài)計(jì)數(shù)器的速率。

  • mysql_global_status_queries{instance="$host"} 表示提取實(shí)例host的queries全局狀態(tài)計(jì)數(shù)器。
  • rate()函數(shù)計(jì)算該計(jì)數(shù)器在$interval時(shí)間段內(nèi)的每秒速率。
  • irate()函數(shù)計(jì)算該計(jì)數(shù)器在最近5分鐘的每個(gè)瞬時(shí)速率。
  • 或運(yùn)算符表示取這兩者中的較大值。

如果覺得你想監(jiān)控的內(nèi)容沒有你想要的,可以點(diǎn)擊右上角Add,點(diǎn)擊Visualization添加監(jiān)控內(nèi)容

圖片圖片

例如我想添加一個(gè)group_replication_flow_control_countMGR累計(jì)觸發(fā)流控的次數(shù),在Select metric中搜索想監(jiān)控的狀態(tài),

圖片圖片

label標(biāo)簽

Label filters用于過濾和選擇時(shí)間序列數(shù)據(jù)。它可以針對特定的標(biāo)簽值來選擇顯示哪些時(shí)間序列。

例如instance="192.168.1.1:9090"表示只選擇instance標(biāo)簽值為"192.168.1.1:9090"的時(shí)間序列。

可以在Grafana的面板中使用Label filters字段來指定過濾條件,其作用主要包括:

  • 選擇特定實(shí)例的數(shù)據(jù):如instance="A" 只看實(shí)例A的數(shù)據(jù)
  • 查看特定模式匹配的實(shí)例:如instance=~"10\\.8\\..*"選取符合模式的實(shí)例
  • 查看某個(gè)狀態(tài)的序列:state="200" 只看狀態(tài)碼為200的
  • 組合多個(gè)標(biāo)簽進(jìn)行過濾: instance=~"1\\d\\.8\\..*",state!="500"
  • 也可以直接輸入PromQL進(jìn)行各種復(fù)雜過濾

Operations

Operations選項(xiàng)允許對查詢結(jié)果進(jìn)行各種操作,常用的操作及含義如下:

  • Rate:計(jì)算計(jì)數(shù)器的增長速率,常用于計(jì)數(shù)器指標(biāo)的速率轉(zhuǎn)換,如QPS。
  • Delta:計(jì)算時(shí)間序列的增量變化值。
  • Derivative:計(jì)算時(shí)間序列的一階導(dǎo)數(shù),表示瞬時(shí)變化率。
  • Integral:對時(shí)間序列求積分,計(jì)算面積圖。
  • Aggregation:對結(jié)果series做聚合,如平均,最大最小值等。
  • Transform:進(jìn)行數(shù)學(xué)變換,如log等。
  • Aliasing:結(jié)果串進(jìn)行重命名。
  • Group by:分組歸類。

我們可以選中Metric后,在Operations下拉列表中選擇所需要的計(jì)算操作。這些操作無需修改PromQL查詢語句,在結(jié)果集上進(jìn)行,可以方便地衍生出新的時(shí)間序列。例如可以將 COUNTER 計(jì)數(shù)器轉(zhuǎn)換為 QPS 速率等。這為Grafana提供了靈活的統(tǒng)計(jì)和分析能力。

添加完成參數(shù)后點(diǎn)擊Apply應(yīng)用即可,回到界面上就可以看到剛剛添加的監(jiān)控項(xiàng)了

圖片圖片

記得要對整個(gè)儀表盤也保存,點(diǎn)擊右上角圖標(biāo)如下所示,保存即可

圖片圖片

也可以對表的情況進(jìn)行監(jiān)控,只需導(dǎo)入儀表盤ID9625

圖片圖片

至此,通過Prometheus監(jiān)控GreatSQL到此結(jié)束,下部文章將介紹如何使用告警功能

責(zé)任編輯:武曉燕 來源: GreatSQL社區(qū)
相關(guān)推薦

2020-11-20 08:15:40

Grafana + P

2023-06-28 10:24:04

2023-12-27 08:47:41

PrometheusLinux架構(gòu)

2023-04-26 00:01:04

2022-07-29 21:23:54

Grafana微服務(wù)

2021-07-01 11:29:45

KubernetesGrafana監(jiān)控

2023-12-27 18:05:13

2023-02-28 22:52:47

2023-10-11 09:58:07

2020-12-30 08:09:46

運(yùn)維Prometheus 監(jiān)控

2021-01-08 09:02:19

CentOS7Prometheus監(jiān)控

2020-12-30 05:34:25

監(jiān)控PrometheusGrafana

2022-11-08 00:00:00

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

2025-01-27 08:23:41

2024-07-12 12:43:51

2020-12-29 10:45:22

運(yùn)維Prometheus-監(jiān)控

2019-07-31 10:18:17

Web 開發(fā)Python

2022-07-26 09:34:23

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

2022-07-11 13:43:51

Prometheus監(jiān)控

2020-12-28 10:13:32

運(yùn)維Prometheus監(jiān)控
點(diǎn)贊
收藏

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