ekg-elasticsearch-0.3.0.0: Push metrics to elasticsearch

Safe HaskellNone
LanguageHaskell2010

System.Remote.Monitoring.ElasticSearch

Contents

Description

This module lets you periodically flush metrics to elasticsearch. Example usage:

main = do
    store <- newStore
    forkElasticSearch defaultESOptions store

You probably want to include some of the predefined metrics defined in the ekg-core package, by calling e.g. the registerGcStats function defined in that package.

Synopsis

The elasticsearch syncer

data ElasticSearch Source #

A handle that can be used to control the elasticsearch sync thread. Created by forkElasticSearch.

elasticSearchThreadId :: ElasticSearch -> ThreadId Source #

The thread ID of the elasticsearch sync thread. You can stop the sync by killing this thread (i.e. by throwing it an asynchronous exception.)

forkElasticSearch Source #

Arguments

:: ESOptions

Options

-> Store

Metric store

-> IO ElasticSearch

ElasticSearch sync handle

Create a thread that flushes the metrics in the store to elasticsearch.

ElasticSearch options

data ESOptions Source #

Options to control how to connect to the elasticsearch server and how often to flush metrics. The flush interval should be shorter than the flush interval elasticsearch itself uses to flush data to its backends.

Constructors

ESOptions 

Fields

  • _host :: !Text

    Server hostname or IP address

  • _port :: !Int

    Server port

  • _indexBase :: !Text

    The elasticsearch index to insert into

  • _indexByDate :: !Bool

    Append "-YYYY.MM.DD" onto index?

  • _beatName :: !Text

    What to put in the beat.name field

  • _flushInterval :: !Int

    Data push interval, in ms.

  • _debug :: !Bool

    Print debug output to stderr.

  • _prefix :: !Text

    Prefix to add to all metric names.

  • _suffix :: !Text

    Suffix to add to all metric names. This is particularly useful for sending per host stats by settings this value to: takeWhile (/= '.') <$> getHostName, using getHostName from the Network.BSD module in the network package.

  • _tags :: ![Text]

    Extra tags to add to events

defaultESOptions :: ESOptions Source #

Defaults:

  • host = "127.0.0.1"
  • port = 8125
  • indexBase = metricbeats
  • indexByDate = True
  • beatName = "ekg"
  • flushInterval = 1000
  • debug = False