PromEx.GrafanaClient (PromEx v1.0.0) View Source

This module is used by the Mix tasks that are available in PromEx to update dashboards in Grafana and also by the PromEx.DashboardUpdater to update dashboards automatically on application initialization.

Dashboard models: https://grafana.com/docs/grafana/latest/dashboards/json-model/

Link to this section Summary

Functions

Used to create annotations on dashboard panels

Used to create a new folder in Grafana

Used to get the dashboard definition currently in Grafana for the provided dashboard file. If the ID does not exist in Grafana an error tuple will be returned.

Used to fetch the details regarding a particular folder on Grafana

Update an existing folder in Grafana

Used to create a new dashboard or update an existing dashboard.

Link to this section Functions

Link to this function

create_annotation(grafana_conn, tags, message)

View Source

Specs

create_annotation(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  tags :: [String.t()],
  message :: String.t()
) :: handler_respose()

Used to create annotations on dashboard panels

Link to this function

create_folder(grafana_conn, folder_uid, title)

View Source

Specs

create_folder(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  folder_uid :: String.t(),
  title :: String.t()
) :: handler_respose()

Used to create a new folder in Grafana

Link to this function

get_dashboard(grafana_conn, dashboard_contents)

View Source

Specs

get_dashboard(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  dashboard_file_path :: String.t()
) :: handler_respose()

Used to get the dashboard definition currently in Grafana for the provided dashboard file. If the ID does not exist in Grafana an error tuple will be returned.

Link to this function

get_folder(grafana_conn, folder_id)

View Source

Specs

get_folder(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  folder_uid :: String.t()
) :: handler_respose()

Used to fetch the details regarding a particular folder on Grafana

Link to this function

update_folder(grafana_conn, folder_uid, new_title)

View Source

Specs

update_folder(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  folder_uid :: String.t(),
  new_title :: String.t()
) :: handler_respose()

Update an existing folder in Grafana

Link to this function

upload_dashboard(grafana_conn, dashboard_contents, opts \\ [])

View Source

Specs

upload_dashboard(
  grafana_conn :: PromEx.GrafanaClient.Connection.t(),
  dashboard_file_path :: String.t(),
  opts :: keyword()
) :: handler_respose()

Used to create a new dashboard or update an existing dashboard.