使用開源軟體Prometheus監控企業內部資源
1. 寫在前面
? 在公司行政管理大區內,因為業務體量小,業務變化相對少,之前公司采用的監控技術堆疊較為落后,只有簡單的北塔網路監控,基本沒有任何的監控平臺,
? 接觸Docker和kubernetes時間久了,開源的監控方案所接觸,網上也有不少Zabbix、Nagios、Open-Falcon、Prometheus、Influxdb的對比這里就不一一列舉了,最終公司選擇Prometheus+Grafana+explorer技術堆疊作為企業內部IT資源監控,Prometheus各型別采集器豐富,Grafana儀表板顏值高,基于Docker-compose部署方便,該專案自2018年實施已穩定運行三年,極大縮短了故障排查時間,
2. 監控資源分析
內部需要監控的資源有
- 網路資源:如交換機SNMP、交換機各埠流量
- Windows資源:Windows服務器運行時間、CPU使用率、記憶體使用率、磁盤使用率、磁盤IO、行程數、服務數、網路帶寬情況等
- Linux資源:Linux服務器運行時間、CPU使用率、打開檔案描述符、背景關系切換次數、記憶體使用率、磁盤使用率、磁盤IO、網路帶寬情況等
- Docker資源:各容器CPU使用率、記憶體使用率、網路帶寬情況、磁盤io等
- vSphere資源:vSphere物理節點記憶體、CPU、虛擬機、網路情況,各虛擬機CPU使用率、CPU就緒時間、網路封包、磁盤IO等,
- Oracle資料庫性能情況:資料庫狀態、執行統計、用戶提交/回滾數量、行程數量、表空間使用情況、IO、資源利用率等,
- JVM監控:Java版本、運行時間、加載類總數、執行緒數量、執行緒峰值、死鎖執行緒數量、gc次數等
- 存盤資源監控:Ceph OSD狀態等
- 其他型別監控:連通類監控如埠、HTTP,SSL證書狀態監控等
根據監控資源在GitHub以及Prometheus官網內收集推薦的exporter,總結如下:
| 監控資源 | exporter名稱 | 部署方式 | 專案地址 |
|---|---|---|---|
| SNMP | snmp_exporter | 代理部署 | https://github.com/prometheus/snmp_exporter |
| Windows | windows_exporter | 實體部署 | https://github.com/prometheus-community/windows_exporter |
| Linux | node_exporter | 實體部署 | https://github.com/prometheus/node_exporter |
| Docker | cadvisor | 實體部署 | https://github.com/google/cadvisor/releases/latest |
| vSphere | vmware_exporter | 代理部署 | https://github.com/pryorda/vmware_exporter |
| Oracle | oracledb_exporter | 實體部署 | https://github.com/iamseth/oracledb_exporter |
| JVM | jmx_exporter | 實體部署 | https://github.com/prometheus/jmx_exporter |
| Ceph | ceph_mgr | 實體自帶 | |
| 其他 | Blackbox_exporter | 代理部署 | https://github.com/prometheus/blackbox_exporter |
這是官網上收錄的exporter:https://prometheus.io/docs/instrumenting/exporters/
也可以在GitHub上搜,比如Proxmox就沒有收錄在官方檔案內,
3. 整體架構及實施效果
本次采用Docker-Compose的方式搭建部署,參照Github上的https://github.com/vegasbrianc/prometheus.git進行二次開發,
拓撲如下:

目錄結構如下:
.
├── alertmanager #alertmanager 告警模塊
│ ├── config.yml #alertmanager 組態檔
│ └── wechat.tmpl #alertmanager weChat通知配置
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── dashboards #Grafana默認Dashboard
│ ├── Grafana_Dashboard.json
│ ├── Grafana_Dashboard_prom_2.json
│ └── System_Monitoring.json
├── docker-compose.yml #主要Docker-compose檔案
├── docker-prometheus.dockerapp
│ └── docker-compose.yml
├── docker-stack.yml
├── docker-traefik-stack.yml
├── exporter #explorer 模塊
│ ├── blackbox.yml #blackbox_exporter組態檔
│ ├── oracle_exporter.config #oracle_exporter組態檔
│ ├── snmp.yml #snmp_exporter組態檔
│ └── vmware_exporter.config #vmware_exporter組態檔
├── grafana #Grafana 模塊
│ ├── config.monitoring #Grafana 組態檔夾
│ └── provisioning
│ ├── dashboards
│ │ ├── dashboard.yml
│ │ └── Docker Prometheus Monitoring-1571332751387.json
│ └── datasources
│ └── datasource.yml
├── Grafana_Dashboard.json
├── Grafana Dashboard With Service.json
├── HighLoadDashboard.json
├── images
│ ├── Add_Data_Source.png
│ ├── Dashboard.png
│ ├── Import_Dashboard.png
│ └── mac-filesystem.png
├── ISSUE_TEMPLATE.md
├── LICENSE
├── m3db
├── prometheus #prometheus 模塊
│ ├── alert.rules #prometheus 告警配置
│ └── prometheus.yml #prometheus 配置
├── pwd-stack.yml
└── README.md
我們主要關注prometheus、alertmanager、explorer、Grafana的配置以及docker-compose.yml 即可,在配置完成后,最終專案實施效果如下:
企業微信告警:

監控大屏:

