Telegraf (Telegraf v0.1.0) View Source

Telegraf client.

Hex.pm Version CI Coverage Status

Checkout the documentation for more information.

Installation

The package can be installed by adding telegraf to your list of dependencies in mix.exs:

def deps do
  [
    {:telegraf, "~> 0.1.0"}
  ]
end

Usage

  1. Add Telegraf to your supervision tree:
{Telegraf, name: MyTelegraf}
  1. Send the metric:
metric = %Telegraf.Metric{
  name: "weather",
  tag_set: %{location: "us-midwest"},
  field_set: %{temperature: 82},
  timestamp: System.os_time()
}

Telegraf.send(MyTelegraf, metric)

Changelog

See the changelog.

Link to this section Summary

Types

Name of the telegraf instance.

Functions

Returns a specification to start this module under a supervisor.

Sends a metric to the telegraf daemon

Starts a Telegraf supervisor.

Link to this section Types

Specs

name() :: atom()

Name of the telegraf instance.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

send(name, metric_or_metrics, opts \\ [])

View Source

Specs

send(name(), Metric.t() | [Metric.t()], Keyword.t()) :: :ok | {:error, term()}

Sends a metric to the telegraf daemon

metric = %Telegraf.Metric{
  name: "weather",
  tag_set: %{location: "us-midwest"},
  field_set: %{temperature: 82},
  timestamp: System.os_time()
}

Telegraf.send(MyTelegraf, metric)

Starts a Telegraf supervisor.

Supported options