{ Josh Rendek }

<3 Go & Kubernetes

Influx Alert

Oct 12, 2015 - 2 minutes

I’ve been very happy using InfluxDB with Grafana + StatsD but always wanted a nice way to alert on some of the data being fed into statsd/grafana so I wrote a little tool in Go to accomplish that:

Github: https://github.com/joshrendek/influx-alert

I hope someone finds this useful! It’s got a few simple functions/comparisons done already and support for HipChat and Slack notifications.

Documentation

Influx Alert

This is a tool to alert on data that is fed into InfluxDB (for example, via statsd) so you can get alerted on it.

How to get it

Go to releases, or download the latest here: v0.1

How to Use

  • name: the name of the alert ( will be used in notifier )
  • interval: how often to check influxdb (in seconds)
  • timeshift: how far back to go (query is like: where time > now() - TIMESHIFT
  • limit: the max number of results to return
  • type: influxdb (the only option for now)
  • function: min/max/average are the only supported functions for now
  • query: the influxdb query to run (omit any limit or where clause on the time)
  • trigger: the type of trigger and value that would trigger it
    • operator: gt/lt
    • value: value to compare against (note all values are floats internally)
  • notifiers: an array of notifiers, possible options are slack and hipchat

Example: ( see example.yml for more )

 1- name: Not Enough Foo
 2  type: influxdb
 3  function: average
 4  timeshift: 1h
 5  limit: 10
 6  interval: 10
 7  query: select * from "foo.counter"
 8  notifiers:
 9      - slack
10      - hipchat
11      - foobar
12  trigger:
13    operator: lt
14    value: 10

Environment Variables

 1  * INFLUX_HOST
 2  * INFLUX_PORT (8086 is default)
 3  * INFLUX_DB
 4  * INFLUX_USER
 5  * INFLUX_PASS
 6  * SLACK_API_TOKEN
 7  * SLACK_ROOM
 8  * HIPCHAT_API_TOKEN
 9  * HIPCHAT_ROOM_ID
10  * HIPCHAT_SERVER (optional)
11  * DEBUG (optional)

Supported Notifiers

Supported Backends

  • InfluxDB v0.9
comments powered by Disqus