4. Docker-compose配置決議
Docker-compose 可以參照https://github.com/vegasbrianc/prometheus.git上的docker-compose.yml進行修改
該docker-compose主要配置prometheus服務、alertmanager服務、Grafana服務以及需要代理部署的exporter,
prometheus服務:
注:可在docker-compose中配置命令列引數 --storage.tsdb.retention,時間不建議配太長,容易造成磁盤IO高
通過ip:9090埠訪問
version: '3.7'
volumes:
prometheus_data: {}
grafana_data: {}
networks:
front-tier:
back-tier:
services:
prometheus:
image: prom/prometheus:v2.1.0
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml' #定義prometheus組態檔在容器內的地址
- '--storage.tsdb.path=/prometheus' #定義prometheus資料在容器內的地址
- '--storage.tsdb.retention=30d' #定義prometheus保存周期
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
ports:
- 9090:9090
links:
- cadvisor:cadvisor
- alertmanager:alertmanager
# - m3db:m3db
depends_on:
- cadvisor
# - m3db:m3db
networks:
- back-tier
restart: always
# m3db: 預留m3db作為后端持久化存盤
# image: quay.io/m3db/m3dbnode:latest
# volumes:
# - ./m3db/:/var/lib/m3db
# ports:
# - 7201:7201
# - 7203:7203
# - 9003:9003
# networks:
# - back-tier
# restart: always
# deploy:
# mode: global
...
alertmanager服務
通過ip:9093埠訪問
...
alertmanager:
image: prom/alertmanager
ports:
- 9093:9093
volumes:
- ./alertmanager/:/etc/alertmanager/
networks:
- back-tier
restart: always
command:
- '--config.file=/etc/alertmanager/config.yml'
- '--storage.path=/alertmanager'
...
grafana服務
通過ip:3000埠訪問
...
grafana:
image: grafana/grafana
user: "472"
depends_on:
- prometheus
ports:
- 3000:3000
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/:/etc/grafana/provisioning/
env_file:
- ./grafana/config.monitoring
networks:
- back-tier
- front-tier
restart: always
5. Prometheus及Exporter配置
根據Exporter性質,代理部署的Exporter可直接配置在Docker-compose.yml,與prometheus同一個主機,實體部署需要每個實體上部署單獨的Exporter,
建議每個Exporter都用Docker-compose進行納管,
5.1 Prometheus 配置決議
Prometheus 配置位于/prometheus/prometheus.yml 下,主要配置引數可以參考https://prometheus.io/docs/prometheus/latest/configuration/configuration/
5.1.1 組態檔指標說明
- global: 全域配置(如果有內部單獨設定,會覆寫這個引數)
- alerting: 告警插件定義,這里會設定alertmanager這個報警插件,
- rule_files: 告警規則, 按照設定引數進行掃描加載,用于自定義報警規則,其報警媒介和route路由由alertmanager插件實作,
- scrape_configs:采集配置,配置資料源,包含分組job_name以及具體target,采集配置又分為靜態配置和服務發現
原始組態檔內容:
# 全域配置
global:
scrape_interval: 15s # 默認全域每次資料收集的間隔為15s.
evaluation_interval: 15s # 規則掃描時間間隔是15秒,默認不填寫是 1分鐘
# scrape_timeout: 10s #默認收集超時時間為10s
# 告警配置
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets:
- alertmanager:9093 # 告警配置目標設定應與docker-compose中的alertmanager service名稱相同
#告警規則加載
rule_files:
- 'alert.rules'
# - "second_rules.yml"
# 采集配置(靜態)
scrape_configs:
- job_name: 'prometheus' #獨立部署配置
static_configs:
- targets:
- localhost:9090
- job_name: '其他區域交換機' #代理部署配置需要配上,relabel_configs
metrics_path: /snmp #metrics_path指的是exporter訪問路徑
params: #exporter訪問引數
module: [if_mib]
static_configs:
- targets:
- **.**.**.**
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: **.**.**.**:9116 # 替換引數名稱
#通過配置file服務發現 獲取target 'test'
file_sd_configs:
- files:
- /etc/prometheus/file_config/host.json
5.1 node_exporter 配置
5.1.1 實體部署
node_exporter采用go語言開發,專門用來收集*NIX系統中硬體、系統指標,需要在每個實體主機上部署Docker-compose.yml如下:
version: '3.7'
services:
node_exporter:
image: prom/node_exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.ignored-mount-points'
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
ports:
- 9100:9100
restart: always
可見,node_exporter默認開放埠為9100,運行后訪問http://ip:9100/metrics,能夠成功回傳資料即可
配置參考:
–collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\d+n\d+p)\d+$"
#通過正則運算式忽略某些磁盤的資訊收集–collector.filesystem.ignored-mount-points="^/(dev|proc|sys|var/lib/docker/.+)($|/)"
#通過正則運算式忽略某些檔案系統掛載點的資訊收集–collector.filesystem.ignored-fs-types="^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$"
#通過正則運算式忽略某些檔案系統型別的資訊收集–collector.netclass.ignored-devices="^$"
#通過正則運算式忽略某些網路類的資訊收集–collector.netdev.ignored-devices="^$"
#通過正則運算式忽略某些網路設備的資訊收集–collector.netstat.fields="^$"
#通過正則運算式配置需要獲取的網路狀態資訊–collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.fault)."
#通過正則運算式配置vmstat回傳資訊中需要收集的選項
5.1.2 采集配置
在prometheus.yml中添加Job,targets指向已運行node-expoter的主機
- job_name: 'linux-node'
static_configs:
- targets:
- 10.**.**.**:9100
- 10.**.**.**:9100
# 采集node exporter監控資料
5.1.3 儀表板配置
1 Node Exporter for Prometheus Dashboard CN v20201010 by StarsL.cnhttps://grafana.com/grafana/dashboards/8919

資源明細頁截圖 
注意事項:
匯入看板后,請根據實際情況在看板右上角點擊Dashboard settings–Variables設定好變數:
默認已經設定并關聯好job,hostname,node這3個變數,
$node取值node_exporter的instance,IP:埠格式,大部分查詢關聯了這個變數,請確保該變數有效!$maxmount用來查詢當前主機的最大磁區,默認只獲取ext.*和xfs型別的磁區,
5.2 windows_exporter 配置
5.2.1 實體部署
windows_exporter,需要在每個Windows實體上部署,可以從https://github.com/prometheus-community/windows_exporter/releases/ 中下載msi檔案進行安裝,亦可以下載exe檔案直接執行,
軟體運行后訪問http://ip:9182/metrics,能夠成功回傳資料即可,
**注意: ** windows_exporter 不能用于Win7及Windows 2008 R2 以前的版本,
wmi_exporter 宣布更名成windows_exporter后就不支持老版本的Windows,舊版本請下載windows_exporter 0.9.0(wmi_exporter)以前的版本(exe),新版本的指標為window開頭,舊版本指標為wmi開頭,相應的Dashboard需要跟著修改,
5.2.2 采集配置
同node_exporter
5.2.3 儀表板配置
1 windows_exporter for Prometheus Dashboard CN v20201012 by StarsL.cn
https://grafana.com/grafana/dashboards/10467

win2k系列的 wmi_exporter采用該儀表板
3 wmi_exporter 0.7.0+ for Prometheus 監控展示看板(windows監控)
https://grafana.com/grafana/dashboards/11230

5.3 blackbox_exporter 配置
5.3.1 實體部署
blackbox_exporter是代理部署,僅需部署單個實體,通過blackbox.yml告知blackbox_exporter啟用哪些監聽模塊,通過Prometheus配置prometheus.yml實作具體業務探針,Blackbox由于其靈活性,可以探測http、ssh、dns、證書等,是使用率最高的一個模塊,
Docker-compose.yml示例如下:
version: '3.7'
services:
blackbox_exporter:
image: prom/blackbox_exporter:master
depends_on:
- prometheus
ports:
- 9115:9115
command:
- '--config.file=/config/blackbox.yml'
volumes:
- ./exporter/blackbox.yml:/config/blackbox.yml
networks:
- back-tier
restart: always
blackbox.yml配置如下:
modules:
http_2xx:
prober: http
timeout: 10s
http:
preferred_ip_protocol: "ip4" ## 如果http監測是使用ipv4 就要寫上,目前國內使用ipv6很少,
tls: true
tls_config:
insecure_skip_verify: true #因為是自簽名證書,故配
http_post_2xx_query: ## 用于post請求使用的模塊)由于每個介面傳參不同 可以定義多個module
## 用于不同介面(例如此命名為http_post_2xx_query 用于監測query.action介面
prober: http
timeout: 15s
http:
preferred_ip_protocol: "ip4" ##使用ipv4
method: POST
headers:
Content-Type: application/json ##header頭
body: '{"hmac":"","params":{"publicFundsKeyWords":"xxx"}}' ##傳參
tcp_connect: ## TCP模塊
prober: tcp
pop3s_banner:
prober: tcp
tcp:
query_response:
- expect: "^+OK"
tls: true
tls_config:
insecure_skip_verify: false
ssh_banner:
prober: tcp
tcp:
query_response:
- expect: "^SSH-2.0-"
irc_banner:
prober: tcp
tcp:
query_response:
- send: "NICK prober"
- send: "USER prober prober prober :prober"
- expect: "PING :([^ ]+)"
send: "PONG ${1}"
- expect: "^:[^ ]+ 001"
icmp: ## icmp模塊
prober: icmp
timeout: 5s
icmp:
dns_gdyd: ## dns模塊
prober: dns
timeout: 5s
dns:
query_name: "phpoa.gdyd.com" #檢查指定DNS記錄
query_type: "A"
valid_rcodes:
- NOERROR
5.3.2 采集配置
由于blackbox_exporter屬于代理配置,需要在每個Job下面增加標簽重命名,否則所有被探測的實體都只會顯示blackbox_exporter的ip
- job_name: "blackbox_埠監控"
...
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.45.**.xx:9115
ICMP監控(Ping)
由于target很多,這里按照target進行分組,并附上labels標簽env作為區分
- job_name: 'blackbox_ping'
scrape_interval: 5s
metrics_path: /probe
params:
module: [icmp] #ping
static_configs:
- targets:
- 10.**.**.**
labels:
env: '門禁設備'
- targets:
- 10.**.**.**
labels:
env: '網路安全設備'
- targets:
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
labels:
env: '綜合辦公樓交換機'
- targets:
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
- 10.**.**.**
labels:
env: '中心機房交換機'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.45.**.**:9115 # Blackbox exporter.
blackbox_埠監控
使用blackbox tcp_connect模塊,相關模塊配置在blackbox.yml
- job_name: "blackbox_埠監控"
scrape_interval: 5s
metrics_path: /probe
params:
module: [tcp_connect] #呼叫tcp_connect模塊
static_configs:
- targets:
- '10.**.**.xx:8200'
labels:
env: 'SIS時序資料庫'
- targets:
- '10.**.**.xx:1521'
labels:
env: 'Oracle資料庫'
- targets:
- 10.**.**.xx:3306
labels:
env: 'Mysql資料庫'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.**.**.xx:9115 #blackbox_exporter ip
HTTP監控實體
相關模塊配置在blackbox.yml,注意 insecure_skip_verify: true必須加上,否則自簽證書的http監控會報無法連接,
modules:
http_2xx:
prober: http
timeout: 10s
http:
preferred_ip_protocol: "ip4" ## 如果http監測是使用ipv4 就要寫上,目前國內使用ipv6很少,
tls: true
tls_config:
insecure_skip_verify: true #因為是自簽名證書,故配該選項
prometheus.yml
- job_name: 'blackbox_HTTP監控'
scrape_interval: 45s
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- http://10.45.**.**
- http://phpoa.gdyd.com/
- https://www.baidu.com
- https://mail.dms.yudean.com
- http://eip.itc.gdyd.com/static/d/realtimeload.html
- https://mobile.gdphdc.com:***/lead_adapter/portal/login.lead
labels:
env: 'HTTP業務'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.**.**.**:9115 # The blackbox exporter's real hostname:port.
DNS監控配置
dns監控需要告知blackbox指定的域名決議,若域名決議成功,證明dns正常,blackbox.yaml配置如下
dns_gdyd: ## dns模塊
prober: dns
timeout: 5s
dns:
query_name: "phpoa.gdyd.com" #檢查指定DNS A記錄
query_type: "A"
valid_rcodes:
- NOERROR
prometheus.yml
- job_name: "blackbox_dns"
scrape_interval: 5s
static_configs:
metrics_path: /probe
params:
module: [dns_gdyd]
static_configs:
- targets:
- 10.45.**.**
- 10.45.**.**
labels:
env: '集團DNS業務'
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.**.**.**:9115
5.3.3 儀表板配置
2 Blackbox Exporter 0.14 for Prometheus 監控展示看板by StarsL.cn
https://grafana.com/grafana/dashboards/9965
目前在使用的TCP,ICMP,HTTPS服務狀態監控 Prometheus Blackbox Exporter,在一個看板里面展示,做了展示效果的優化,支持多服務同時展示,需要使用的可以參考下,記得根據自己的實際情況修改下變數,
記得安裝餅圖插件

