View Source Runlet.Cmd.Query (runlet v1.2.6)

Query a riemann server

Summary

Functions

Filters events from a riemann server using the Riemann query language. The query must be quoted as a string

Types

@type t() :: %Runlet.Cmd.Query{
  conn: pid() | nil,
  host: String.t(),
  m: reference() | nil,
  port: non_neg_integer(),
  query: String.t(),
  ref: reference() | nil,
  retry: non_neg_integer(),
  url: String.t()
}

Functions

@spec exec(String.t()) :: Enumerable.t()

Filters events from a riemann server using the Riemann query language. The query must be quoted as a string:

'state = "ok"'

Examples of Queries:

# Simple equality
state = "ok"

# Wildcards
(service =~ "disk%") or
(state != "critical" and host =~ "%.trioptimum.com")

# Standard operator precedence applies
metric_f > 2.0 and not host = nil

# Anything with a tag "product"
tagged "product"

# All states
true

Examples from the test suite:

https://github.com/riemann/riemann/blob/master/test/riemann/query_test.clj

Query Grammar:

https://github.com/riemann/riemann/blob/master/resources/query.g4