使用 OpenMetrics 設定服務監控
備註
此功能目前為 Beta,格式可能會變更。
本文說明在 Megaport 的 API 中設定 Prometheus / OpenMetrics 端點的範例組態。
OpenMetrics 是一套用於以標準化格式表示與交換指標資料的規範,主要受 Prometheus exposition 格式影響。
將 OpenMetrics 端點整合至 Megaport 的 API 後,即可匯出既有的服務監控資訊。
在下方的 Prometheus 組態範例中,抓取間隔設為 1 分鐘,但網路每 5 分鐘才會輪詢一次。您在 PromQL/Grafana 儀表板中需要將此納入考量。
在開始之前,請先取得有效的存取權杖。欲了解更多資訊,請參閱 建立 API 金鑰。
Megaport API 詳細資訊
- API:/v1/openmetrics
- 驗證:API 金鑰/OAuth2
Prometheus 組態範例
global:
scrape_interval: 5m
scrape_configs:
- job_name: megaport
static_configs:
- targets: ["api.megaport.com"]
scheme: https
metrics_path: /v1/openmetrics
oauth2:
token_url: https://auth-m2m.megaport.com/oauth2/token
client_id: <api key>
client_secret: <api secret>
指標
此端點目前會針對所有服務匯出這些指標。
Port
# HELP megaport_service_input_errors_total 輸入錯誤的總數。
# TYPE megaport_service_input_errors_total counter
# HELP megaport_service_optical_receive_power_dbm 光學接收功率,單位為 dBm。
# TYPE megaport_service_optical_receive_power_dbm gauge
# HELP megaport_service_optical_transmit_power_dbm 光學傳送功率,單位為 dBm。
# TYPE megaport_service_optical_transmit_power_dbm gauge
# HELP megaport_service_output_errors_total 輸出錯誤的總數。
# TYPE megaport_service_output_errors_total counter
# HELP megaport_service_receive_bytes_total 接收位元組的總數。
# TYPE megaport_service_receive_bytes_total counter
# HELP megaport_service_receive_packets_total 接收封包的總數。
# TYPE megaport_service_receive_packets_total counter
# HELP megaport_service_transmit_bytes_total 傳送位元組的總數。
# TYPE megaport_service_transmit_bytes_total counter
# HELP megaport_service_transmit_packets_total 傳送封包的總數。
# TYPE megaport_service_transmit_packets_total counter
# HELP megaport_service_up 服務的運作狀態。
# TYPE megaport_service_up gauge
VXC
# HELP megaport_service_receive_bytes_total 接收位元組的總數。
# TYPE megaport_service_receive_bytes_total counter
# HELP megaport_service_receive_packets_total 接收封包的總數。
# TYPE megaport_service_receive_packets_total counter
# HELP megaport_service_transmit_bytes_total 傳送位元組的總數。
# TYPE megaport_service_transmit_bytes_total counter
# HELP megaport_service_transmit_packets_total 傳送封包的總數。
# TYPE megaport_service_transmit_packets_total counter
# HELP megaport_service_up 服務的運作狀態。
# TYPE megaport_service_up gauge
MCR
# HELP megaport_service_receive_bytes_total 接收位元組的總數。
# TYPE megaport_service_receive_bytes_total counter
# HELP megaport_service_receive_packets_total 接收封包的總數。
# TYPE megaport_service_receive_packets_total counter
# HELP megaport_service_transmit_bytes_total 傳送位元組的總數。
# TYPE megaport_service_transmit_bytes_total counter
# HELP megaport_service_transmit_packets_total 傳送封包的總數。
# TYPE megaport_service_transmit_packets_total counter
# HELP megaport_service_up 服務的運作狀態。
# TYPE megaport_service_up gauge
MVE
# HELP megaport_service_receive_bytes_total 接收位元組的總數。
# TYPE megaport_service_receive_bytes_total counter
# HELP megaport_service_receive_packets_total 接收封包的總數。
# TYPE megaport_service_receive_packets_total counter
# HELP megaport_service_transmit_bytes_total 傳送位元組的總數。
# TYPE megaport_service_transmit_bytes_total counter
# HELP megaport_service_transmit_packets_total 傳送封包的總數。
# TYPE megaport_service_transmit_packets_total counter
# HELP megaport_service_up 服務的運作狀態。
# TYPE megaport_service_up gauge