Grafana?系列之統(tǒng)一展示Prometheus數(shù)據(jù)源
Grafana Prometheus 數(shù)據(jù)源
系列文章
Grafana 提供了對 Prometheus 的內(nèi)置支持。本文會介紹 Grafana Prometheus(也包括 Prometheus 的兼容實現(xiàn),如 Thanos, Mimir 等) 數(shù)據(jù)源的部分選項、變量 (Variable)、查詢 (Query) 和其他針對 Prometheus 數(shù)據(jù)源的功能。
配置 Prometheus 數(shù)據(jù)源
這里選擇幾項重要的部分進行說明:
URL
: Prometheus Server 的 URL, 示例為:http://prometheus.example.org:9090
(不需要 path 等信息)Manage alerts via Alerting UI
: 啟用后可以集成 AlertManager, Grafana 可以顯示、管理 AlertManager。啟用后,可以選擇對應的 Prometheus AlertManager 數(shù)據(jù)源Alertmanager data source
: 下拉框,選擇對應的 Prometheus AlertManager 數(shù)據(jù)源
Type
: Prometheus Server 的類型;包括Prometheus
,Cortex
,Thanos
,Mimir
。當選擇時,版本字段會嘗試使用 Prometheus buildinfo API 自動填充。一些普羅米修斯類型,如 Cortex,不支持這個 API,必須手動填入。Disable metrics lookup
: 勾選該選項將禁用查詢字段自動完成中的度量選擇器和度量/標簽支持。如果你在較大的 Prometheus 實例中遇到性能問題,這將有所幫助。Custom query parameters
: 在 Prometheus 查詢 URL 中添加自定義參數(shù)。例如,timeout
、partial_response
、dedup
、或max_source_resolution
。多個參數(shù)應該用&
連接起來。- 如:
max_source_resolution=5m&timeout=10
- 如:
配置 Exemplars
??Note:
在 Prometheus v2.26 及以上版本與 Grafana v7.4 及以上版本中可用。 如 前文 所述,Exemplars 用途是用于在 Metric -> Traces 無縫跳轉(zhuǎn)。
Grafana 7.4 及更高版本可以在 "Explore" 和 "Dashboards" 中顯示 Exemplars 數(shù)據(jù)與指標。Exemplars 數(shù)據(jù)將來自特定事件的 higher-cardinality metadata 與傳統(tǒng)的時間序列數(shù)據(jù)聯(lián)系起來。
- Internal link: 如果你有一個內(nèi)部鏈接,啟用這個選項。啟用后,這將顯示數(shù)據(jù)源選擇器。為你的示例數(shù)據(jù)選擇后端 tracing 數(shù)據(jù)存儲。如 Grafana 內(nèi)部的 Tempo 數(shù)據(jù)源或 Jaeger 數(shù)據(jù)源。
- Data source: (只有當你啟用 "Internal link"時才可見) 為你的示范數(shù)據(jù)選擇后端追蹤數(shù)據(jù)存儲。
- URL: (只有當你禁用 "Internal link"時才可見) 定義了外部鏈接的完整 URL。你可以通過使用
${__value.raw}
從該字段中插值。 - Label name: 為 exemplars 的 traceID 屬性添加一個名稱。
Prometheus YAML 配置示例
典型示例如下:(基于 Grafana 9)
apiVersion: 1 datasources: - name: Prometheus type: prometheus # Access mode - proxy (server in the UI) or direct (browser in the UI). access: proxy url: http://localhost:9090 jsonData: httpMethod: POST manageAlerts: true prometheusType: Prometheus prometheusVersion: 2.37.0 cacheLevel: 'High' exemplarTraceIdDestinations: # Field with internal link pointing to data source in Grafana. # datasourceUid value can be anything, but it should be unique across all defined data source uids. - datasourceUid: my_jaeger_uid name: traceID # Field with external link. - name: traceID url: 'http://localhost:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Jaeger%22,%7B%22query%22:%22$${__value.raw}%22%7D%5D'
以上就是Grafana 系列之統(tǒng)一展示Prometheus數(shù)據(jù)源的詳細內(nèi)容,更多關(guān)于Grafana統(tǒng)一展示Prometheus的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Caffe圖像數(shù)據(jù)轉(zhuǎn)換成可運行l(wèi)eveldb?lmdb文件
這篇文章主要為大家介紹了Caffe圖像數(shù)據(jù)轉(zhuǎn)換成可運行l(wèi)eveldb?lmdb文件教程,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-06-06使用Windows自帶的IIS服務搭建本地站點并遠程訪問的操作方法
在Windows系統(tǒng)中實際上集成了建立網(wǎng)站所必須的軟件環(huán)境,今天就讓我們來看看,如何使用Windows自帶的網(wǎng)站程序建立網(wǎng)站吧,感興趣的朋友一起看看吧2023-12-12詳解VScode自動補全CSS3前綴插件以及配置無效的解決辦法
這篇文章主要介紹了詳解VScode自動補全CSS3前綴插件以及配置無效的解決辦法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-06-06git工作區(qū)暫存區(qū)與版本庫基本理解及提交流程全解
這篇文章主要為大家介紹了git工作區(qū)暫存區(qū)與版本庫基本理解及提交流程,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步2022-04-04Elasticsearch索引的分片分配Recovery使用講解
這篇文章主要為大家介紹了Elasticsearch索引的分片分配Recovery使用講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2022-04-04chatGPT?deBug解決管理員登入服務器返回401問題
這篇文章主要介紹了chatGPT?deBug解決管理員登入,服務器返回401,沒有拿到數(shù)據(jù),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-05-05關(guān)于Centos7中Vscode無響應的問題及解決方法
在CentOS7中使用命令行直接安裝Vscode時,打開Vscode出現(xiàn)界面卡死、無響應情況,如何處理這個問題呢,今天小編給大家?guī)砹薈entos7中Vscode無響應的問題及解決方法,感興趣的朋友一起看看吧2021-07-07