<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>InfluxData Blog - Todd Persen</title>
    <description>Posts by Todd Persen on the InfluxData Blog</description>
    <link>https://www.influxdata.com/blog/author/toddp/</link>
    <language>en-us</language>
    <lastBuildDate>Wed, 07 Dec 2016 11:51:57 -0700</lastBuildDate>
    <pubDate>Wed, 07 Dec 2016 11:51:57 -0700</pubDate>
    <ttl>1800</ttl>
    <item>
      <title>Assessing Write Performance of InfluxDB's Clusters w/ AWS</title>
      <description>&lt;div class="page" title="Page 2"&gt;
&lt;div class="section"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;

While conducting the various benchmark tests against InfluxData, we decided to also explore the aspects of scaling clusters of InfluxDB with our closed-source InfluxDB Enterprise product, primarily through the lens of write performance.

This data should prove valuable to developers and architects evaluating the suitability of InfluxDB Enterprise for their use case, in addition to helping establish some rough guidelines for what those users should expect in terms of write performance in a real-world environment.

&lt;em&gt;To read the complete details of the benchmarks and methodology, &lt;a href="https://w2.influxdata.com/resources/assessing-write-performance-of-influxdb-clusters-using-amazon-web-services/?ao_campid=70137000000JgNp"&gt;download&lt;/a&gt; the "Assessing Write Performance of InfluxDB's Clusters w/ AWS" technical paper or watch the &lt;a href="https://w2.influxdata.com/resources/how-cluster-creation-and-differences-impact-performance/?ao_campid=70137000000JZXW"&gt;recorded video&lt;/a&gt; titled: "How cluster creation and differences impact performance."&lt;/em&gt;

&lt;!--more--&gt;Our goal with this benchmarking test was to create a consistent, up-to-date comparison that reflects the latest developments in InfluxDB and InfluxDB Enterprise. Periodically, we'll re-run these benchmarks and update this document with our findings. All of the &lt;a href="https://github.com/influxdata/influxdb-comparisons"&gt;code for these benchmarks &lt;/a&gt;are available on GitHub. Feel free to open up issues or pull requests on that repository or if you have any questions, comments, or suggestions.

Now, let's take a look at the results…
&lt;h2&gt;Versions Tested&lt;/h2&gt;
&lt;div class="page" title="Page 3"&gt;
&lt;div class="section"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;

InfluxDB Enterprise: v1.1.0

InfluxDB is an open-source time-series database written in Go. At its core is a custom-built storage engine called the Time-Structured Merge (TSM) Tree, which is optimized for time series data. Controlled by a custom SQL-like query language named InfluxQL, InfluxDB provides out-of-the-box support for mathematical and statistical functions across time ranges and is perfect for custom monitoring and metrics collection, real-time analytics, plus IoT and sensor data workloads.
&lt;h2&gt;About the Benchmarks&lt;/h2&gt;
&lt;div class="page" title="Page 4"&gt;
&lt;div class="section"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;

In building this benchmark suite, we identified a few parameters that are most relevant to scaling write performance. As we'll describe in additional detail below, we looked at performance across three vectors:
&lt;ol&gt;
 	&lt;li&gt;Number of Data Nodes&lt;/li&gt;
 	&lt;li&gt;Replication Factor&lt;/li&gt;
 	&lt;li&gt;Batch Size&lt;/li&gt;
&lt;/ol&gt;
The trends for these are relatively straightforward. We expect throughput to increase with more data nodes and a larger batch size, and to decrease with a higher replication factor (since the replication factor means that data has to be written throughout the cluster multiple times).
&lt;h2&gt;About the Data Set&lt;/h2&gt;
&lt;div class="page" title="Page 4"&gt;
&lt;div class="section"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;

For this benchmark, we focused on a dataset that models a common DevOps monitoring and metrics use case, where a fleet of servers are periodically reporting system and application metrics at a regular time interval. We sampled 100 values across 9 subsystems (CPU, memory, disk, disk I/O, kernel, network, Redis, PostgreSQL, and Nginx) every 10 seconds. For the key comparisons, we looked at a dataset that represents 10,000 servers over a 24-hour period, which represents a decent-sized production deployment. We also provided some color about how these comparisons scale with a larger dataset, both in duration and number of servers.

&lt;/div&gt;
&lt;ul&gt;
 	&lt;li&gt;Number of Servers: 1,000&lt;/li&gt;
 	&lt;li&gt;Values measured per Server: 100&lt;/li&gt;
 	&lt;li&gt;Measurement Interval: 10s&lt;/li&gt;
 	&lt;li&gt;Dataset duration(s): 24h&lt;/li&gt;
 	&lt;li&gt;Total values in dataset: 8,640,000,000/day&lt;/li&gt;
&lt;/ul&gt;
This is only a subset of the entire benchmark suite, but it's a representative example. If you're interested in additional detail, you can read more about the testing methodology on &lt;a href="https://github.com/influxdata/influxdb-comparisons"&gt;GitHub&lt;/a&gt;.
&lt;h2&gt;Write Performance&lt;/h2&gt;
InfluxDB Enterprise scales horizontally for writes, showing throughput increases for up to 32 datanodes

&lt;img class="alignnone wp-image-6965 size-full" src="/images/legacy-uploads/Sustained-Write-Throughput.png" alt="showing throughput increases for up to 32 datanodes" width="1024" height="530" /&gt;

For maximum write performance, make sure you use multiple concurrent workers per data node.

&lt;img class="alignnone wp-image-6967 size-full" src="https://influxdata.com/wp-content/uploads/graph3-1024x658.png" alt="multiple concurrent workers per data node" width="1024" height="658" /&gt;

Using larger batch sizes will generally increase total write throughput to the cluster.

&lt;img class="alignnone wp-image-6968 size-full" src="/images/legacy-uploads/graph2-1024x636.png" alt="Sustained Write Throughput" width="1024" height="636" /&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;The benchmarking tests and resulting data demonstrated that along these vectors, InfluxDB Enterprise should generally:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Achieve higher write throughput with more data nodes&lt;/li&gt;
 	&lt;li&gt;Achieve lower write throughput with a higher replication factor&lt;/li&gt;
 	&lt;li&gt;Achieve higher write throughput with larger batch sizes&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="page" title="Page 9"&gt;
&lt;div class="section"&gt;
&lt;div class="layoutArea"&gt;

Most excitingly, we demonstrated that a 32-node cluster of InfluxDB Enterprise is capable of handling over 11.1 million writes per second singly-replicated, and over 9 .3 million writes per second doubly-replicated. In contrast, single nodes of InfluxDB generally hit peak performance at just under 1 million writes per second, even on the most performant hardware.

We highly encourage developers and architects to run these benchmarks themselves to independently verify the results on their hardware and data sets of choice. However, for those looking for a valid starting point on which settings will help optimize write performance, these results should serve as a useful guide for scaling and optimizing InfluxDB Enterprise clusters.

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;&lt;b&gt;What's next&lt;/b&gt;&lt;/h3&gt;
&lt;ul&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;a href="https://docs.influxdata.com/chronograf/v1.3/introduction/getting-started/"&gt;&lt;span style="font-weight: 400;"&gt;Chronograf Getting Started&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;a href="https://w2.influxdata.com/downloads/"&gt;&lt;span style="font-weight: 400;"&gt;Downloads&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: 400;"&gt; for the TICK-stack are live on our "downloads" page&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Deploy on the Cloud: Get started with a FREE trial of &lt;/span&gt;&lt;a href="https://cloud.influxdata.com/"&gt;&lt;span style="font-weight: 400;"&gt;InfluxDB Cloud&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: 400;"&gt; featuring fully-managed clusters, Kapacitor and Grafana.&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of &lt;/span&gt;&lt;a href="https://portal.influxdata.com/"&gt;&lt;span style="font-weight: 400;"&gt;InfluxDB Enterprise&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: 400;"&gt; featuring an intuitive UI for deploying, monitoring and rebalancing clusters, plus managing backups and restores.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Wed, 07 Dec 2016 11:51:57 -0700</pubDate>
      <link>https://www.influxdata.com/blog/assessing-write-performance-of-influxdbs-clusters-w-aws/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/assessing-write-performance-of-influxdbs-clusters-w-aws/</guid>
      <category>Product</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Announcing Multi-Tenant Grafana Support for InfluxDB Cloud Service</title>
      <description>&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Due to the great feedback from our customers, we are excited to announce that we are adding dedicated instances of Grafana to InfluxDB Cloud service. We know that the data our customers collect about their applications and services is powerful, and that allowing configurable access to different groups and users in their organization to view this information with their own dashboards extends this power.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Multi-tenant support for Grafana is available to all InfluxDB Cloud customers, regardless of their plan, at only $200/month.&lt;/span&gt;&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Of course, current customers of InfluxDB Cloud can still continue to enjoy the free option that comes with every purchase where all users have access to the same set of dashboards and data.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Setting up InfluxDB Cloud service with this new capability is simple - choose the option in your InfluxDB Cloud dashboard and configure your users and organizations in the Grafana Server Admin page. We have prepared a &lt;a href="https://vimeo.com/187078134"&gt;quick video&lt;/a&gt; to show you how. &lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;&lt;a href="https://help.influxcloud.net/grafana/"&gt;InfluxDB Cloud Multi-tenant and dashboard setup&lt;/a&gt; &lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;&lt;a href="https://docs.grafana.org/reference/admin/#grafana-administrators"&gt;Grafana Administrator setup&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;&lt;a href="https://help.influxcloud.net/getting_started/#access-grafana"&gt;InfluxDB Cloud's single tenant Grafana option setup&lt;/a&gt; &lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;span style="font-weight: 400;"&gt;So why choose InfluxDB Cloud?&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span style="font-weight: 400;"&gt;InfluxDB Cloud is a great way to gather, store, and analyze a variety of metrics from various systems without the hassle of setting up an environment to host InfluxDB - allowing customers to focus more on the “Dev” and less on the “Ops.” The reasons are simple:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Improve your business - Gain insights that translate into great user experiences for your customers&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Automate business processes - See what happens in your dynamic, distributed environments and address issues calmly - no more fire drills&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Good Value - don't spend a fortune, pay for capacity when you need it&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-weight: 400;"&gt;In addition, you will never have to worry about:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Dealing with failover, keeping the systems always available &lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Updates, backups, &amp;amp; dealing with finicky upgrade processes&lt;/span&gt;&lt;/li&gt;
 	&lt;li style="font-weight: 400;"&gt;&lt;span style="font-weight: 400;"&gt;Finding the hardware and people to monitor, manage &amp;amp; scale systems&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="font-weight: 400;"&gt;The InfluxDB Cloud service already comes with full clustering support at no additional charge to ensure that you can focus on what matters most.&lt;/span&gt;&lt;/p&gt;