5.4 snmp_exporter 配置
snmp_exporter的配置為snmp.yml,該配置需要用SNMP Exporter Config Generator來生成,
5.4.1 實體部署
-
用Docker方式使用SNMP Exporter Config Generator生成snmp.yml,Generator位于snmp_exporter/generator 內
#克隆snmp_exporter專案 git clone https://github.com/prometheus/snmp_exporter.git #創建mibs檔案夾 cd snmp_exporter/generator mkdir mibs -
將交換機的mib檔案放入mib檔案夾內,
收集 MIBs
- Cisco: ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
- APC: https://download.schneider-electric.com/files?p_File_Name=powernet432.mib
- Servertech: ftp://ftp.servertech.com/Pub/SNMP/sentry3/Sentry3.mib
- Palo Alto PanOS 7.0 enterprise MIBs: https://www.paloaltonetworks.com/content/dam/pan/en_US/assets/zip/technical-documentation/snmp-mib-modules/PAN-MIB-MODULES-7.0.zip
- Arista Networks: https://www.arista.com/assets/data/docs/MIBS/ARISTA-ENTITY-SENSOR-MIB.txt https://www.arista.com/assets/data/docs/MIBS/ARISTA-SW-IP-FORWARDING-MIB.txt https://www.arista.com/assets/data/docs/MIBS/ARISTA-SMI-MIB.txt
- Synology: https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_MIB_File.zip
- MikroTik: http://download2.mikrotik.com/Mikrotik.mib
- UCD-SNMP-MIB (Net-SNMP): http://www.net-snmp.org/docs/mibs/UCD-SNMP-MIB.txt
- Ubiquiti Networks: http://dl.ubnt-ut.com/snmp/UBNT-MIB http://dl.ubnt-ut.com/snmp/UBNT-UniFi-MIB https://dl.ubnt.com/firmwares/airos-ubnt-mib/ubnt-mib.zip
這是一個很全的mib庫:https://github.com/librenms/librenms/tree/master/mibs
-
使用snmptranslate查看MIB相關oid
snmptranslate -Tz -m mib檔案 -
修改generator.yml,提供模塊串列,最簡單的模塊只是一個名稱和一組要遍歷的 OID,
modules: if_mib: walk: - 1.3.6.1.4.1.41475 #自定義oid version: 2 auth: community: **** #snmp團體名密碼 -
生成snmp.yml,
make mibs docker build -t snmp-generator . docker run -ti \ -v "${PWD}:/opt/" \ snmp-generator generate
使用docker-compose啟動smnp_exporter
version: '3.7'
services:
snmp_exporter:
image: prom/snmp_exporter-linux-amd64
depends_on:
- prometheus
ports:
- 9116:9116
volumes:
- ./exporter/snmp.yml:/etc/snmp_exporter/snmp.yml
networks:
- back-tier
restart: always
至此已完成smnp實體部署,
5.4.2 采集配置
- job_name: 'BJ-BG-Center-3750-A' # 交換機型別的名稱表示采用Job做區分,然后多類交換機寫多個Job對應即可
static_configs:
- targets:
- '192.168.4.1' # 交換機的IP地址
metrics_path: /snmp
params:
module: [if_mib] # 如果是其他設備,可以采用其他模塊,比如cisco_wlc AP設備, ddwrt 軟路由等等
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.**.**.**:9116
5.4.3 儀表板配置
可根據這個儀表板做一下修改
https://grafana.com/grafana/dashboards/1124

