InfluxDB Cloud Native Collectors, Enterprise and Industrial IoT Examples - Part 1

Navigate to:

Learn how to deploy InfluxDB Cloud’s Native Collectors with Kepware and The Things Network.

Did you hear about the new feature that just dropped to InfluxDB Cloud? Native Collectors! Starting with MQTT.

There will be plenty of content to get you started with Native Collectors. So this blog series covers connecting two popular IoT-based platforms to InfluxDB Cloud using native Collectors. One Enterprise use case and one industrial use case.

A quick reminder:

In short, Native Collectors allow users to spin up subscribers for well-known industry protocols which allow you to connect, ingest, and parse data into InfluxDB. The first native protocol released is MQTT!

The plan

The plan is to connect The Things Network (Enterprise) and Kepware (Industrial) to the same InfluxDB Cloud instance. This should look a little like this:

InfluxDB-Cloud-Native-Collectors-OG

The great thing about these two platforms is that they give us the opportunity to explore different features within Native Collectors. Below I have created a table outlining the features we will be covering:

There is a lot to cover in one blog post, so we shall split the content into a two-part series:

Kepware (Part 1) The Things Network (Part 2)
  • Connecting an edge platform to the cloud
  • Sending line protocol within an MQTT payload
  • Authentication
  • JSON payload parsing

Lots to do, so let’s rock and roll!

Kepware - industrial example

Kepware provides one of the largest connectivity suites for automation devices such as PLC’s easing the bridge between the OT (Operation Technology) and IT (Information Technology) world. In the past, we have used Telegraf or InfluxDB API to send data from Kepware to InfluxDB Cloud (Check out this post to learn more).

In this example, we will use a sample Kepware server project which you can find here. I will also make use of HiveMQ’s Public MQTT Broker to save us from hosting our own broker in the cloud. I DO NOT RECOMMEND USING A PUBLIC BROKER FOR ANY PRODUCTION / SYSTEMS WITH SENSITIVE DATA.

Let’s start by configuring Kepware to talk to the HiveMQ broker:

  1. Open KepwareServerEX Configuration.
  2. Create a new IoT Gateway agent. Select MQTT Client from the dropdown. new-agent
  3. Update the URL to point to your broker address, and if required, change the topic name. Note Kepware also gives you the option to choose Wide format or Narrow Format. This allows you to define how many machine tags are sent within a single MQTT payload. In our case, we will select Wide. MQTT-Client-Broker
  4. Next you will be asked to provide your username and password credentials to connect with the broker. You may also define a ClientID at this point. Once completed, click Finish.
  5. Next we will update our MQTT payload format to support line protocol. To do this, right-click your newly created agent and select properties. Update our MQTT payload
  6. Navigate to Message. Select Advanced Template from the Message Format dropdown. Select Advanced Template
  7. Update the Template to our line protocol template. Click Ok.
    |#each VALUES|kepware,factory='INSERT' |TAGNAME|=|VALUE| |TIMESTAMP||#unless @last||LINEFEED||/unless||/each| Update the Template to our line protocol template
  8. Select Apply and Ok. You may now add some server tags to your agent. Select apply and ok

We have now completed the Kepware Server side setup for Native Cloud ingest. Let’s now move over to InfluxDB Cloud and set up our MQTT ingester:

  1. Navigate to Native Collectors and select Create Subscription. Navigate to Native Collectors
  2. Let’s first start by connecting to the broker. Define a subscription name and optionally a description. Next, provide your hostname / IP and port. In my case, it’s this:
    Broker: broker.hivemq.com
    TCP Port: 1883
    connect to the broker
  3. We are going to skip Security details in this example as we are connecting to a public broker. We will come back to this step when connecting The Things Network broker. security details
  4. Next, define the topic we want to subscribe to. In this case, we only defined one level to our topic in Kepware. All MQTT wildcard topics are permitted here, and we will use them within our Things Network example. topic subscription
  5. Next, select or create a new bucket as your write destination. write destination
  6. Lastly, we will define Line Protocol as our Data format with a Timestamp precision of milliseconds. Define data parsing rules
  7. Select Save Subscription.
    There you have it! In this example, we have covered connecting Kepware to an MQTT broker and modifying the payload template to line protocol. Let’s now move on to our Enterprise IoT example, The Things Network. ## Conclusion That's Part 1 of the two-part blog series completed. Make sure to stay tuned for Part 2 where we will cover connecting The Things Network using Native Collectors. We are currently looking for community feedback to help improve the MQTT subscriber as well as ideas for new protocol types you would like to see. To continue the conversation, come join us on [Slack](https://www.influxdata.com/slack) and the [forums](https://community.influxdata.com/). Share your thoughts, I look forward to seeing you there!