</description>
      <pubDate>Thu, 13 Oct 2016 04:00:14 -0700</pubDate>
      <link>https://www.influxdata.com/blog/announcing-multi-tenant-grafana-support-for-influxcloud/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/announcing-multi-tenant-grafana-support-for-influxcloud/</guid>
      <category>Product</category>
      <category>Developer</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>TL;DR InfluxDB Tech Tips - Convert Timestamps to Become Readable With Influx DB's CLI</title>
      <description>&lt;p&gt;&lt;i&gt;&lt;span style="font-weight: 300;"&gt;To learn about Flux Timestamps, check out this &lt;/span&gt;&lt;/i&gt;&lt;a href="https://w2.influxdata.com/blog/tldr-tech-tips-flux-timestamps/"&gt;&lt;i&gt;&lt;span style="font-weight: 300;"&gt;blog&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;i&gt;&lt;span style="font-weight: 300;"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;In this post we recap the week’s most interesting InfluxDB’s CLI issue with the ability to convert timestamps to become readable and TICK-stack related issues, workarounds, how-tos and Q&amp;amp;A from &lt;a href="https://github.com/influxdata/influxdb/issues"&gt;GitHub&lt;/a&gt;, IRC and the InfluxDB &lt;a href="https://plus.google.com/communities/114507511002042654305"&gt;Google Group&lt;/a&gt; that you might have missed.&lt;!--more--&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a href="https://groups.google.com/forum/#!topic/influxdb/SCLP1LA3jZg"&gt;Human-readable timestamps in the CLI&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;Question: &lt;/b&gt;How do you make InfluxDB’s CLI return human readable timestamps?&lt;/p&gt;

&lt;p&gt;Instead of this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;name: clothes
---------
time                percent_cool
892482496000000000  0.5&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Return this:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;name: clothes
---------
time                   percent_cool
1998-04-13T15:48:16Z   0.5&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Answer: &lt;/b&gt;&lt;span style="font-weight: 400;"&gt;When you first connect to the CLI, specify the &lt;/span&gt;&lt;a href="https://www.ietf.org/rfc/rfc3339.txt"&gt;&lt;span style="font-weight: 400;"&gt;rfc3339&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: 400;"&gt; precision:&lt;/span&gt;&lt;!--more--&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ influx -precision rfc3339&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Alternatively, specify the precision once you’ve already connected to the CLI:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ influx
Connected to http://localhost:8086 version 0.xx.x
InfluxDB shell 0.xx.x
&amp;gt; precision rfc3339
&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-weight: 400;"&gt;Check out &lt;/span&gt;&lt;a href="https://docs.influxdata.com/influxdb/latest/tools/shell/"&gt;&lt;span style="font-weight: 400;"&gt;our docs&lt;/span&gt;&lt;/a&gt;&lt;span style="font-weight: 400;"&gt; for more useful command line interface options.&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="line-height: 1.5;"&gt;For more InfluxDB tips, see our &lt;a style="line-height: 1.5;" href="https://docs.influxdata.com/influxdb/latest/troubleshooting/frequently-asked-questions/"&gt;Frequently Asked Questions&lt;/a&gt;&lt;span style="line-height: 1.5;"&gt; page and feel free to post your questions in the &lt;a style="line-height: 1.5;" href="https://groups.google.com/forum/#!forum/influxdb"&gt;InfluxDB users group&lt;/a&gt;&lt;span style="line-height: 1.5;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;What's next?&lt;/h3&gt;
&lt;ul&gt;
 	&lt;li&gt;Looking for InfluxDB clustering on your infrastructure? &lt;a href="https://portal.influxdata.com/" target="_blank" rel="noopener noreferrer"&gt;Get started&lt;/a&gt; with InfluxDB Enterprise Beta, now available for evaluation.&lt;/li&gt;
 	&lt;li&gt;&lt;a href="https://w2.influxdata.com/downloads/" target="_blank" rel="noopener noreferrer"&gt;Download&lt;/a&gt; and &lt;a href="https://docs.influxdata.com/influxdb/latest/introduction/getting_started/" target="_blank" rel="noopener noreferrer"&gt;get started&lt;/a&gt; with InfluxDB 1.0 Beta 3&lt;/li&gt;
 	&lt;li&gt;Schedule a &lt;a href="https://w2.influxdata.com/contact-us/contact-sales/" target="_blank" rel="noopener noreferrer"&gt;FREE 20 minute consultation&lt;/a&gt; with a Solutions Architect to review your InfluxDB project&lt;/li&gt;
 	&lt;li&gt;Attend one of our FREE &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener noreferrer"&gt;virtual training seminars&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Thu, 04 Aug 2016 23:08:50 -0700</pubDate>
      <link>https://www.influxdata.com/blog/tldr-influxdb-tech-tips-august-4-2016/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/tldr-influxdb-tech-tips-august-4-2016/</guid>
      <category>Developer</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Improved MQTT Support in InfluxDB with SurgeMQ</title>
      <description>&lt;p&gt;As InfluxDB has &lt;a href="http://db-engines.com/en/ranking_trend/time+series+dbms"&gt;grown in popularity&lt;/a&gt; over the past two and a half years, we’ve seen it used in many different use cases across custom DevOps monitoring, real-time analytics, and the Internet of Things (IoT). Each of these domains has its own patterns, standards, and protocols, so we’ve been working hard to make &lt;a href="https://github.com/influxdata/telegraf"&gt;Telegraf&lt;/a&gt;, our open-source data collection agent, support as many services and systems as possible. This helps our users get data into and out of InfluxDB easily and enables developers to keep building awesome new applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mqtt.org/"&gt;MQTT&lt;/a&gt; is an example of one of the aforementioned protocols, which is heavily used in industrial monitoring and has become increasingly popular in IoT applications. We recently &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/inputs/mqtt_consumer"&gt;added support to Telegraf&lt;/a&gt; for consuming data from &lt;a href="https://www.influxdata.com/mqtt/"&gt;MQTT&lt;/a&gt; brokers, but given &lt;a href="https://github.com/mqtt/mqtt.github.io/wiki/brokers"&gt;the amount of segmentation&lt;/a&gt; &lt;a href="https://github.com/mqtt/mqtt.github.io/wiki/servers"&gt;in the MQTT broker space&lt;/a&gt; and the specific requirements of high-performance brokers (e.g. very high numbers of concurrent connections), we started to pursue the possibility of building our own MQTT broker to ensure the tightest possible integration with the rest of our products and allow us to more effectively work with customers and partners to build IoT solutions backed by InfluxDB.&lt;/p&gt;

&lt;p&gt;We’re huge supporters of the Go programming language, as &lt;a href="https://blog.gopheracademy.com/birthday-bash-2014/why-influxdb-uses-go/"&gt;we’ve discussed in the past&lt;/a&gt;, so it was important to us that the project be written in Go for optimal productivity, performance, and community engagement. When we began our investigation, we discovered the &lt;a href="https://github.com/influxdata/surgemq"&gt;SurgeMQ&lt;/a&gt; project, written in Go by the brilliant and incredibly talented &lt;a href="https://twitter.com/zhenjl"&gt;Jian Zhen&lt;/a&gt;. After a few weeks of initial discussions, we received Jian’s blessing to officially take over the project. Says Jian, “I’ve been watching the InfluxDB project from its early days, and I’m a huge fan. I’m happy to see SurgeMQ helping people use InfluxDB in new ways.”&lt;/p&gt;

&lt;p&gt;Effective immediately, we’ll be working to finish turning SurgeMQ into a standalone server and begin building packages for it alongside the rest of our products.&lt;!--more--&gt;&lt;/p&gt;
&lt;h2&gt;Why does this matter?&lt;/h2&gt;
&lt;p&gt;First and foremost, becoming the official maintainers of SurgeMQ will allow us to begin working efficiently to prioritize the features that will enable a great IoT experience with InfluxDB, Telegraf, and Kapacitor. If there are features you’d like to see supported within SurgeMQ for your use case, please &lt;a href="https://github.com/influxdata/surgemq/issues"&gt;open up a GitHub issue&lt;/a&gt; and let us know.&lt;/p&gt;

&lt;p&gt;Most importantly, this allows us to better support users and customers that are building IoT applications on top of InfluxDB by broadening our stack and expertise. We believe that as we see more usage within the IoT and Industrial Historian markets, we’ll be able provide more complete solutions and make it easier to have an amazing experience with InfluxDB.&lt;/p&gt;