5.5 vmware_exporter 配置
5.5.1 實體部署
vmware_exporter屬于實體部署exporter,可以向其傳遞環境變數或組態檔,傳遞環境變數需要大寫,傳遞組態檔需要在命令列中增加 -c config.yml ,以下采用外掛環境變數檔案進行傳參
version: '3.7'
services:
vmware_exporter:
image: pryorda/vmware_exporter
depends_on:
- prometheus
ports:
- 9272:9272
env_file:
- ./exporter/vmware_exporter.config
networks:
- back-tier
restart: always
vmware_exporter.config 如下
VSPHERE_USER=administrator@vsphere.local #vsphere用戶名
VSPHERE_PASSWORD=**** #vsphere密碼
VSPHERE_HOST=10.**.**.** #vsphere 地址
VSPHERE_IGNORE_SSL=True # 忽略證書錯誤
VSPHERE_SPECS_SIZE=2000
其他環境變數及配置說明如下:
| 環境變數 | 配置方式 | 默認 | 描述 |
|---|---|---|---|
VSPHERE_HOST | config, env, get_param | n/a | vsphere server地址 |
VSPHERE_USER | config, env | n/a | vsphere User |
VSPHERE_PASSWORD | config, env | n/a | vsphere Password |
VSPHERE_SPECS_SIZE | config, env | 5000 | Size of specs list for query stats function |
VSPHERE_IGNORE_SSL | config, env | False | 忽略證書錯誤 |
VSPHERE_FETCH_CUSTOM_ATTRIBUTES | config, env | False | 是否獲取自定義屬性 |
VSPHERE_FETCH_TAGS | config, env | False | 是否獲取自定義標簽 |
VSPHERE_FETCH_ALARMS | config, env | False | 是否獲取告警 |
VSPHERE_COLLECT_HOSTS | config, env | True | 是否獲取主機資訊 |
VSPHERE_COLLECT_DATASTORES | config, env | True | 是否獲取存盤資訊 |
VSPHERE_COLLECT_VMS | config, env | True | 是否獲取虛擬機資訊 |
VSPHERE_COLLECT_VMGUESTS | config, env | True | 是否獲取虛擬機guest資訊 |
VSPHERE_COLLECT_SNAPSHOTS | config, env | True | 是否獲取快照資訊 |
詳情參見:https://github.com/pryorda/vmware_exporter
5.5.2 采集配置
- job_name: vmware_export
metrics_path: /metrics
static_configs:
- targets:
- vcenter01
- vcenter02
- vcenter03
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: exporter_ip:9272
5.6 oracle_exporter 配置
略,實驗證明oracle_exporter對公司內Oracle 10版本來說不太穩定,隔一段時間后會掛,且對Oracle資料庫具有一定的壓力,后放棄對Oracle的監控,可參考https://github.com/iamseth/oracledb_exporter
5.7 ceph-mgr配置
5.7.1 實體部署
在Ceph Luminous之前的版本,可以使用第三方的Prometheus exporterceph_exporter,
Ceph Luminous 12.2.1的mgr中自帶了Prometheus插件,內置了 Prometheus ceph exporter,可以使用Ceph mgr內置的exporter作為Prometheus的target,需要進入mgr節點輸入命令
# 啟用Ceph的Prometheus插件
ceph mgr module enable prometheus
5.7.2 采集配置
- job_name: 'ceph_exporter'
static_configs:
- targets: ['10.**.**.**:9283']
labels:
instance: ceph
cluster: ceph
5.7.3 儀表板配置
https://grafana.com/grafana/dashboards/2842

5.8 容器監控配置
? 為了解決docker stats的問題(存盤、展示),谷歌開源了cadvisor不僅可以搜集一臺機器上所有運行的容器資訊,還提供基礎查詢界面和http介面,方便其他組件如Prometheus進行資料抓取,cAdvisor可以對節點機器上的資源及容器進行實時監控和性能資料采集,包括CPU使用情況、記憶體使用情況、網路吞吐量及檔案系統使用情況,Cadvisor使用Go語言開發,利用Linux的cgroups獲取容器的資源使用資訊,在K8S中集成在Kubelet里作為默認啟動項,官方標配,
5.8.1 實體配置
? 在有docker的主機上,執行以下命令
docker run \
-v=/:/rootfs:ro \
-v=/var/run:/var/run:rw \
-v=/sys:/sys:ro \
-v=/var/lib/docker/:/var/lib/docker:ro \
-v=/dev/disk/:/dev/disk:ro \
-p=8765:8080 \
-d \
--name=cadvisor \
google/cadvisor:latest
注意:
在Ret Hat,CentOS, Fedora 等發行版上需要傳遞如下引數,因為 SELinux 加強了安全策略:
–privileged=true
啟動后訪問:http://127.0.0.1:8765查看頁面,/metric查看指標
5.8.2 采集配置
- job_name: 'cadvisor'
scrape_interval: 5s
static_configs:
- targets:
- 10.**.**.**:8765
5.8.3 儀表盤配置
Docker monitoring with node selectionby Nazar
https://grafana.com/grafana/dashboards/8321

5.9 Java監控配置
5.9.1 實體配置
Java監控需要運行Jmx_exporter,其原理是在Java運行的時候呼叫-javaagent引數,指定jar 運行,
- jmx_prometheus_javaagent-0.16.1.jar 適用于 Java >= 7.
- jmx_prometheus_javaagent-0.16.1_java6.jar 適用于 Java 6.
java -javaagent:./jmx_prometheus_javaagent-0.16.1.jar=埠名稱:config.yaml -jar springboot.jar
Tips:一般的Java中間件都會參考系統環境變數JAVA_OPTIONS,可以將-javaagent引數寫入JAVA_OPTIONS中
#Windows 環境變數寫法 JAVA_OPTIONS=%JAVA_OPTIONS%;-javaagent:c:\jmx_prometheus_javaagent-0.16.1.jar=8083:c:\config.yaml #Linux 環境變數寫法 JAVA_OPTIONS=$JAVA_OPTIONS./jmx_prometheus_javaagent-0.16.1.jar=8083:config.yaml
config.yaml 可根據github上的示例,根據不同中間件來配置,
github上已有常見的weblogic、tomcat的配置,直接參考即可
https://github.com/prometheus/jmx_exporter/tree/master/example_configs
5.9.2 采集配置
采集配置根據引數中暴露的埠定義即可
- job_name: 'java'
scrape_interval: 5s
static_configs:
- targets:
- 10.**.**.**:8083
5.9.3 儀表盤配置
JMX Overview by rogerw

