# InfluxDB

A video walkthrough can be found below:

{% embed url="<https://youtu.be/tpX99Yvi3SE>" %}

## Prerequisites

1. WarpStream account - get access to WarpStream by registering [here](https://console.warpstream.com/signup).
2. InfluxDB account - get access to InfluxDB by registering [here](https://www.influxdata.com/get-influxdb/).
3. InfluxDB Telegraf is [installed locally](https://docs.influxdata.com/telegraf/v1/install/).
4. A WarpStream cluster is up and running.

## Step 1: Get WarpStream data

You will need to collect and save the following pieces of information from WarpStream to be used in InfluxDB before you get started:

* Bootstrap broker
* SASL Username
* SASL Password
* Topic

The first three items can be easily attained by creating a new credential for your cluster in the web UI.

## Step 2: Configure a Kafka source in InfluxDB

Starting in the InfluxDB UI, select the up arrow icon in the left navigation to see available sources. Many options exist, so we enter **Kafka** to narrow it down. There are three results, and it is unclear which one to select; in our case, we are using the middle one that says Kafka Consumer.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-934075a8ea0b82025d950069e22fede4632d2853%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

On the next screen, select **Use this plugin** and **Create a new configuration**.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-048afff0c470c065b3f99438270d426e0c71b0fc%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Give the configuration a name, and if you create a new bucket, select that option, which we will use for this example.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-44a92fd99189d0a7ce96d55620771468bd80dbbe%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

When you create a bucket, you have some options. For this example, we will call the bucket **sensors** to match the Topic feeding it.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-43ffb22397ecbf3ba2c2ccb17c803ff355666eff%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Step 3: Editing the Telegraf script

InfluxDB has a pipeline tool called Telegraf that is coupled with InfluxDB. After you selected **CREATE** at the end of the previous step, you'll be presented with the script for you to update to match your needs. There are several areas to modify, but starting at the top, you want to replace the **brokers** with the value you saved for the **Bootstrap broker** in Step 1, and the **Topic** from Step 1 goes into **topics** to replace the value **telegraf**.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-5fcbb8df46c494a2c5d7bc7ee60beb0247c1c52e%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Next, find the **SASL** segment uncomment **sasl\_username** and **sasl\_password,** then replace the values with those you saved in Step 1. Next, uncomment **sasl\_mechanism** and type **PLAIN** in the quotes.

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-08e04bf759abaa9fc416bf4377d9b9044eac6a08%2Fimage%20(31).png?alt=media" alt=""><figcaption></figcaption></figure>

Just after **sasl\_mechanism**, add the following two lines:

```yaml
enable_tls = true
version = "1.0.0"
```

Then select **SAVE & TEST** at the bottom.

## Step 4: Run Telegraf

The final setup screen you will be presented with is this one:

<figure><img src="https://77315434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjB7FxO8ty4EXO4HsQP4E%2Fuploads%2Fgit-blob-83500e8180bb078d3b327d8f338e147ea8824fe1%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

Save the commands in Steps 2 and 3, then paste them into a terminal where Telegraf is installed. A feature to understand here is that the API token will correlate to the URL for starting Telegraf and will execute the script that you just finished configuring. Editing the Telegraf script on InfluxDB will alter the behavior.

With Telegraf now running, the data in your WarpStream topic will be available in InfluxDB for access using its broad range of tools.

## Next Steps

Congratulations! You've set up a Telegraf script to pipe data from WarpStream to InfluxDB.

Next, check out the WarpStream docs for configuring the [WarpStream Agent](https://docs.warpstream.com/warpstream/agent-setup/deploy), or review the [InfluxDB docs](https://docs.influxdata.com/) to learn more about what is possible with WarpStream and InfluxDB!