&lt;p&gt;We hope this announcement gets you excited to start using MQTT within the InfluxData ecosystem. If you’re interested in contributing or giving us feedback, head on over to &lt;a href="https://github.com/influxdata/surgemq"&gt;the GitHub project&lt;/a&gt;!&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="https://w2.influxdata.com/downloads/" target="_blank" rel="noopener"&gt;Download&lt;/a&gt; and &lt;a href="https://docs.influxdata.com/influxdb/latest/introduction/getting_started/" target="_blank" rel="noopener"&gt;get started&lt;/a&gt; with InfluxDB v1.0 Beta 2.&lt;/li&gt;
 	&lt;li&gt;Looking for InfluxDB clustering on your infrastructure? &lt;a href="https://portal.influxdata.com/" target="_blank" rel="noopener"&gt;Get started&lt;/a&gt; with InfluxDB Enterprise now available for evaluation.&lt;/li&gt;
 	&lt;li&gt;Schedule a &lt;a href="https://w2.influxdata.com/contact-us/contact-sales/" target="_blank" rel="noopener"&gt;FREE 20 minute consultation&lt;/a&gt; with a Solutions Architect to review your InfluxDB project&lt;/li&gt;
 	&lt;li&gt;Attend one of our FREE &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener"&gt;virtual training seminars&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
</description>
      <pubDate>Thu, 23 Jun 2016 06:00:10 -0700</pubDate>
      <link>https://www.influxdata.com/blog/mqtt-surgemq-iot-influxdb-internet-of-things/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/mqtt-surgemq-iot-influxdb-internet-of-things/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <category>Company</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Part 7: How-to Create an IoT Project with the TICK Stack on the Google Cloud Platform</title>
      <description>&lt;h2&gt;Part 7 : Collecting System Sensor Data with Telegraf&lt;/h2&gt;
&lt;p&gt;The last part of this tutorial looks at &lt;a href="https://w2.influxdata.com/time-series-platform/telegraf/"&gt;Telegraf&lt;/a&gt;, the “T” in the TICK Stack. Telegraf is an agent that is used to collect metrics from various input channels and write them to output channels. It supports over &lt;a href="https://github.com/influxdata/telegraf"&gt;60 plugins&lt;/a&gt; which can function as the input source or output target of data.&lt;/p&gt;

&lt;p&gt;The agent is completely plugin driven and while it supports multiple plugins off the bat, you can &lt;a href="https://github.com/influxdata/telegraf/blob/master/CONTRIBUTING.md"&gt;write your own plugins&lt;/a&gt; too.&lt;/p&gt;

&lt;p&gt;Our tutorial so far has looked at collecting temperature data from multiple weather stations and persisting that in InfluxDB. In addition to that, we also looked at setting up Chronograf to view the temperature data via a dashboard and set up alerts via Kapacitor, that pushed notifications to Slack in case the temperature went over a certain limit.&lt;/p&gt;

&lt;p&gt;At this point, the data is being collected via Raspberry Pi stations that are having the temperature data and the flow is pretty much in place. The area that we would look at utilizing Telegraf would be to monitor the CPU, Memory and other system parameters of the InfluxDB server.&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Telegraf comes along with a input plugin named `system`. This plugin captures various metrics about the system that it is running on like memory usage, CPU, disk usage and more. We shall use this plugin to capture the cpu and memory metrics on the InfluxDB server.&lt;/li&gt;
 	&lt;li&gt;The input metrics captures will need to be sent to an output system. In our case, we will push this data into InfluxDB itself. This will help us capture these metrics into an InfluxDB database on which we could potentially then build out dashboard and alerts too via Chronograf and Kapacitor. Sounds neat. The output plugin therefore will be InfluxDB.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The diagram below depicts what we are going to do:&lt;/p&gt;
&lt;h2&gt;&lt;img class="aligncenter size-full wp-image-8605" src="/images/legacy-uploads/tele1.png" alt="tele1" width="940" height="515" /&gt;
Installing Telegraf&lt;/h2&gt;
&lt;p&gt;We are going to install Telegraf on the InfluxDB Server instance. Currently we just have one instance running in the Google Cloud and we will be setting it up on that.&lt;/p&gt;

&lt;p&gt;As mentioned earlier, the VM runs Debian Linux and we can follow the steps for installing Telegraf as given at the official documentation site. Follow the instructions as given for installing the latest distribution of Telegraf as given below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;wget http://get.influxdb.org/telegraf/telegraf_0.10.2-1_amd64.deb

sudo dpkg -i telegraf_0.10.2-1_amd64.deb&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Configuring Telegraf&lt;/h2&gt;
&lt;p&gt;We need to provide a configuration file to Telegraf. This configuration file will contain not just Agent configuration parameters but also the input and output plugins that you wish to configure.&lt;/p&gt;

&lt;p&gt;There are a ton of plugins for both input and output that Telegraf supports and it does give a command to generate a telegraf.conf (Configuration file) that creates all the input and output plugin configuration sections. That is a useful thing to keep with you but not what we want for our need.&lt;/p&gt;

&lt;p&gt;We will be using the following generic command to generate a Telegraf configuration file for us:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;telegraf -sample-config -input-filter &amp;lt;pluginname&amp;gt;[:&amp;lt;pluginname&amp;gt;] -output-filter &amp;lt;outputname&amp;gt;[:&amp;lt;outputname&amp;gt;] &amp;gt; telegraf.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In our case, we have the following:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Input filters are the ones from the &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system"&gt;system input plugin&lt;/a&gt;. We are interested in cpu and mem.&lt;/li&gt;
 	&lt;li&gt;Output filter is just one and it is the &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb"&gt;InfluxDB output plugin&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We generate a &lt;code&gt;telegraf.conf&lt;/code&gt; as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;telegraf -sample-config -input-filter cpu:mem -output-filter influxdb &amp;gt; telegraf.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let us look at the key sections in the generated &lt;code&gt;telegraf.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;[agent] : This is the section for the Telegraf agent itself. Ideally we do not want to tweak too much here. Do note that you could change the frequency (time interval) at which the data collection is done for all inputs via the `interval` property.&lt;/li&gt;
 	&lt;li&gt;The next section is one or more `outputs`. In our case, it is just `influxdb output` i.e. `[[outputs.influxdb]]`. Two properties are key here, urls and database. The urls property is a list of influxdb instances. In our case there is just one and we are running Telegraf on the same machine as the InfluxDB instance, so the endpoint is pointing to the InfluxDB API Endpoint at `http://localhost:8086`. Similarly, database property is the database in which the input metrics will be collected. By default it is set to `telegraf` but you can change it to another one. I will go with the default one.&lt;/li&gt;
 	&lt;li&gt;The next sections are for the inputs. You can see that it has created the `[[inputs.cpu]]` and `[[inputs.mem]]` inputs. Check out the documentation for both &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system" target="_blank" rel="noopener noreferrer"&gt;cpu&lt;/a&gt; and &lt;a href="https://github.com/influxdata/telegraf/tree/master/plugins/inputs/system" target="_blank" rel="noopener noreferrer"&gt;mem&lt;/a&gt; inputs.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Starting Telegraf and collecting metrics&lt;/h2&gt;
&lt;p&gt;Let us start the Telegraf Agent now via the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;telegraf -config telegraf.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We could have pushed the generated &lt;code&gt;telegraf.conf&lt;/code&gt; into &lt;code&gt;/etc/telegraf&lt;/code&gt; folder and started it as a service, but for the purpose of this tutorial explanation here, this is fine.&lt;/p&gt;

&lt;p&gt;On successful startup, it displays an output as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ telegraf -config telegraf.conf
2016/02/15 04:36:39 Starting Telegraf (version 0.10.2)
2016/02/15 04:36:39 Loaded outputs: influxdb
2016/02/15 04:36:39 Loaded inputs: cpu mem
2016/02/15 04:36:39 Tags enabled: host=instance-1
2016/02/15 04:36:39 Agent Config: Interval:10s, Debug:false, Quiet:false, Hostname:"instance-1", Flush Interval:10s&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Recollect that one of the properties for the Telegraf Agent was the interval property which was set to 10 seconds. This was the interval at which it will poll all the inputs for data.&lt;/p&gt;

