Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions docs/interpreter/influxdb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
layout: page
title: "InfluxDB Interpreter for Apache Zeppelin"
description: "InfluxDB is an open-source time series database designed to handle high write and query loads."
group: interpreter
---
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
{% include JB/setup %}

# InfluxDB Interpreter for Apache Zeppelin

<div id="toc"></div>

## Overview
[InfluxDB](https://v2.docs.influxdata.com/v2.0/) 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](https://v2.docs.influxdata.com/v2.0/reference/flux/) 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]({{BASE_PATH}}/assets/themes/zeppelin/img/docs-img/influxdb1.png)

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

#### Example configuration

![InfluxDB notebook]({{BASE_PATH}}/assets/themes/zeppelin/img/docs-img/influxdb2.png)

## 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](https://github.com/influxdata/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
```bash
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"
}'

```





18 changes: 18 additions & 0 deletions influxdb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
InfluxDB 2.0 interpreter for Apache Zeppelin
============================================

## Description:

Provide InfluxDB Interpreter for Zeppelin.

## Build

```
mvn -pl influxdb -am -DskipTests package
```

## Test

```
mvn -pl influxdb -am -Dtest='org.apache.zeppelin.influxdb.*' -DfailIfNoTests=false test
```
79 changes: 79 additions & 0 deletions influxdb/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>zeppelin-interpreter-parent</artifactId>
<groupId>org.apache.zeppelin</groupId>
<version>0.9.0-SNAPSHOT</version>
<relativePath>../zeppelin-interpreter-parent/pom.xml</relativePath>
</parent>

<artifactId>zeppelin-influxdb</artifactId>
<packaging>jar</packaging>
<version>0.9.0-SNAPSHOT</version>
<name>Zeppelin: InfluxDB interpreter</name>
<description>InfluxDB 2.0 timeseries database support</description>

<properties>
<interpreter.name>influxdb</interpreter.name>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<influxdb.client.version>1.7.0</influxdb.client.version>
<dependency.okhttp3.version>3.13.1</dependency.okhttp3.version>
<dependency.gson.version>2.8.5</dependency.gson.version>
</properties>

<dependencies>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-java</artifactId>
<version>${influxdb.client.version}</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the license of this dependency ? You need to put it in LICENCE file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIT, I added license to zeppelin-distribution/src/bin_license/LICENSE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added RxJava (Apache2 license) (used by InfluxDB client library)

</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${dependency.gson.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${dependency.okhttp3.version}</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same licence issue as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apache 2, I added license to zeppelin-distribution/src/bin_license/LICENSE

<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Loading