The easiest way to get a feel for what time series data can do for you is to try it. Since the TICK Stack is open source, you can freely ,download and install Telegraf, InfluxDB, Chronograf and Kapacitor. Let’s start with InfluxDB, feed some data, and build some queries.
With InfluxDB installed, it is time to interact with the database. Let’s use the command line interface (influx) to write data manually, query that data interactively, and view query output in different formats. To access the CLI, first launch the influxd database process and then launch influx in your terminal. Once you’ve connected to an InfluxDB node, you’ll see the following output:
Note that the version of InfluxDB and CLI must be identical.
Creating a Database in InfluxDB
A fresh install of InfluxDB has no databases (apart from the system _internal
). You can create a database with the CREATE DATABASE <db-name>
InfluxQL statement, where <db-name>
is the name of the database you wish to create. Let’s create a database called mydb.
To see if the database was created, use the following statement:
Now, it is time to populate the mydb database.
Writing and Querying the Database
InfluxDB is populated with points from popular clients via HTTP /write Endpoint POST or via the CLI. Datapoints can be inserted individually or in batches.
Points consist of a timestamp, a measurement (“cpu_load”, for example), at least one key-value field (the measured value itself, e.g. “value=0.64”, or “temperature=21.2”), and zero to many key-value tags containing any metadata about the value (e.g. “host=server01”, “region=EMEA”, “dc=Frankfurt”).
Conceptually, you can think of a measurement as an SQL table, where the primary index is always time. Tags and fields are effectively columns in the table. Tags are indexed, and fields are not.
Points are written to InfluxDB using line protocol:
To insert a single time series datapoint with the measurement name of cpu and tags host and region, with the measured value of 0.64 into InfluxDB using the CLI, enter INSERT followed by a point in line protocol format:
Now query for the data written:
Great! You successfully installed InfluxDB and can write and query the data.
Next step is to collect data via Telegraf and send it to InfluxDB.
Data Collection with Telegraf
Telegraf is a plugin-driven server agent for collecting and reporting metrics. Telegraf has plugins to pull metrics from third-party APIs, or to listen for metrics via StatsD and Kafka consumer services. It also has output plugins to send metrics to a variety of datastores.
Install Telegraf from InfluxData download page: https://portal.influxdata.com/downloads/
Before starting the Telegraf server, you need to edit and/or create an initial configuration that specifies your desired inputs (where the metrics come from) and outputs (where the metrics go). Telegraf can collect data from the system it is running on. That is just what is needed to start getting familiar with Telegraf.
The example below shows how to create a configuration file called telegraf.conf with two inputs:
- One input reads metrics about the system’s cpu usage (cpu).
- Another input reads metrics about the system’s memory usage (mem).
InfluxDB is defined as the desired output.
Start the Telegraf service and direct it to the relevant configuration file:
MacOS Homebrew
Linux (sysvinit and upstart Installations)
Linux (systemd Installations)
You will see the following output (Note: this output below runs on a Mac):
Once Telegraf is up and running, it will start collecting data and writing it to the desired output.
Returning to our sample configuration, we show what the cpu and mem data look like in InfluxDB below. Note that we used the default input and output configuration settings to get this data.
List all measurements in the Telegraf database:
List all field keys by measurement:
Select a sample of the data in the field usage_idle in the measurement cpu_usage_idle:
That’s it! You now have the foundation for using Telegraf to collect and write metrics to your database.
Data visualization and graphing with Chronograf
Chronograf is the administrative interface and visualization engine for the TICK Stack. It is simple to use and includes templates and libraries to allow you to build dashboards of your data and to create alerting and automation rules.
The Chronograf builds are available on InfluxData’s Downloads page.
- Choose the download link for your operating system.
Note: If your download includes a TAR package, we recommend specifying a location for the underlying datastore, chronograf-v1.db, outside of the directory from which you start Chronograf. This allows you to preserve and reference your existing datastore, including configurations and dashboards, when you download future versions.
- Install Chronograf:
- MacOS: tar zxvf chronograf-1.6.2_darwin_amd64.tar.gz
- Ubuntu & Debian: sudo dpkg -i chronograf_1.6.2_amd64.deb
- RedHat and CentOS: sudo yum localinstall > chronograf-1.6.2.x86_64.rpm
- Start Chronograf:
- MacOS: tar zxvf chronograf-1.6.2_darwin_amd64.tar.gz
- Ubuntu & Debian: sudo dpkg -i chronograf_1.6.2_amd64.deb
- Connect Chronograf to your InfluxDB instance or InfluxDB Enterprise cluster:
- Point your web browser to > localhost:8888.
- Fill out the form with the following details:
- Connection String: Enter the hostname or IP of the machine that InfluxDB is running on, and be sure to include InfluxDB’s default port 8086.
- Connection Name: Enter a name for your connection string.
- Username and Password: These fields can remain blank unless you’ve enabled authorization in InfluxDB.
- Telegraf Database Name: Optionally, enter a name for your Telegraf database. The default name is Telegraf.
- Click Add Source.
Pre-canned Dashboards
Pre-created dashboards are delivered with Chronograf, and you just have to enable the respective desired Telegraf plugins. In our example, we already enabled the cpu and mem plugins at the config file creation. Let’s take a look (Note: this example runs on a Mac):
Select the Dashboard icon in the navigation bar on the left, and then select “System”:
![Image title](/storage/temp/11275779-picture5.png)
Voilà!
![Image title](/storage/temp/11275781-picture6.png)
Taking a closer look at cpu measurement, you can see that it shows three measured fields (cpu.idle, cpu.user and cpu.system). You can filter each and move the measurement line to show exact values and timestamp.
![Image title](/storage/temp/11275784-picture7.png)
Cpu.user metric filtered:
![Image title](/storage/temp/11275785-picture8.png)
The selected "System" App option for the example is just one of many pre-created dashboards available in Chronograf. See the list below:
Now that you are set to start exploring the world of time series data, what is next? Learning from others experience is always a good idea. Get more insights from case studies in various industry segments: telecom and service providers, e-commerce, financial markets, IoT, research, manufacturing, telemetry, and of course, the horizontal case of DevOps and NetOps in any organization, and see how time series monitoring generated positive results in the organizations, from better resource management via automation and prediction to five star customer experience.