&lt;p&gt;Here is the output from several data collection intervals:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;2016/02/15 04:36:40 Gathered metrics, (10s interval), from 2 inputs in 531.909µs
2016/02/15 04:36:50 Gathered metrics, (10s interval), from 2 inputs in 447.937µs
2016/02/15 04:36:50 Wrote 4 metrics to output influxdb in 3.39839ms
2016/02/15 04:37:00 Gathered metrics, (10s interval), from 2 inputs in 482.658µs
2016/02/15 04:37:00 Wrote 3 metrics to output influxdb in 4.324979ms
2016/02/15 04:37:10 Gathered metrics, (10s interval), from 2 inputs in 775.612µs
2016/02/15 04:37:10 Wrote 3 metrics to output influxdb in 7.472159ms
2016/02/15 04:37:20 Gathered metrics, (10s interval), from 2 inputs in 438.388µs
2016/02/15 04:37:20 Wrote 3 metrics to output influxdb in 3.219223ms
2016/02/15 04:37:30 Gathered metrics, (10s interval), from 2 inputs in 419.607µs
2016/02/15 04:37:30 Wrote 3 metrics to output influxdb in 3.159644ms
2016/02/15 04:37:40 Gathered metrics, (10s interval), from 2 inputs in 426.761µs
2016/02/15 04:37:40 Wrote 3 metrics to output influxdb in 3.894155ms
2016/02/15 04:37:50 Gathered metrics, (10s interval), from 2 inputs in 449.508µs
2016/02/15 04:37:50 Wrote 3 metrics to output influxdb in 3.192695ms
2016/02/15 04:38:00 Gathered metrics, (10s interval), from 2 inputs in 498.035µs
2016/02/15 04:38:00 Wrote 3 metrics to output influxdb in 3.831951ms
2016/02/15 04:38:10 Gathered metrics, (10s interval), from 2 inputs in 448.709µs
2016/02/15 04:38:10 Wrote 3 metrics to output influxdb in 3.246991ms
2016/02/15 04:37:30 Gathered metrics, (10s interval), from 2 inputs in 419.607µs
2016/02/15 04:38:20 Gathered metrics, (10s interval), from 2 inputs in 514.15µs
2016/02/15 04:38:20 Wrote 3 metrics to output influxdb in 3.838368ms
2016/02/15 04:38:30 Gathered metrics, (10s interval), from 2 inputs in 520.263µs
2016/02/15 04:38:30 Wrote 3 metrics to output influxdb in 3.76034ms
2016/02/15 04:38:40 Gathered metrics, (10s interval), from 2 inputs in 543.151µs
2016/02/15 04:38:40 Wrote 3 metrics to output influxdb in 3.917381ms
2016/02/15 04:38:50 Gathered metrics, (10s interval), from 2 inputs in 487.683µs
2016/02/15 04:38:50 Wrote 3 metrics to output influxdb in 3.787101ms
2016/02/15 04:39:00 Gathered metrics, (10s interval), from 2 inputs in 617.025µs
2016/02/15 04:39:00 Wrote 3 metrics to output influxdb in 4.364542ms
2016/02/15 04:39:10 Gathered metrics, (10s interval), from 2 inputs in 517.546µs
2016/02/15 04:39:10 Wrote 3 metrics to output influxdb in 4.595062ms
2016/02/15 04:39:20 Gathered metrics, (10s interval), from 2 inputs in 542.686µs
2016/02/15 04:39:20 Wrote 3 metrics to output influxdb in 3.680957ms
2016/02/15 04:39:30 Gathered metrics, (10s interval), from 2 inputs in 526.083µs
2016/02/15 04:39:30 Wrote 3 metrics to output influxdb in 4.32718ms
2016/02/15 04:39:40 Gathered metrics, (10s interval), from 2 inputs in 504.632µs
2016/02/15 04:39:40 Wrote 3 metrics to output influxdb in 3.676524ms
2016/02/15 04:39:50 Gathered metrics, (10s interval), from 2 inputs in 640.896µs
2016/02/15 04:39:50 Wrote 3 metrics to output influxdb in 3.773236ms
2016/02/15 04:40:00 Gathered metrics, (10s interval), from 2 inputs in 491.794µs
2016/02/15 04:40:00 Wrote 3 metrics to output influxdb in 3.608919ms
2016/02/15 04:40:10 Gathered metrics, (10s interval), from 2 inputs in 571.12µs
2016/02/15 04:40:10 Wrote 3 metrics to output influxdb in 3.739155ms
2016/02/15 04:40:20 Gathered metrics, (10s interval), from 2 inputs in 505.122µs
2016/02/15 04:40:20 Wrote 3 metrics to output influxdb in 4.151489ms&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since we have the InfluxDB Server running along with the endpoints for Admin interface, we can investigate the &lt;code&gt;telegraf&lt;/code&gt; database from the Admin interface itself (you could have done that via the InfluxDB shell too!)&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8607" src="/images/legacy-uploads/tele2.png" alt="tele2" width="944" height="404" /&gt;
Here are some of the &lt;code&gt;cpu&lt;/code&gt; measurement records:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8608" src="/images/legacy-uploads/tele3.png" alt="tele3" width="944" height="437" /&gt;
Here are some of the &lt;code&gt;mem&lt;/code&gt; measurement records:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8609" src="/images/legacy-uploads/tele4.png" alt="tele4" width="944" height="552" /&gt;As a next step, you could hook in visualization (Chronograf) or alerts (Kapacitor) into this Telegraf database.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This concludes the 7-part tutorial on using the TICK stack from InfluxDB. The TICK stack provides a best in class set of components to build modern and extensible solutions on a time-series database. We hope this tutorial gave you a glimpse into its potential and gets you started to create winning applications.&lt;/p&gt;
&lt;h2&gt;&lt;span style="line-height: 1.5;"&gt;What's next?&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;Get started with InfluxDB &lt;a href="https://docs.influxdata.com/influxdb/v0.10/introduction/getting_started/"&gt;here&lt;/a&gt;.&lt;/li&gt;
 	&lt;li&gt;Looking to level up your InfluxDB knowledge? Check out our economically priced &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener noreferrer"&gt;virtual&lt;/a&gt; and &lt;a href="https://w2.influxdata.com/public-training-events/" target="_blank" rel="noopener noreferrer"&gt;public trainings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Tue, 08 Mar 2016 08:32:07 -0700</pubDate>
      <link>https://www.influxdata.com/blog/part-7-how-to-create-an-iot-project-with-the-tick-stack-on-the-google-cloud-platform/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/part-7-how-to-create-an-iot-project-with-the-tick-stack-on-the-google-cloud-platform/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Part 6: How-to Create an IoT Project with the TICK Stack on the Google Cloud Platform</title>
      <description>&lt;h2&gt;Part 6 : Setting up Alerts with Kapacitor&lt;/h2&gt;
&lt;p&gt;In this part, we are going to take a look at &lt;a href="https://docs.influxdata.com/kapacitor"&gt;Kapacitor&lt;/a&gt;, the “K” in the TICK stack. Kapacitor is a stream and batch processing engine, that is both a data processor and an alerting engine. In our case, we are going to specifically use it in the following way:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Define an Alert that monitors the temperature data and checks if it crosses a threshold of 30 degrees Celsius.&lt;/li&gt;
 	&lt;li&gt;If the temperature reported is greater than that, we would like to log this record in a file and also raise a notification in our &lt;a href="http://slack.com"&gt;Slack&lt;/a&gt; channel.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The capabilities of Kapacitor are much beyond that and it comes along with a complex engine to detect data patterns and funnel that to multiple channels that it supports straight off the bat. In our case, logging the high temperature in a file and raising a notification via Slack are just a couple of integrations that it can do.&lt;/p&gt;

&lt;p&gt;So let’s get started with setting up Kapacitor and seeing our temperature alert in action.&lt;/p&gt;
&lt;h2&gt;Installing Kapacitor&lt;/h2&gt;
&lt;p&gt;We are going to run Kapacitor on the same instances as our InfluxDB instance. This instance is running on the Google Cloud, so the best way to install this software is by SSH’ing into the instance.&lt;/p&gt;

&lt;p&gt;To set up Kapacitor into our VM instance (the instance running InfluxDB), we will need to SSH into the instance. Follow these steps:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Login to Google Developers Console and select your project.&lt;/li&gt;
 	&lt;li&gt;From the sliding menu on top, go to Compute --&amp;gt; Compute Engine --&amp;gt; VM Instances&lt;/li&gt;
 	&lt;li&gt;You will see your VM instance listed.&lt;/li&gt;
 	&lt;li&gt;Look out for the SSH button at the end of the row.&lt;/li&gt;
 	&lt;li&gt;Click that and wait for the SSH session to get initialized and set up for you. If all is well, you should see another browser window that will transport you to the VM instance as shown below:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8598" src="/images/legacy-uploads/k1.png" alt="k1" width="940" height="371" /&gt;The next thing is to install Kapacitor and since this a Debian Linux that we had opted at the time of creating the VM, we can follow the steps for &lt;a href="https://w2.influxdata.com/downloads/#kapacitor"&gt;installing Kapacitor&lt;/a&gt; as given at the official documentation site.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;wget https://s3.amazonaws.com/kapacitor/kapacitor_0.10.1-1_amd64.deb
sudo dpkg -i kapacitor_0.10.1-1_amd64.deb&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On successful installation you will ideally have two applications that we will be using:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;`kapacitord` : This is the Kapacitor daemon that will need to be running to process the data coming into InfluxDB.&lt;/li&gt;
 	&lt;li&gt;`kapacitor` : This is the CLI that we will use to talk to the kapacitord daemon and setup our tasks, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Generating a default Configuration file&lt;/h2&gt;
&lt;p&gt;Kapacitor is a powerful product with multiple configuration options that makes it challenging to create an initial configuration file. Hence to make it easier, we can take the help of the kapacitord application to help us generate a default configuration file.&lt;/p&gt;

&lt;p&gt;We go ahead and generate a default configuration file : &lt;code&gt;kapacitor.conf&lt;/code&gt; as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitord config &amp;gt; kapacitor.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The Configuration file (kapacitor.conf) has multiple configuration sections including connection to InfluxDB, the various channels that one can configure and more.&lt;/p&gt;

&lt;p&gt;Here are few configuration sections of interest in the &lt;code&gt;kapacitor.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;`[http]` : This is the API Endpoint that kapacitord will expose and which the Kapacitor client will communicate to.&lt;/li&gt;
 	&lt;li&gt;`[influxdb]` : On startup, Kapacitor sets up multiple subscriptions to InfluxDB databases by default. This section has various configuration properties for connecting to the InfluxDB instance. You will notice that it is a localhost url since InfluxDB instance is running on the same instance.&lt;/li&gt;
 	&lt;li&gt;`[logging]` : This section has the default logging level. This can be changed if needed via the Kapacitor client.&lt;/li&gt;
 	&lt;li&gt;`[slack]` : The section that we are interested in our tutorial is to get notified via Slack. The various properties include the channel in Slack that we want to post the message to, the incoming Webhook URL for the Slack Team, etc. We shall look at this a little later in this tutorial, when we set up the Slack Incoming Webhook Integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Start the Kapacitor Service&lt;/h2&gt;
&lt;p&gt;We do not make any changes to our &lt;code&gt;kapacitor.conf&lt;/code&gt; file at the moment. We simply launch the Kapacitor Service as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitord -config kapacitor.conf&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This starts up the Kapacitor Service and you will notice towards the end of the console logging that bunch of subscriptions are setup, including that on the temperature_db database that we are interested in.&lt;/p&gt;
&lt;h2&gt;Kapacitor Client&lt;/h2&gt;
&lt;p&gt;The Kapacitor CLI (kapacitor) is the client application that you will be using to communicate to the Kapacitor Daemon. You can use the client to not just configure Alerts, enable/disable them but also check on their status and more.&lt;/p&gt;

&lt;p&gt;One of the commands to check if there are any Tasks setup for Kapacitor is via the lists command. We can fire that as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor list tasks
Name       Type      Enabled   Executing Databases and Retention Policies&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This shows that currently there are no tasks configured.&lt;/p&gt;
&lt;h2&gt;Create the High Temperature Alert Task via TICKscript&lt;/h2&gt;
&lt;p&gt;The next thing we are going to do is setup the Task to detect if the temperature is greater than 30 degrees Celsius from &lt;em&gt;Station S1&lt;/em&gt;. The Task Script is written in a DSL called &lt;a href="https://docs.influxdata.com/kapacitor/v0.10/tick/"&gt;TICKscript&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The TICKscript for our High Temperature alert is shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;stream
   .from()
   .database('temperature_db')
   .measurement('temperature')
   .where(lambda:"Station" == 'S1')
   .alert()
   .message('{{index .Tags "Station" }} has high temperature : {{ index .Fields "value" }}')
   .warn(lambda:"value" &amp;gt;= 30)
   .log('/tmp/high_temp.log')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that it is intuitive enough to read the script as given below:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;We are looking at working in the stream mode, which means that Kapacitor is subscribing to realtime data feed from InfluxDB v/s batch mode, where Kapacior queries InfluxDB in batches.&lt;/li&gt;
 	&lt;li&gt;We then specify which InfluxDB database via database(). This will monitor the stream of data going into our temperature_db database.&lt;/li&gt;
 	&lt;li&gt;A filter is specified for the Tag Station. The value that we are interested in is the "S1" station.&lt;/li&gt;
 	&lt;li&gt;For the above criteria, we would like to get alerted, only if the measurement value is greater than 30.&lt;/li&gt;
 	&lt;li&gt;If the value is greater than 30, then we would like to log that data in a temporary file at this point (we will see the Slack integration in a while).&lt;/li&gt;
 	&lt;li&gt;The message that we would like to capture (i.e. a custom message) is also specified. For e.g. "S1 has high temperature : 30.5".&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We save the above TICKscript in &lt;code&gt;temperature_alert.tick&lt;/code&gt; file.&lt;/p&gt;
&lt;h2&gt;Configure the High Temperature Alert Task&lt;/h2&gt;
&lt;p&gt;The next step is to use the Kapacitor client to define this task and make it available to Kapacitor. We do that via the define command as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor define \
-name temp_alert \
-type stream \
-tick temperature_alert.tick \
-dbrp temperature_db.default&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the following parameters:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;We name our Task as temp_alert.&lt;/li&gt;
 	&lt;li&gt;We specify that we want to use this in stream mode.&lt;/li&gt;
 	&lt;li&gt;We specify the TICKscript file : temperature_alert.tick.&lt;/li&gt;
 	&lt;li&gt;The Database Retention Policy is selected as the default one (infinite duration and a replication factor set to the number of nodes in the cluster) from the temperature_db database.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We can now look at the tasks that the Kapacitor Service knows about as given below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor list tasks

Name                 Type      Enabled   Executing  Databases and Retention Policies
temp_alert           stream    false     false      ["temperature_db"."default"]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see that the Enabled and Executing properties are set to false.&lt;/p&gt;
&lt;h2&gt;Dry Run : Temperature Alert&lt;/h2&gt;
&lt;p&gt;One of the challenges that you face while developing an Alerting system is to test it out before it goes into Production. A great feature of Kapacitor is to do a dry run of the Alert based on a snapshot/recording of data.&lt;/p&gt;

&lt;p&gt;The steps are straightforward and at a high level we have to do the following:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Make sure that the Alert (temp_alert) is not enabled. We verified that in the previous section.&lt;/li&gt;
 	&lt;li&gt;We ask Kapacitor to record a stream of data that is coming into InfluxDB for a given interval of time (say 20 seconds or 30 seconds). While recording this data, we ensure that some of the data coming in meets the condition to fire the Alert as we are expecting. In our case, if the temperature is above or equal to 30, then it should log the data.&lt;/li&gt;
 	&lt;li&gt;Kapacitor records the data in the defined time interval above and gives us a recording id.&lt;/li&gt;
 	&lt;li&gt;We then replay that data and tell Kapacitor to run it across the Alert (temp_alert) that we have defined.&lt;/li&gt;
 	&lt;li&gt;We check if our TICKscript associated with the alert is working fine by checking our log file (/tmp/high_temp.log) for any entries.&lt;/li&gt;
 	&lt;li&gt;If the Test runs fine, we will then enable the task.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let’s get going on this. We already have our &lt;code&gt;temp_alert&lt;/code&gt; not enabled i.e. the value for the &lt;code&gt;Enabled&lt;/code&gt; attribute is false, as we saw in the &lt;code&gt;kapacitor list tasks&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;The next step is to ask Kapacitor to start recording the data for our alert. We ask it to record the data in stream mode (the other options are batch and query). We specify the duration as 30 seconds and also specify the task name &lt;code&gt;(temp_alert)&lt;/code&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;kapacitor record stream -name temp_alert -duration 30s&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will make Kapacitor record the live stream of data for 30 seconds using the database and retention policy from the task specified. If your data is streaming in, give it a total of 30 seconds to record it. Alternately, you can also generate INSERT statements using Influx client.&lt;/p&gt;

&lt;p&gt;Just ensure that the time interval from the first INSERT to the last INSERT is equal or more than the duration specified (30 seconds), where you send data via manual INSERT statements or even if it is streaming in.&lt;/p&gt;

&lt;p&gt;The above command will complete and will output a recording id, an example of which is shown below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fbd79eaa-50c5-4591-bbb0-e76f354ef074&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can check if the recordings are available in Kapacitor by using the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;kapacitor list recordings &amp;lt;recording-id&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A sample output is shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;ID                                      Type    Size      Created
fbd79eaa-50c5-4591-bbb0-e76f354ef074    stream  159 B     17 Feb 16 22:18 IST&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A size greater than zero indicates that the data was recorded. Now, all we need to do is replay the recorded data against the Alert that we have specified. The -fast parameter is provided to replay the data as fast as possible and not wait for the entire duration that the data was recorded against (in our case 30 seconds)&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;kapacitor replay -id $rid -name temp_alert -fast&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where &lt;code&gt;$rid&lt;/code&gt; is a variable that contains the value of the &lt;code&gt;Recording Id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The data that I had used during the recording phase contained values over 30 degrees centigrade for some of the records and that is exactly what I would expect the Alert to be fired upon and the records to be written to the &lt;code&gt;/tmp/high_temp.log&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;On checking the file &lt;code&gt;/tmp/high_temp.log&lt;/code&gt; for entries, we do notice the entries as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ cat /tmp/high_temp.log
{"id":"temperature:nil","message":"S1 has high temperature : 31", … }
{"id":"temperature:nil","message":"S1 has high temperature : 32", … }
{"id":"temperature:nil","message":"S1 has high temperature : 31", … }&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Enable the Task&lt;/h2&gt;
&lt;p&gt;Now that we have validated that our Alert is working fine, we need to go live with it. This means we need to enable the task as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor enable temp_alert&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can now check up on the details of your task via the &lt;code&gt;show&lt;/code&gt; command as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor show temp_alert&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will print out details on the task along with the TICKscript for the Task as given below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;Name: temp_alert
Error:
Type: stream
Enabled: true
Executing: true
Databases Retention Policies: ["temperature_db"."default"]
TICKscript:
stream
   .from()
   .database('temperature_db')
   .measurement('temperature')
   .where(lambda:"Station" == 'S1')
   .alert()
   .message('{{index .Tags "Station" }} has high temperature : {{ index .Fields "value" }}')
   .warn(lambda:"value" &amp;gt;= 30)
   .log('/tmp/high_temp.log')

