# How to send data to InfluxDB

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FgxltpCaldB9EddCmJRFY%2Fimage.png?alt=media\&token=5a8ec038-cffa-44db-9ab0-28e96ef1852c)

{% hint style="success" %}
**Benefits of the InfluxDB output connector**:

* Directly stream device data from akenza to **InfluxDB** and subsequently process it in [InfluxDB](https://www.influxdata.com/influxcloud-trial/?utm_source=google\&utm_medium=cpc\&utm_campaign=2020-09-03_Cloud_Traffic_Brand-InfluxDB_INTL\&utm_term=influxdb\&gclid=CjwKCAjwwsmLBhACEiwANq-tXO3ju9IrpozwrsVANuccWCEXZ1kR7ruC4bd1K9mdAiI69dNY6_8YBxoC3p0QAvD_BwE)
* Easily process **low-power device** data e.g. LoRaWAN device data in **InfluxDB**
  {% endhint %}

In this tutorial, you will learn, how to send data to **InfluxDB**. The following steps are explained in more detail:

1. [Setup an **InfluxDB**](#1.-setup-an-influxdb)&#x20;
2. [Setup a **Data Flow** in akenza ](#2.-setup-a-data-flow-in-akenza)
3. [Visualize data](#3.-visualize-data)
4. [Use alerts and tasks](#4.-use-alerts-and-tasks)
5. [Useful Links](#6.-useful-links)

### 1. Setup an InfluxDB&#x20;

First, you will need to either set up an [InfluxDB OSS 2.0](https://docs.influxdata.com/influxdb/v2.0/get-started/) or set up an [InfluxDB cloud](https://cloud2.influxdata.com/signup) account in order to successfully process data from akenza to **InfluxDB**.

#### 1.1 Create an Organization

In the navigation menu on the left, select the **Account dropdown**. Select *Create Organization*. In the window that appears accordingly, enter an **Organization Name** and **Bucket Name** and select *Create*.

{% hint style="info" %}
More information about how to create an organization can be found [here](https://docs.influxdata.com/influxdb/v2.0/organizations/create-org/#organization-and-bucket-limits).
{% endhint %}

#### 1.2 Create an InfluxDB bucket

* Navigate to *Data* - *Buckets*
* Create a new Bucket to define where you want to store the data forwarded from akenza

{% hint style="info" %}
More information about how to create a bucket can be found [here](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/create-bucket/).
{% endhint %}

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fvmb7hqnG9JcOzR7lslkg%2Fimage.png?alt=media\&token=5a843167-bc2d-4a1a-b3ff-0c8fa04473f2)

#### 1.3 Add an API Token

* Navigate to *Data - API Tokens*&#x20;
* Create a new API Token with **Write access** to the Bucket you want to store the data

{% hint style="info" %}
More information about how to create a token can be found [here](https://docs.influxdata.com/influxdb/v2.0/security/tokens/create-token/).
{% endhint %}

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FRsDRMSKuN5AjPuovxvCb%2Fimage.png?alt=media\&token=5df4eee8-9920-493d-a691-8ec9fc5f1f67)

### 2. Setup a Data Flow in akenza

Create a new **Data Flow** in akenza with **Influx DB** as Output Connector. Define a **Connector Name,** insert the InfluxDB **URL** under which your InfluxDB can be reached. Put the **Organization Id** of the organization created in step one in the **InfluxDB Org** field. Chose the **Bucket name** created in step one into the InfluxDB **Bucket** field. Copy the API Token created in step one into the InfluxDB **API Token** field.

{% hint style="info" %}
Optionally:

* Set a **measurement name**. If not set, it will be set to the topic of a sample.
* Set a **custom payload.** If not set, the data part of the sample will be used as the payload.
  {% endhint %}

![InfluxDB template](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2FQh1illlE7FCycJN2gS5s%2Fimage.png?alt=media\&token=04b60eb0-8862-4753-b524-7a08c6515571)

[Create a new device](https://docs.akenza.io/akenza.io/how-to-create-a-working-environment/how-to-connect-a-device) using the Data Flow and start sending data.

{% hint style="info" %}

* Only the data part of the data sample will be forwarded to InfluxDB
* The **device Id**, **akenza Id** and **device name** will be used as tags in InfluxDB
  {% endhint %}

### 3. Visualize data

In order to check if uplinks arrive in your InfluxDB bucket, navigate to *Explore* and create a query by selecting the Bucket created in step one, a measurement name and clicking submit. The data should now be shown. This query can be refined by selecting more filters.

![](https://2165942204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MMKXTFIN5ZlLOjBlfC4%2Fuploads%2Fotx9EbSAfOsNfg0FSXow%2Fimage.png?alt=media\&token=cf6b4102-1bea-46a0-b323-aeb0bb10802a)

### 4. Use alerts and tasks

Once a device is connected to the **InfluxDB**, device data can be further used on various services in InfluxDB.

{% hint style="success" %}
**Possible services are:**

* [**Tasks**](https://docs.influxdata.com/influxdb/cloud/process-data/) to analyze, modify, and act on data
* [**Alerts**](https://docs.influxdata.com/influxdb/cloud/monitor-alert/) to monitor data and send alerts
  {% endhint %}

### 5. Useful Links

* [InfluxDB Output Connector on akenza](https://docs.akenza.io/akenza.io/get-started/your-data-flow/connectors/databases/influxdb)

{% embed url="<https://www.influxdata.com/influxcloud-trial?gclid=CjwKCAjwwsmLBhACEiwANq-tXO3ju9IrpozwrsVANuccWCEXZ1kR7ruC4bd1K9mdAiI69dNY6_8YBxoC3p0QAvD_BwE>" %}

{% embed url="<https://docs.influxdata.com/influxdb/v2.0/get-started#start-with-influxdb-cloud-2-0>" %}
