簡體   English   中英

創建一個 API 來連接 ArangoDB 和 Prometheus 以獲取 ArangoDB 內部數據的指標並在 Prometheus 中公開

[英]Creating an API to connect between ArangoDB and Prometheus to get the metrics of the data inside ArangoDB and expose it in Prometheus

我正在嘗試創建一個 API 來連接 ArangoDB 和 Prometheus。 我對 ArangoDB 中的數據進行了統計,例如,我想在 Prometheus 中看到多少次啟動模擬。 因此,如果我理解的正確,我想確認以下問題:

  1. 我查看了 Prometheus 的入門指南( https://prometheus.io/docs/prometheus/latest/getting_started/ ),我們在 Prometheus 中使用了 node_exporter 指標。 我們需要啟動這個 node_exporter 並將其暴露在特定的 IP 地址和端口(偵聽地址)上,然后我們需要在 Prometheus 配置中配置目標以定位運行 node_exporter 的這些端口。 Therefore, for my API, I need to create an API and app in Golang and this API/App need to be exposed in the specific HTTP port (for example 8001), then in Prometheus, I need to add the target for 8001 port in為了讓普羅米修斯能夠刮到我的 API。 那是對的嗎?
  2. 我需要找出 Prometheus 理解的數據格式。 我需要在我的 API(來自 API)和 Prometheus(進入 Prometheus)之間定義數據格式。 我從這個文檔( https://prometheus.io/docs/instrumenting/exposition_formats/ )中發現它是這種形式的文本格式:
metric_name [ "{" label_name "=" `"` label_value `"` { "," label_name "=" `"` label_value `"` } [ "," ] "}" ] value [ timestamp ]

這個對嗎? 你能確認我的理解嗎?

最后,如果你能向我推薦一個已經有人做過這種 API 來連接 ArangoDB 和 Prometheus 的來源,那就太好了。 這真的會幫助我開始這個項目。 非常感謝你。

您可能只需要找到一個允許您繪制數據的系統。 Prometheus 有一項名為Grafana的兄弟技術。

Prometheus 是一種工具,被配置為定期從系統的端點(==目標)刮取(讀取)測量值。 這些測量描述了系統在刮擦時的 state。 Prometheus 將這些測量記錄在時間序列數據庫中,並提供一種富有表現力的查詢語言,可以在數據中找到洞察力。 Prometheus 也包括此時間序列數據的基本圖表。 Prometheus 經常與 Grafana 結合使用。

您的問題表明您不是要監視數據庫的 state,而是要繪制數據庫表中包含的(統計)數據。 如果是這樣,Prometheus 可能不是您所需要的。

為了回答您的問題,Prometheus 要求系統以一種稱為 Exposition Format 的簡單文本格式發布指標集。 任何以這種格式生成數據並可以在 HTTP 端點上提供指標的系統都可以被 Prometheus 抓取。

Node Exporter 就是這種系統的一個例子,它發布了可以被 Prometheus 抓取的指標。 它發布節點(==主機)指標。

ArangoDB 是另一個可以以 Prometheus 的 Exposition 格式發布指標(關於它的 state;數據庫系統的 state)的系統,參見:

https://www.arangodb.com/2020/03/monitoring-arangodb-prometheus-grafana/

我懷疑,您需要一個解決方案來繪制您已經存儲在 ArangoDB 表中的一組數據。 為此,您可以將 Grafana 之類的系統連接到您的數據庫,然后使用 SQL 查詢以可以圖形化的形式顯示數據。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM