InfluxDB Interpreter for Apache Zeppelin

Overview

InfluxDB is an open-source time series database (TSDB) developed by InfluxData. It is written in Go and optimized for fast, high-availability storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics. This interpreter allows to perform queries in Flux Language in Zeppelin Notebook.

Notes

  • This interpreter is compatible with InfluxDB 1.8+ and InfluxDB 2.0+ (v2 API, Flux language)
  • Code complete and syntax highlighting is not supported for now

Example notebook

InfluxDB notebook

Configuration

Property Default Value
influxdb.url http://localhost:9999 InfluxDB API connection url
influxdb.org my-org organization name, Organizations are supported in InfluxDB 2.0+, use "-" as org for InfluxDB 1.8
influxdb.token my-token authorization token for InfluxDB API, token are supported in InfluxDB 2.0+, for InfluxDB 1.8 use 'username:password' as a token.
influxdb.logLevel NONE InfluxDB client library verbosity level (for debugging purpose)

Example configuration

InfluxDB notebook

Overview

How to use

Basically, you can use

%influxdb
from(bucket: "my-bucket")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "cpu")
  |> filter(fn: (r) => r.cpu == "cpu-total")
  |> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")

In this example we use data collected by [[inputs.cpu]] Telegraf input plugin.

The result of Flux command can contain more one or more tables. In the case of multiple tables, each table is rendered as a separate %table structure. This example uses pivot function to collect values from multiple tables into single table.

How to run InfluxDB 2.0 using docker

docker pull quay.io/influxdb/influxdb:nightly
docker run --name influxdb -p 9999:9999 quay.io/influxdb/influxdb:nightly

## Post onBoarding request, to setup initial user (my-user@my-password), org (my-org) and bucketSetup (my-bucket)"
curl -i -X POST http://localhost:9999/api/v2/setup -H 'accept: application/json' \
    -d '{
            "username": "my-user",
            "password": "my-password",
            "org": "my-org",
            "bucket": "my-bucket",
            "token": "my-token"
        }'