DOT:
digraph temp_alert {
stream0 -&amp;gt; stream1 [label="0"];
stream1 -&amp;gt; alert2 [label="0"];
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note that the &lt;code&gt;Enabled&lt;/code&gt; and &lt;code&gt;Executing&lt;/code&gt; properties are now true.&lt;/p&gt;
&lt;h2&gt;High Temperature Alert in Action&lt;/h2&gt;
&lt;p&gt;If the temperature values are coming in, the Task will be executed and the record will be written to the log file. A specific record from the &lt;code&gt;/tmp/high_temp.log&lt;/code&gt; file is shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;{"id":"temperature:nil","message":"S1 has high temperature : 30","time":"2016-01-22T06:37:58.83553813Z","level":"WARNING","data":{"series":[{"name":"temperature","tags":{"Station":"S1"},"columns":["time","value"],"values":[["2016-01-22T06:37:58.83553813Z",30]]}]}}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that the message attribute has the message along with other tags, values and timestamp.&lt;/p&gt;

&lt;p&gt;This confirms that our High Temperature Alert Task has been setup correctly and is working fine. The next thing to do is to set up the Slack Channel Notification.&lt;/p&gt;
&lt;h2&gt;Slack Incoming Hook Integration&lt;/h2&gt;
&lt;p&gt;The Slack API provides multiple mechanisms for external applications to integrate with it. One of them is the Incoming &lt;a href="https://api.slack.com/incoming-webhooks"&gt;Webhooks Integration&lt;/a&gt;. Via this integration mechanism, external applications can post a message to a particular channel or an user inside a Slack Team.&lt;/p&gt;

&lt;p&gt;Kapacitor supports posting messages to your Slack Team via this mechanism, so all we need to do is provide the details to the Kapacitor configuration, specify the slack notification in our TICKscript and we are all set.&lt;/p&gt;
&lt;h2&gt;Enable Slack Channel&lt;/h2&gt;
&lt;p&gt;The first step is to enable this integration inside of your Slack Team. To do that, we will assume that you are logged in to your Slack Team and you are the Administrator.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://slack.com/apps/build"&gt;Slack App Directory&lt;/a&gt; and click on &lt;em&gt;Make a Custom Integration&lt;/em&gt; as shown below:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8600" src="/images/legacy-uploads/k2.png" alt="k2" width="758" height="652" /&gt;
This will bring up a list of Custom Integrations that you can build for your team and we will select the &lt;em&gt;Incoming WebHooks&lt;/em&gt; as shown below:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8601" src="/images/legacy-uploads/k3.png" alt="k3" width="940" height="208" /&gt;
We want the message to be posted to the &lt;em&gt;#general&lt;/em&gt; channel, so we select that channel and click on the &lt;em&gt;Add Incoming WebHooks integration&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8602" src="/images/legacy-uploads/k4.png" alt="k4" width="940" height="308" /&gt;
This completes the WebHooks setup and it will lead you to the details page for the integration that you just setup. This will contain the &lt;em&gt;Webhook URL&lt;/em&gt; that you need to note down. Kapacitor will just need to have this information, so that it can post the JSON Payload data to Slack, which in turn will deliver it to your &lt;em&gt;#general&lt;/em&gt; channel.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8603" src="/images/legacy-uploads/k5.png" alt="k5" width="940" height="246" /&gt;&lt;/p&gt;
&lt;h2&gt;Configuring Slack Channel in Kapacitor Configuration file&lt;/h2&gt;
&lt;p&gt;The next thing that we need to do is go back to the &lt;code&gt;kapacitor.conf&lt;/code&gt; file that our Kapacitor service was using.&lt;/p&gt;

&lt;p&gt;In that file, you will find the &lt;code&gt;[slack]&lt;/code&gt; configuration section and which we fill out as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;[slack]
 enabled = true
 url     = "https://hooks.slack.com/services/&amp;lt;rest of Webhook URL&amp;gt;"
 channel = "#general"
 global  = false&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that the Webhook URL that we got from the previous section is set for the url property. We also enable this channel, specify the &lt;code&gt;channel (#general)&lt;/code&gt; to post to and set the global to false, since we would like to explicitly enabled the Slack integration in our TICKscript.&lt;/p&gt;

&lt;p&gt;Save this file and restart the Kapacitor service again.&lt;/p&gt;

&lt;p&gt;You should see the last few lines in the startup console as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;[udp:temperature_db.default] 2016/01/22 06:46:53 I! Started listening on UDP: 127.0.0.1:35958
[influxdb] 2016/01/22 06:46:53 I! started UDP listener for temperature_db default
[task_master] 2016/01/22 06:46:53 I! Started task: temp_alert&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that the listener has been started for our temperature_db database and our task has also been started.&lt;/p&gt;
&lt;h2&gt;Add Slack Channel to TICKscript&lt;/h2&gt;
&lt;p&gt;We have not yet modified our TICKscript, which only logged the high temperature to a file. We will add the Slack channel now.&lt;/p&gt;

&lt;p&gt;Open up the &lt;code&gt;temperature_alert.tick&lt;/code&gt; file in an editor and add the additional line as highlighted below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;stream
   .from()
   .database('temperature_db')
   .measurement('temperature')
   .where(lambda:"Station" == 'S1')
   .alert()
   .message('{{index .Tags "Station" }} has high temperature : {{ index .Fields "value" }}')
   .warn(lambda:"value" &amp;gt;= 30)
   .slack()
   .log('/tmp/high_temp.log')&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save the &lt;code&gt;temperature_alert.tick&lt;/code&gt; file.&lt;/p&gt;
&lt;h2&gt;Reload Task&lt;/h2&gt;
&lt;p&gt;We will now reload the Task again because we have changed the script. To do that, you have to define the task again (use the same name) as shown below. The &lt;code&gt;define&lt;/code&gt; command will automatically reload an enabled task:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ kapacitor define -name temp_alert -tick temperature_alert.tick&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Slack Channel Notification&lt;/h2&gt;
&lt;p&gt;We are all set now to receive the Slack Notification. If the temperature data is streaming in and if the temperature value is greater than 30 degrees Celsius, you will see a notification in Slack. Shown below is a sample record in our general:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8604" src="/images/legacy-uploads/k6.png" alt="k6" width="769" height="109" /&gt;
This concludes the integration of Kapacitor into our IoT our sensor application.&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;In part seven, we will explore how to use Telegraf to collect system data about our temperature sensors. Follow us on Twitter &lt;a href="https://twitter.com/InfluxDB" target="_blank" rel="noopener"&gt;@influxdb&lt;/a&gt; to catch the next blog in this series.&lt;/li&gt;
 	&lt;li&gt;Looking to level up your InfluxDB knowledge? Check out our economically priced &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener"&gt;virtual&lt;/a&gt; and &lt;a href="https://w2.influxdata.com/public-training-events/" target="_blank" rel="noopener"&gt;public trainings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Thu, 03 Mar 2016 08:30:33 -0700</pubDate>
      <link>https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-6/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-6/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Part 5: How to Create an IoT Project with the TICK Stack on the Google Cloud Platform</title>
      <description>&lt;h2&gt;Part 5: Visualizing IoT Sensor Data with Chronograf&lt;/h2&gt;
&lt;p&gt;So far in the series, we’ve managed to set up InfluxDB and it is now receiving data from various temperature stations. While we can use the InfluxDB web application to query for data, it falls short when it comes to visualizing the same data via charts and dashboards. For e.g. an ability to continuously monitor the data and see it on a graph.&lt;/p&gt;

&lt;p&gt;In this part of the tutorial, we are going to look at Chronograf. &lt;a href="https://w2.influxdata.com/time-series-platform/chronograf/"&gt;Chronograf &lt;/a&gt;is the “C” in the TICK stack and is used for visualization of InfluxDB data. We can use this tool to look at the temperature readings that have been reported via various stations.&lt;/p&gt;

&lt;p&gt;Chronograf is a standalone application that you need to setup on a system. This could reside on premises or in the cloud or even running on your laptop, as we are going to see. As long as you configure it to point to the appropriate InfluxDB data and setup your graphs/dashboards, you can run it from anywhere. Below is a simple GIF that gives you an idea of the how the interface looks:&lt;!--more--&gt;&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8546" src="/images/legacy-uploads/tmplTime-2.gif" alt="" width="1425" height="806" /&gt;&lt;/p&gt;
&lt;h2&gt;Setting up Chronograf&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://w2.influxdata.com/downloads/#chronograf"&gt;Download instructions&lt;/a&gt; for setting up Chronograf are straightforward. We are going to set Chronograf up on a Mac machine. Note that you can set it up on other platforms too like RedHat, Ubuntu, Debian, etc.&lt;/p&gt;

&lt;p&gt;We used Homebrew, the package manager on the Mac to install Chronograf as shown below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;span style="font-weight: 400;"&amp;gt;$ brew install homebrew/binary/chronograf&lt;/code&gt;&amp;lt;/span&amp;gt;&lt;/p&gt;

&lt;p&gt;The installation proceeds and gives you instructions to start Chronograf once the process is complete.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;==&amp;gt; Tapping homebrew/binary
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-binary'...
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 26 (delta 1), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (26/26), done.
Checking connectivity... done.
Tapped 22 formulae (71 files, 49.5K)
==&amp;gt; Installing chronograf from homebrew/binary
==&amp;gt; Downloading https://s3.amazonaws.com/get.influxdb.org/chronograf/chronograf-
######################################################################## 100.0%
==&amp;gt; Caveats
To run Chronograf manually, you can specify the configuration file on the command line:

 chronograf -config=/usr/local/etc/chronograf.toml

To have launchd start homebrew/binary/chronograf at login:

 ln -sfv /usr/local/opt/chronograf/*.plist ~/Library/LaunchAgents

Then to load homebrew/binary/chronograf now:

 launchctl load ~/Library/LaunchAgents/homebrew.mxcl.chronograf.plist

==&amp;gt; Summary
?  /usr/local/Cellar/chronograf/64: 3 files, 14.0M, built in 38 seconds

$&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Starting Chronograf&lt;/h2&gt;
&lt;p&gt;We start Chronograf next via the -config option as shown below. The chronograf.toml files points to various configuration settings and we can go ahead with the default values for now.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ chronograf -config=/usr/local/etc/chronograf.toml
[chronograf] 2016/01/12 20:17:06 Starting Chronograf (version 0.4.0)
[chronograf] 2016/01/12 20:17:06 Server binding to http://127.0.0.1:10000
[chronograf] 2016/01/12 20:17:06 Reporting anonymous usage statistics&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The next step is to launch the Chronograf Web Application. As pointed out in the console output above, the server has been launched on port 10000. Since we want to run the web application locally itself, we simply launch a browser and visit &lt;em&gt;http://localhost:10000&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;This brings up the UI as shown below and it is along expected lines i.e. we have not defined any InfluxDB Servers as of yet in the Chronograf application.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8582" src="/images/legacy-uploads/5c1.png" alt="5c1" width="940" height="387" /&gt;
Click on &lt;strong&gt;Add new server&lt;/strong&gt; to add an InfluxDB database instance. This will bring up the form as shown below and we populate the values as follows:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Nickname : You can give any name in here. We have named it &lt;em&gt;TemperatureHub&lt;/em&gt;&lt;/li&gt;
 	&lt;li&gt;Host : This is the IP Address of the Influx DB instance. Since we have hosted it on the Google Compute Engine instance, this is the Public IP Address of the Compute Engine instance, that we have been using all the while.&lt;/li&gt;
 	&lt;li&gt;Port : The Chronograf application will communicate with the InfluxDB instance via the API that is running on port 8086 of the InfluxDB instance. We had opened up the firewall on the InfluxDB Compute Engine instance to allow traffic on port 8086. We enter 8086 as the port number value here.&lt;/li&gt;
 	&lt;li&gt;Click on &lt;strong&gt;Add&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="text-align: center;"&gt;&lt;img class="aligncenter size-full wp-image-8583" src="/images/legacy-uploads/5c2.png" alt="5c2" width="936" height="811" /&gt;&lt;/p&gt;
&lt;p&gt;This will add the InfluxDB Server to Chronograf and we can click on &lt;strong&gt;Done&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8584" src="/images/legacy-uploads/5c3.png" alt="5c3" width="940" height="575" /&gt;This will then lead to a screen as shown below where you can see both Visualizations and Dashboards shown as options. Both of these tab views are empty, since we have not yet defined any of them.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8585" src="/images/legacy-uploads/5c5.png" alt="5c5" width="940" height="444" /&gt;
Think of Dashboards as a container for all your graphs. For e.g. We will define a Dashboard for e.g. that can show up the temperature readings from both Station S1 and Station S2. We will define both of the Station temperature readings as Graph and add them to the Dashboard so that we can see it together in a single dashboard.&lt;/p&gt;

&lt;p&gt;Let’s create our dashboard then.&lt;/p&gt;
&lt;h2&gt;Creating our first Dashboard&lt;/h2&gt;
&lt;p&gt;Click on the &lt;strong&gt;DASHBOARDS&lt;/strong&gt; tab option as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8586" src="/images/legacy-uploads/5c4.png" alt="5c4" width="940" height="444" /&gt;
Then click on &lt;strong&gt;+&lt;/strong&gt; sign to add a new Dashboard. This brings up the screen below and we give a name &lt;strong&gt;Temperature Hub&lt;/strong&gt; to our dashboard.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8587" src="/images/legacy-uploads/5c6.png" alt="5c6" width="938" height="455" /&gt;Click on &lt;strong&gt;Save&lt;/strong&gt; to continue. As mentioned below, a dashboard is really a container for your graphs and hence you will see a message as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8588" src="/images/legacy-uploads/5c7.png" alt="5c7" width="759" height="253" /&gt;
Click on &lt;strong&gt;Add Visualization&lt;/strong&gt; to add a graph. We want to define Graphs for visualizing the temperature sensor values from both &lt;em&gt;Station 1&lt;/em&gt; and &lt;em&gt;Station 2&lt;/em&gt;. So, let’s define the graph for &lt;em&gt;Station 1&lt;/em&gt; first as shown below. We give it a name &lt;em&gt;Station 1&lt;/em&gt; and click on &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8589" src="/images/legacy-uploads/5c8.png" alt="5c8" width="703" height="375" /&gt;
&lt;em&gt;Note: Visualizations are reusable in other Dashboards. Notice how the above screen allows us to select from Existing Visualizations too.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Things are pretty intuitive from here on. The steps are:&lt;/p&gt;

&lt;p&gt;Select the correct database (&lt;em&gt;temperature_db&lt;/em&gt;) from our InfluxDB instance.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8590" src="/images/legacy-uploads/5c9.png" alt="5c9" width="703" height="578" /&gt;
Select the measure (&lt;em&gt;temperature&lt;/em&gt;)
&lt;img class="aligncenter size-full wp-image-8591" src="/images/legacy-uploads/5c10.png" alt="5c10" width="734" height="248" /&gt;
Add filters for the Station Name (use the tag key&lt;em&gt; Station&lt;/em&gt; and value ‘&lt;em&gt;S1&lt;/em&gt;’)
&lt;img class="aligncenter size-full wp-image-8592" src="/images/legacy-uploads/5c11.png" alt="5c11" width="680" height="313" /&gt;
&lt;img class="aligncenter size-full wp-image-8593" src="/images/legacy-uploads/5c12.png" alt="5c12" width="940" height="281" /&gt;
Notice that the query that has been selected is shown for clarity below:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT value FROM temperature_db..temperature WHERE tmpltime() AND Station = 'S1'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The query is modifiable and keep that in mind, just in case you find that you do have data but it is not displaying on the graph. You can tweak this as per your requirements.&lt;/p&gt;

&lt;p&gt;We created another graph named &lt;em&gt;Station 2&lt;/em&gt; and added similar configuration values, except that the &lt;code&gt;Station = 'S2'&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Chronograf in Action&lt;/h2&gt;
&lt;p&gt;The Dashboard springs to life almost immediately as the values come in. A sample run is shown below for values being received from our 2 temperature stations : S1 and S2.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8594" src="/images/legacy-uploads/5c13.png" alt="5c13" width="941" height="383" /&gt;
And here is a zoom in for Station 2 dashboard.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8595" src="/images/legacy-uploads/5c14.png" alt="5c14" width="940" height="696" /&gt;
If I switch to the Chronograf Server console, I can see that it is pretty busy invoking the REST APIs to fetch the data.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8596" src="/images/legacy-uploads/5c15.png" alt="5c15" width="940" height="527" /&gt;&lt;/p&gt;
&lt;h2&gt;Configuring Auto Refresh and Time Filter for data&lt;/h2&gt;
&lt;p&gt;The Chronograf web application refresh interval (to update the UI) is completely configurable via the Settings as shown below. In addition, you also notice that the default filter for data was records that have been received in the last 15 minutes. That setting is configurable too and is the drop down next to Auto Refresh in the screen below.&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8597" src="/images/legacy-uploads/5c17.png" alt="5c17" width="611" height="375" /&gt;
This completes our first look at setting up Chronograf, a great module in the TICK stack to visualize your time series database.&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;In &lt;a href="https://w2.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-6/"&gt;part six&lt;/a&gt;, we will explore how to use &lt;a href="https://w2.influxdata.com/time-series-platform/kapacitor/"&gt;Kapacitor&lt;/a&gt; to setup alerts to Slack depending on certain threshold values we see in the data. Follow us on Twitter&lt;a href="https://twitter.com/InfluxDB" target="_blank" rel="noopener"&gt;@influxdb&lt;/a&gt; to catch the next blog in this series.&lt;/li&gt;
 	&lt;li&gt;Looking to level up your InfluxDB knowledge? Check out our economically priced &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener"&gt;virtual&lt;/a&gt; and &lt;a href="https://w2.influxdata.com/public-training-events/" target="_blank" rel="noopener"&gt;public trainings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Tue, 01 Mar 2016 08:00:10 -0700</pubDate>
      <link>https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-5/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-5/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Part 4: How-to Create an IoT Project with the TICK Stack on the Google Cloud Platform</title>
      <description>&lt;h2&gt;Part 4 : Integrating InfluxDB into the IoT Project&lt;/h2&gt;
&lt;p&gt;So far in the series, we have looked at what InfluxDB is, setup an InfluxDB Host on Google Compute Engine and wrote a Python application that can interact with it.&lt;/p&gt;

&lt;p&gt;This part now integrates the Python Client application code that we wrote in the previous section with an actual IoT project that uses an Arduino, a Temperature Sensor and InfluxDB as our database to store all the temperature readings that we collect.&lt;/p&gt;

&lt;p&gt;First up, let me explain what the eventual goal is and how this is a first step in that process. The goal is to set up a series of low cost climate/environment modules that capture various types of data like temperature, humidity and more. Then take all this data and put it in the cloud where we can eventually build out dashboards, alerts and more. All the good stuff in the cloud will be powered by InfluxDB.&lt;/p&gt;

&lt;p&gt;We will now explain a setup where we create a system comprising an Arduino Uno, a temperature sensor, a Python application that can read the data from the Arduino Uno (yes, I did not use an Arduino Internet Shield) and post that data to the cloud.&lt;/p&gt;
&lt;h2&gt;The Hardware Setup&lt;/h2&gt;
&lt;p&gt;I used the following:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;&lt;a href="http://arduino.cc/en/Main/arduinoBoardUno"&gt;Arduino Uno&lt;/a&gt; microcontroller&lt;/li&gt;
 	&lt;li&gt;&lt;a href="http://www.ti.com/product/lm35"&gt;LM35&lt;/a&gt; Temperature Sensor&lt;/li&gt;
 	&lt;li&gt;Eventually we will have the Raspberry Pi that interfaces with the Arduino to read and transmit off the values but to validate things for now, the Uno was powered via a laptop/desktop with Python installed on it. The communication between the Uno and the PC is via serial port communication.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Arduino Uno + Temperature Sensor Setup&lt;/h2&gt;
&lt;p&gt;Here is how the LM35 sensor is connected to the Arduino Uno board.&lt;/p&gt;
&lt;p style="text-align: center;"&gt;&lt;img class="aligncenter size-full wp-image-8574" src="/images/legacy-uploads/lm35.png" alt="lm35" width="660" height="953" /&gt;&lt;/p&gt;
&lt;p&gt;Of course, we used a breadboard to connect all this together but I am simplifying the diagram here so that you know what is connected to which pin.&lt;/p&gt;

&lt;p&gt;The LM35 has 3 pins:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;The first one goes to the 5V power pin on Arduino&lt;/li&gt;
 	&lt;li&gt;The 3rd one is the GND&lt;/li&gt;
 	&lt;li&gt;The middle pin is the VOUT where it emits out the values that we need to capture. We connect this to the Analog Pin (A0) on the Arduino. We can then write our Arduino code to read that value, as is shown next.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Arduino Code&lt;/h2&gt;
&lt;p&gt;The Arduino Code is straightforward as given below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;float temp;
int tempPin = 0;

void setup()
{
Serial.begin(9600);
}

void loop()
{
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print(temp);
Serial.println();
delay(10000);
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You will notice in the loop that every 10 seconds, we are printing out the temperature value that was read from the Analog Pin (#0).&lt;/p&gt;

&lt;p&gt;If you run the serial port monitor that comes with the Arduino IDE and if the Arduino is powered up and connected as per the diagram shown, then you will find the Temperature value being printed on the serial monitor as given below:&lt;/p&gt;

&lt;p&gt;&lt;img class="aligncenter size-full wp-image-8576" src="/images/legacy-uploads/com15.png" alt="com15" width="940" height="623" /&gt;Once this happens, we know that the Arduino setup is looking good and all we need to do now is to write a client program on the PC that interfaces with this Arduino, read the values via the Serial port and then write those values to the InfluxDB database.&lt;/p&gt;

&lt;p&gt;We can now integrate the code that we had used in the previous section to write to the InfluxDB database. The integrated code is shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;import serial
import datetime
from influxdb import InfluxDBClient

#Setup some constants with InfluxDB Host and Database name
INFLUXDB_HOST = '&amp;lt;PublicIPInfluxDBHost&amp;gt;'
INFLUXDB_NAME = 'temperature_db'

#Connect to Serial Port for communication
ser = serial.Serial('COM15', 9600, timeout=0)

#Setup a loop to send Temperature values at fixed intervals
#in seconds
fixed_interval = 10
while 1:
try:
 #temperature value obtained from Arduino + LM35 Temp Sensor
 temperature_c = ser.readline()
 #Timestamp
 timestamp = datetime.datetime.utcnow().isoformat()

 #Station Name that is recording the temperature
 station_name = "S2"

 #Initialize the InfluxDB Client
 client = InfluxDBClient(INFLUXDB_HOST,'8086','','',INFLUXDB_NAME)

 #Write a record
 json_data = [
     {
         "measurement":"temperature",
 "time":timestamp,
 "tags": {
     "Station":station_name
 },

 "fields": {
     "value":temperature_c
 }
     }
 ]

 bResult = client.write_points(json_data)
 print("Result of Write Data : ",bResult)
 time.sleep(fixed_interval)
except ser.SerialTimeoutException:
 print('Error! Could not read the Temperature Value from unit')
 time.sleep(fixed_interval)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That completes the integration. We now have an end-to-end IoT Prototype application that is able to collect a temperature reading every 10 seconds and store that in InfluxDB. This is just one weather station reading this data. We can now provision and deploy multiple such weather stations across the city. Each of the weather stations will be having this setup and code and the only change will be the &lt;code&gt;Station Name&lt;/code&gt;, which will be set to the particular &lt;code&gt;Station Name&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since we have created the &lt;code&gt;Station Name&lt;/code&gt; as the tag, our InfluxDB setup can now help us store data as well as query it for all stations, multiple stations and more.&lt;/p&gt;

&lt;p&gt;This concludes the tutorial for setting up InfluxDB and integrating it with an IoT project.&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;In &lt;a href="https://w2.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-5/"&gt;Part Five&lt;/a&gt;, we will investigate other parts of the TICK stack and see how it can further help us to collect and visualize the sensor data that we are going to be collecting. We will also see how to setup alerts depending on certain threshold values we see in the data. Follow us on Twitter &lt;a href="https://twitter.com/InfluxDB" target="_blank" rel="noopener"&gt;@influxdb&lt;/a&gt; to catch the next blog in this series.&lt;/li&gt;
 	&lt;li&gt;Looking to level up your InfluxDB knowledge? Check out our economically priced &lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener"&gt;virtual&lt;/a&gt; and &lt;a href="https://w2.influxdata.com/public-training-events/" target="_blank" rel="noopener"&gt;public trainings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Fri, 26 Feb 2016 08:00:32 -0700</pubDate>
      <link>https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-4/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-4/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
    <item>
      <title>Part 3: How-to Create an IoT Project with the TICK Stack on the Google Cloud Platform</title>
      <description>&lt;h2&gt;Part 3 : Using InfluxDB Client Libraries&lt;/h2&gt;
&lt;p&gt;InfluxDB provides support for Client Libraries in multiple programming languages. A client library goes a long way in wrapping the core HTTP API with a high level wrapper, so that you can work directly with the language and not worry about the low level mechanics of the API.&lt;/p&gt;

&lt;p&gt;Hop over to &lt;a href="https://docs.influxdata.com/influxdb/v0.10/clients/api/"&gt;HTTP API client libraries documentation&lt;/a&gt; and check out the list of programming languages that InfluxDB supports.&lt;/p&gt;

&lt;p&gt;In part 3, we are going to look at the Python client library to perform the same operations that we have been doing so far i.e. query for records and insert some records.&lt;/p&gt;

&lt;p&gt;The first step for the Python client library should be installed the InfluxDB Python library in your local setup and the documentation provides information on that. You can do that via the pip install mechanism.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ pip install influxdb&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The steps to using the Python client library is no different when it comes to conceptually thinking of what we need to do:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;Import the python library&lt;/li&gt;
 	&lt;li&gt;Establish a client connection to the InfluxDB host. In our case, this is the host running on Google Compute Engine.&lt;/li&gt;
 	&lt;li&gt;Use the client object to query for records. You can use the queries similar to the ones that we saw in the previous part.&lt;/li&gt;
 	&lt;li&gt;Use the client object to write a record or two to the InfluxDB database.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;inluxdbclient.py&lt;/code&gt; Python program is shown below:
&lt;!--more--&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;import datetime

from influxdb import InfluxDBClient

#Setup some constants with InfluxDB Host and Database name
INFLUXDB_HOST = '&amp;lt;PublicIPInfluxDBHost&amp;gt;'
INFLUXDB_NAME = 'temperature_db'

#Sample values -- these will be read from sensor
temperature_c = 27.8

#Timestamp
timestamp = datetime.datetime.utcnow().isoformat()

#Station Name that is recording the temperature
station_name = "S2"

#Initialize the InfluxDB Client
client = InfluxDBClient(INFLUXDB_HOST,'8086','','',INFLUXDB_NAME)

#Query Existing Values
result = client.query('SELECT * FROM temperature')
points = list(result.get_points(measurement='temperature'))
for point in points:
   print('Station = ',point['Station'],'Value = ',point['value'])

#Write a record
json_data = [
   {
       "measurement":"temperature",
"time":timestamp,
"tags": {
   "Station":station_name
},
"fields": {
   "value":temperature_c
}
   }
]
bResult = client.write_points(json_data)
print("Result of Write Data : ",bResult)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let us understand key points of the code listing above:&lt;/p&gt;
&lt;ul&gt;
 	&lt;li&gt;We import the InfluxDBClient class at the start of the program code.&lt;/li&gt;
 	&lt;li&gt;We define two constants, one for the InfluxDB Host, which is the Public IP of your Compute Engine instance. Remember to replace it in the code. The other one is for the database name, which is `temperature_db`.&lt;/li&gt;
 	&lt;li&gt;The next statement is important. We initialize the InfluxDBClient with the hostname, port (8086 for the API) and provide it with the database name.&lt;/li&gt;
 	&lt;li&gt;Now that we have the client object, we can then either query or insert records.&lt;/li&gt;
 	&lt;li&gt;The `query` method takes in the InfluxQL query that you want to execute against the database. This returns you a `ResultSet` object. One of the methods on the `ResultSet` object is `get_points` , which we use to get the measurement points for the `temperature` measure. We convert that into a list. We then iterate and print out the values.&lt;/li&gt;
 	&lt;li&gt;To write data to InfluxDB, we use the `write_points` method that takes in a list of measurement points that we want to write to the database. Each measurement point, and which you should be familiar with now, specifies the measure, one or more tags (&lt;em&gt;Station&lt;/em&gt;), and a value (&lt;em&gt;temperature&lt;/em&gt;). Also notice that this time we are passing in the timestamp so that we record the timestamp from the station that it was recorded at. We use the `datetime` package in python to help us get the Unix timestamp that we need to send to InfluxDB.&lt;/li&gt;
 	&lt;li&gt;The result of the `write_points` method is of boolean type. If the operation is successful, it returns back a `true`.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We can run this program via the following command and it presents the output as shown below:&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-markup"&gt;$ python influxdbclient.py
Station =  S2 Value =  27.8
Station =  S1 Value =  29.8
Station =  S1 Value =  29.9
Station =  S1 Value =  29.8
Station =  S2 Value =  29.9
Station =  S1 Value =  29.8
Station =  S1 Value =  29.85
Station =  S1 Value =  29.9
Station =  S2 Value =  27.8
Station =  S2 Value =  27.8
Station =  S2 Value =  27.8
Result of Write Data :  True&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I had run this application a few times and hence you see a lot more records in the query result. Alternately, you could use the InfluxDB web admin app to query the results too.&lt;/p&gt;

&lt;p&gt;In this post we looked at how to use the InfluxDB Python client library to insert records into the InfluxDB host that we set up in previous posts. The code in this part used a dummy value for the temperature reading but that is fine since we wanted to first setup it up and ensure that this code works.&lt;/p&gt;
&lt;h2&gt;What's next?&lt;/h2&gt;
&lt;ul&gt;
 	&lt;li&gt;This concludes part three of this tutorial. In part four, we will integrate this client code into an actual IoT sensor application that uses the Arduino and LM35 Temperature Sensor to read temperature values at regular intervals. The live temperature data will then be fed into the InfluxDB database. Follow us on Twitter &lt;a href="https://twitter.com/InfluxDB" target="_blank" rel="noopener"&gt;@influxdb&lt;/a&gt; to catch the next blog in this series.&lt;/li&gt;
 	&lt;li&gt;Looking to level up your InfluxDB knowledge? Check out our economically priced&lt;a href="https://w2.influxdata.com/virtual-training-courses/" target="_blank" rel="noopener"&gt;virtual&lt;/a&gt; and &lt;a href="https://w2.influxdata.com/public-training-events/" target="_blank" rel="noopener"&gt;public trainings&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <pubDate>Thu, 25 Feb 2016 07:00:46 -0700</pubDate>
      <link>https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-3/</link>
      <guid isPermaLink="true">https://www.influxdata.com/blog/how-to-create-iot-influxdb-google-cloud-platform-part-3/</guid>
      <category>Product</category>
      <category>Use Cases</category>
      <author>Todd Persen (InfluxData)</author>
    </item>
  </channel>
</rss>
