/exgrafana

Incomplete API for Grafana.

Primary LanguageElixirMIT LicenseMIT

Exgrafana

Build Status Hex pm hex.pm downloads Deps Status Inline docs

(Incomplete) Grafana client library for Elixir using HTTPoison.

The available functions are:

@spec create_dashboard(map) :: {:ok, map} | {:error, term}
@spec create_dashboard(map, Keyword.t) :: {:ok, map} | {:error, term}

@spec get_dashboard(binary) :: {:ok, map} | {:error, term}

@spec update_dashboard(map) :: {:ok, map} | {:error, term}
@spec update_dashboard(map, Keyword.t) :: {:ok, map} | {:error, term}

@spec delete_dashboard(binary) :: {:ok, map} | {:error, term}

For more information about the dashboard model structure and the slugs look at Grafana HTTP API reference.

Configuration

The following are the configuration arguments available:

  • :url - URL of your Grafana server.
  • :token - Your API token.
  • :version - Schema version (Default is 14).

e.g:

config :exgrafana
  url: "<URL of your Grafana server>",
  token: "<your API token>"

The OS environment variables $EXGRAFANA_URL, $EXGRAFANA_TOKEN and $EXGRAFANA_VERSION can be used instead.

Installation

Exgrafana is available as a Hex package. To install, add it to your dependencies in your mix.exs file:

def deps do
  [{:exgrafana, "~> 0.1"}]
end

and ensure httpoison is started before your application:

def application do
  [applications: [:httpoison]]
end