[Grafana] provisioning配置

在過往, Grafana 想要自動化的配置Dashboard 與 Alert等設定,都必須以API達成,實在很不方便。 這不管在設定資訊的版本控管,以及容器環境的使用,都很不方便。

好在 v5.0開始 ,提供配置yaml格式的設定檔,讓Grafana於初始化時,能預先載入設定,目前支持的設定有:

  • 數據源 Datasources
  • 儀錶板 Dashboards
  • 警報通知頻道 Alert Notification Channels

上述三種設定檔都需要放置於provisioning資料夾中才有作用。

1. 確認grafana.ini中的provisioning路徑

指定,譬如/etc/grafana/provisioning

2. 設定檔放置於對應資料夾中

  • Datasources:/provisioning/datasources/
  • Dashboards :/provisioning/dashboards/
  • Alert Notification Channels:/provisioning/notifiers/

2.1 配置datasources

這邊以Prometheus為例,datasources可以是複數個。

2.2 配置dashboards

以istio儀表板為例,providers可以是複數個。

每個provider都會指定一個放置json格式dashboard設定檔的路徑。

2.3 配置notifiers

以slack為例,notifiers可以是複數個。

5.x版的notifiers配置似乎有問題,沒有成功過。一直到Grafana 6才能正常使用。

參考資料:

使用 WordPress.com 設計專業網站
立即開始使用