https://grafana.com/grafana/dashboards/3457
6. 告警配置決議
6.1 alertmanager配置
config.yml
global:
resolve_timeout: 5m # 在沒有報警的情況下宣告為已解決的時間
# 配置郵件發送資訊
templates:
- '/etc/alertmanager/wechat.tmpl' #告警模板
route:
# 將傳入的報警中有這些標簽的分為一個組.
# 比如, cluster=A 和 alertname=LatencyHigh 會分成一個組.
group_by: ['alertname']
# 指分組創建多久后才可以發送壓縮的警報,也就是初次發警報的延時.
# 這樣會確保第一次通知的時候, 有更多的報警被壓縮在一起.
group_wait: 10s
# 當第一個通知發送,等待多久發送壓縮的警報
group_interval: 10s
# 默認的接收器
receiver: 'wechat'
receivers:
- name: 'wechat' # 子節點 - 微信
wechat_configs:
- corp_id: 'xxxxx' # 企業微信corpid
to_party: '13' # 組ID
agent_id: '1000015' # agentid
api_secret: 'xxxxxxxxxxxxxxxxxxx' # 企業微信corp secret
send_resolved: true # 告警解除后否發送通知
告警模板
wechat.tmpl,該檔案采用go temple決議模板
{{ define "wechat.default.message" }}{{ range $i, $alert :=.Alerts }}
告警狀態:{{ .Status }}
告警級別:{{ $alert.Labels.severity }}
告警型別:{{ $alert.Labels.alertname }}
告警應用:{{ $alert.Annotations.summary }}
告警主機:{{ $alert.Labels.instance }}
告警環境:{{ $alert.Labels.env }}
告警詳情:{{ $alert.Annotations.description }}
告警時間:{{ (.StartsAt.Add 28800e9).Format "2006-01-02 15:04:05" }} #UTC時間需要增加基礎時間StartsAt.Add 28800e9
恢復時間: {{ (.EndsAt.Sub .StartsAt) }}
------------------------------------------------
{{ end }}{{ end }}
6.2 告警規則
告警規則可以參照https://awesome-prometheus-alerts.grep.to/ ,這里根據公司需求收集并修改漢化了一下,
6.2.1 業務連通性告警
groups:
- name: 業務連通性監控
rules:
# Alert for any instance that is unreachable for >5 minutes.
- alert: 業務連通性監控
expr: probe_success == 0
for: 2m
labels:
severity: 嚴重
annotations:
summary: "業務 {{ $labels.instance }} 丟失"
description: " {{ $labels.job }} 檢測到環境 {{ $labels.env }} 的{{ $labels.instance }}狀態例外超過2分鐘."
- alert: HTTP業務連通性監控
expr: probe_http_status_code <= 199 OR probe_http_status_code >= 400
for: 2m
labels:
severity: 嚴重
annotations:
summary: "HTTP業務 {{ $labels.instance }} 例外"
description: "{{ $labels.job }} 檢測到環境 {{ $labels.env }} 的{{ $labels.instance }}狀態例外超過2分鐘."
6.2.2 SSL證書告警
- name: SSL證書監控
rules:
- alert: 證書30天提醒
expr: probe_ssl_earliest_cert_expiry-time()< 86400 * 30
for: 1d
labels:
severity: 提醒
annotations:
summary: "業務證書SSL {{ $labels.instance }} 即將過期"
description: " {{ $labels.job }} 檢測到環境 {{ $labels.env }} 的{{ $labels.instance }} SSL證書過期時間小于30天."
- alert: 證書15天提醒
expr: probe_ssl_earliest_cert_expiry-time()< 86400 * 15
for: 1d
labels:
severity: 告警
annotations:
summary: "業務證書SSL {{ $labels.instance }} 即將過期"
description: " {{ $labels.job }} 檢測到環境 {{ $labels.env }} 的{{ $labels.instance }} SSL證書過期時間小于15天."
- alert: 證書過期提醒
expr: probe_ssl_earliest_cert_expiry-time()<= 0
for: 1d
labels:
severity: 嚴重
annotations:
summary: "業務證書SSL {{ $labels.instance }} 過期"
description: " {{ $labels.job }} 檢測到環境 {{ $labels.env }} 的{{ $labels.instance }} SSL證書過期."
6.2.3 虛擬機告警
- name: 虛擬主機告警
rules:
# Alert for any instance that is unreachable for >2 minutes.
- alert: vSphere主機記憶體使用率超上限
expr: vmware_host_memory_usage/vmware_host_memory_max*100>85
for: 20m
labels:
severity: 告警
annotations:
summary: "vSphere主機 {{ $labels.host_name }} 主機記憶體使用率超高限85%"
description: " {{ $labels.job }}\n檢測到環境vSphere主機 {{ $labels.host_name }} 主機記憶體使用率超高限85% 超過20分鐘.\n 當前值 = {{ $value }}"
- alert: vSphere主機記憶體使用率超下限
expr: vmware_host_memory_usage/vmware_host_memory_max*100<20
for: 20m
labels:
severity: 告警
annotations:
summary: "vSphere主機 {{ $labels.host_name }} 主機記憶體使用率超限20%"
description: " {{ $labels.job }}檢測到\n環境vSphere主機 {{ $labels.host_name }} 主機記憶體使用率超低限10% 超過20分鐘.\n 當前值 = {{ $value }}"
- name: 虛擬機告警
rules:
# Alert for any instance that is unreachable for >2 minutes.
- alert: 虛擬機CPU使用率超上限
expr: vmware_vm_cpu_usagemhz_average/vmware_vm_max_cpu_usage*100>80
for: 30m
labels:
severity: 告警
annotations:
summary: "虛擬機 {{ $labels.vm_name }} 上的CPU使用率超高限80%"
description: " {{ $labels.job }}檢測到\n {{ $labels.host_name }} 中的虛機 {{ $labels.vm_name }} CPU使用率超高限80%超過30分鐘.\n 當前值 = {{ $value }}"
- alert: 虛擬機記憶體使用率超上限
expr: (vmware_vm_mem_active_average/ vmware_vm_mem_consumed_average)*100>90
for: 30m
labels:
severity: 告警
annotations:
summary: "vSphere主機 {{ $labels.host_name }} 主機記憶體使用率超90%"
description: " {{ $labels.job }}檢測到\n {{ $labels.host_name }} 中的虛機 {{ $labels.vm_name }} 記憶體使用率超90% 超過30分鐘.n\ 當前值 = {{ $value }}"
6.2.4 Linux主機告警
- name: Linux主機告警
rules:
- alert: 主機記憶體超限>90%
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機記憶體超限>90%"
description: "{{ $labels.instance }} 主機記憶體超限(< 10% left)\n 當前值 = {{ $value }}\n "
- alert: HostMemoryUnderMemoryPressure
expr: rate(node_vmstat_pgmajfault[1m]) > 1000
for: 5m
labels:
severity: 告警
annotations:
summary: "Host memory under memory pressure (instance {{ $labels.instance }})"
description: "The node is under heavy memory pressure. High rate of major page faults\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: 主機磁盤空間不足
expr: (node_filesystem_avail_bytes{mountpoint="/rootfs"} * 100) / node_filesystem_size_bytes{mountpoint="/rootfs"} < 10
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機磁盤空間不足"
description: "{{ $labels.instance }} 主機磁盤空間不足(< 10% 剩余)\n 當前值 = {{ $value }}\n "
- alert: 主機磁盤Inodes不足
expr: node_filesystem_files_free{mountpoint ="/rootfs"} / node_filesystem_files{mountpoint ="/rootfs"} * 100 < 10
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機磁盤Inodes不足"
description: "{{ $labels.instance }} 主機磁盤Inodes不足(< 10% 剩余)\n 當前值 = {{ $value }}\n"
- alert: 主機CPU負載高
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機CPU負載高"
description: "{{ $labels.instance }} 主機CPU負載高\n 當前值 = {{ $value }}\n"
# 1000 context switches is an arbitrary number.
# Alert threshold depends on nature of application.
# Please read: https://github.com/samber/awesome-prometheus-alerts/issues/58
- alert: 主機CPU背景關系切換高
expr: (rate(node_context_switches_total[5m])) / (count without(cpu, mode) (node_cpu_seconds_total{mode="idle"})) > 10000
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機CPU背景關系切換高"
description: "{{ $labels.instance }}主機CPU背景關系切換高 (> 2000 / s)\n 當前值 = {{ $value }}\n "
- alert: 主機Swap空間滿
expr: (1 - (node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes)) * 100 > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "{{ $labels.instance }}主機Swap空間滿"
description: "{{ $labels.instance }}主機Swap空間滿 (>80%)\n 當前值 = {{ $value }}\n "
- alert: 主機過熱
expr: node_hwmon_temp_alarm == 1
for: 5m
labels:
severity: 嚴重
annotations:
summary: "{{ $labels.instance }} 主機過熱"
description: "{{ $labels }}主機過熱\n 當前值 = {{ $value }} \n "
- alert: HostRaidDiskFailure
expr: node_md_disks{state="fail"} > 0
for: 5m
labels:
severity: 告警
annotations:
summary: "Host RAID disk failure (instance {{ $labels.instance }})"
description: "At least one device in RAID array on {{ $labels.instance }} failed. Array {{ $labels.md_device }} needs attention and possibly a disk swap\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: 主機OomKill檢測
expr: increase(node_vmstat_oom_kill[5m]) > 0
for: 5m
labels:
severity: 告警
annotations:
summary: "檢測到主機{{ $labels.instance }}發生OoM kill"
description: "OOM kill detected\n 當前值 = {{ $value }}\n "
6.2.5 Windows主機告警
- name: Windows主機告警
rules:
- alert: Windows 服務告警
expr: windows_service_status{status="ok"} != 1
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Windows服務告警狀態告警 (instance {{ $labels.instance }})"
description: "Windows Service state is not OK\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows CPU使用率告警
expr: 100 - (avg by (instance) (rate(windows_cpu_time_total{mode="idle"}[2m])) * 100) > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "Windows使用率告警 (instance {{ $labels.instance }})"
description: "CPU使用率超過 80%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows 記憶體使用率告警
expr: 100 * (windows_os_physical_memory_free_bytes) / windows_cs_physical_memory_bytes > 90
for: 5m
labels:
severity: 告警
annotations:
summary: "Windows Server memory Usage (instance {{ $labels.instance }})"
description: "記憶體使用率超過 90%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows 磁盤使用率告警
expr: 100.0 - 100 * ((windows_logical_disk_free_bytes{} / 1024 / 1024 ) / (windows_logical_disk_size_bytes{} / 1024 / 1024)) > 80
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Windows 磁盤使用率告警 (instance {{ $labels.instance }})"
description: "磁盤使用率告警超過 80%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- name: Windows 2k 主機告警
rules:
- alert: Windows 2k 服務告警
expr: wmi_service_status{status="ok"} != 1
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Windows 2k 服務告警狀態告警 (instance {{ $labels.instance }})"
description: "Windows Service state is not OK\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows 2k CPU使用率告警
expr: 100 - (avg by (instance) (rate(wmi_cpu_time_total{mode="idle"}[2m])) * 100) > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "Windows 2k 使用率告警 (instance {{ $labels.instance }})"
description: "CPU使用率超過 80%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows 2k 記憶體使用率告警
expr: 100 * (wmi_os_physical_memory_free_bytes) / wmi_cs_physical_memory_bytes > 90
for: 5m
labels:
severity: 告警
annotations:
summary: "Windows 2k Server memory Usage (instance {{ $labels.instance }})"
description: "記憶體使用率超過 90%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Windows 磁盤使用率告警
expr: 100.0 - 100 * ((wmi_logical_disk_free_bytes{} / 1024 / 1024 ) / (wmi_logical_disk_size_bytes{} / 1024 / 1024)) > 90
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Windows 2k 磁盤使用率告警 (instance {{ $labels.instance }})"
description: "磁盤使用率告警超過 90%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
6.2.6 Ceph告警
- name: Ceph告警
rules:
- alert: Ceph狀態
expr: ceph_health_status != 0
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Ceph 狀態不健康 (instance {{ $labels.instance }})"
description: "Ceph 狀態不健康 \n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Ceph管理節點時間不同步
expr: abs(ceph_monitor_clock_skew_seconds) > 0.2
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph管理節點時間不同步 (instance {{ $labels.instance }})"
description: "監測到Ceph管理節點時間不同步. 請檢查時間設定\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: Ceph管理節點空間不足
expr: ceph_monitor_avail_percent < 10
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph管理節點 low space (instance {{ $labels.instance }})"
description: "Ceph管理節點空間不足.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephOsd宕機
expr: ceph_osd_up == 0
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Ceph OSD Down (instance {{ $labels.instance }})"
description: "Ceph Object Storage Daemon Down\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephOsd高延時
expr: ceph_osd_perf_apply_latency_seconds > 10
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph OSD 高延時 (instance {{ $labels.instance }})"
description: "Ceph Object Storage Daemon 高延時.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephOsd容量不足
expr: ceph_osd_utilization > 90
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph OSD 容量不足 (instance {{ $labels.instance }})"
description: "Ceph Object Storage Daemon 容量不足. 請增加磁盤.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephOsd權重調整時間過長
expr: ceph_osd_weight < 1
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph OSD 權重調整超時 (instance {{ $labels.instance }})"
description: "Ceph Object Storage Daemon 權重調整時間過長.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephPg宕機
expr: ceph_pg_down > 0
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Ceph PG down (instance {{ $labels.instance }})"
description: "Ceph placement groups 狀態為 down. 請確認資料完整性.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephPgIncomplete
expr: ceph_pg_incomplete > 0
for: 5m
labels:
severity: 嚴重
annotations:
summary: "Ceph PG 不完整 (instance {{ $labels.instance }})"
description: "Ceph placement groups 狀態為 incomplete. 請確認資料完整性.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: CephPg回填滿
expr: ceph_pg_backfill_toofull > 0
for: 5m
labels:
severity: 告警
annotations:
summary: "Ceph PG 回填滿 (instance {{ $labels.instance }})"
description: "Ceph placement groups 位于已經滿了的 Object Storage Daemon .PGs不可用. 請檢查 OSDs, 更改權重或重新配置CRUSH規則.\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
6.2.7 容器告警
- name: 資料庫告警
rules:
- alert: Oracle資料庫Down
expr: oracledb_up !=1
for: 2m
labels:
severity: 嚴重
annotations:
summary: "主資料庫 (instance {{ $labels.instance }})宕機"
description: "主資料庫 (instance {{ $labels.instance }})宕機"
- name: 容器告警
rules:
- alert: 容器Killed
expr: time() - container_last_seen > 60
for: 5m
labels:
severity: 告警
annotations:
summary: "容器 killed (instance {{ $labels.instance }})"
description: "容器被 killed \n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: 容器Volume使用率高
expr: (1 - (sum(container_fs_inodes_free) BY (instance) / sum(container_fs_inodes_total) BY (instance)) * 100) > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "容器Volume使用率高 (instance {{ $labels.instance }})"
description: "容器Volume使用率高于 80%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: 容器Volume IO 高
expr: (sum(container_fs_io_current) BY (instance, name) * 100) > 80
for: 5m
labels:
severity: 告警
annotations:
summary: "容器Volume IO 高 (instance {{ $labels.instance }})"
description: "容器Volume IO高于 80%\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
- alert: 容器CPU頻率限制高
expr: rate(container_cpu_cfs_throttled_seconds_total[3m]) > 1
for: 5m
labels:
severity: 告警
annotations:
summary: "容器CPU頻率限制高 (instance {{ $labels.instance }})"
description: "容器CPU頻率被限制\n 當前值 = {{ $value }}\n LABELS: {{ $labels }}"
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/295044.html
標籤:其他
上一篇:深度學習——計算機視覺
