SlideShare a Scribd company logo
Getting Started Series:
Introduction to the InfluxDB &
Telegraf
© 2017 InfluxData. All rights reserved.2
Agenda
¨ Basic Concepts
¨ What is InfluxDB
¨ What is Telegraf
¨ How do InfluxDB and Telegraf work together
¨ Usage
¨ Using InfluxDB/Telegraf with Chronograf
¨ Using InfluxDB/Telegraf without Chronograf
© 2017 InfluxData. All rights reserved.3
Architecture
Telegraf InfluxDB
Plugin-driven agent for:
¨ Collecting data
¨ Processing data
¨ Aggregating data
¨ Writing data
Time series database for:
¨ Storing data
¨ Managing data
¨ Querying data
© 2017 InfluxData. All rights reserved.4
Architecture (continued)
Telegraf InfluxDB
Collect CPU usage data
Line Protocol
Write data to
Stores the CPU usage data
Query and manage the data
Using Telegraf and InfluxDB with
Chronograf
© 2017 InfluxData. All rights reserved.6
Install & Start InfluxDB
Download* wget https://dl.influxdata.com/influxdb/releases/influxdb_1.3.2_amd64.deb
sudo dpkg -i influxdb_1.3.2_amd64.deb
sudo systemctl start influxdb
Install
Start
*Other builds available at https://portal.influxdata.com/downloads
© 2017 InfluxData. All rights reserved.7
Install & Start Telegraf
Download* wget https://dl.influxdata.com/telegraf/releases/telegraf_1.3.5-1_amd64.deb
sudo dpkg -i telegraf_1.3.5-1_amd64.deb
sudo systemctl start telegraf
Install
Start
*Other builds available at https://portal.influxdata.com/downloads
© 2017 InfluxData. All rights reserved.8
Install & Start Chronograf
Download* wget https://dl.influxdata.com/chronograf/releases/chronograf_1.3.6.1_amd64.deb
sudo dpkg -i chronograf_1.3.6.1_amd64.deb
sudo systemctl start chronograf
Install
Start
*Other builds available at https://portal.influxdata.com/downloads
© 2017 InfluxData. All rights reserved.9
Chronograf Setup
Go to http://localhost:8888
© 2017 InfluxData. All rights reserved.10
Telegraf & InfluxDB in Chronograf
© 2017 InfluxData. All rights reserved.11
Telegraf & InfluxDB in Chronograf
© 2017 InfluxData. All rights reserved.12
Telegraf & InfluxDB in Chronograf
Using InfluxDB
© 2017 InfluxData. All rights reserved.14
InfluxDB Data Model
Terminology
name: cpu
time usage_idle host
---- ---------- ----
2017-03-15T20:11T00Z 97.085 where-the-chronobirds-are
2017-03-15T20:11T00Z 99.499 where-the-chronobirds-are
2017-03-15T20:11T10Z 96.987 where-the-chronobirds-are
2017-03-15T20:11T10Z 98.500 where-the-chronobirds-are
Database
Measurement
Tag Key
Tag Value
Tag
Field Key
Field Value
Field
Timestamp Series
Point
© 2017 InfluxData. All rights reserved.15
InfluxDB Line Protocol
cpu,host=where-the-chronowilds-are usage_idle=97.085 1489613760000000000
measurement tag field timestamp
cpu,host=a,location=b usage_idle=97.085,value=2i 1489613760000000000
measurement tags fields timestamp
cpu,value=2
measurement field
© 2017 InfluxData. All rights reserved.16
InfluxDB Line Protocol
$ influx
Connected to http://localhost:8086 version 1.3.2
InfluxDB shell 1.3.2
>CREATE DATABASE test
>USE test
Using database test
>INSERT cpu,host=where-the-chronowilds-are usage_idle=97.085 1489613760000000000
>INSERT cpu,host=a,location=b usage_idle=97.085,value=21 1489613760000000000
>INSERT cpu value=2
>SELECT * FROM “cpu”
name: cpu
time host location usage_idle value
---- ---- ---- ---------- ----
1489613760000000000 where-the-chronowilds-are 97.085
1489613760000000000 a b 97.085 2
1489615178325854586 2
© 2017 InfluxData. All rights reserved.17
InfluxDB Query Language
Schema
Exploration
SHOW DATABASES
SHOW SERIES
SHOW MEASUREMENTS
SELECT field-key(s),tag-key(s) FROM measurement
SELECT function(field-key) FROM measurement
SELECT [...] WHERE [tag-conditional | field-conditional | time-conditional]
SELECT [...] GROUP BY [tag-key(s) | time-interval]
CREATE [DATABASE | RETENTION POLICY]
DROP [DATABASE | RETENTION POLICY]
DELETE
Data
Exploration
Data
Management
*Other builds available at https://portal.influxdata.com/downloads
© 2017 InfluxData. All rights reserved.18
InfluxDB Data Management
¨ Retention Policies
¨ How long InfluxDB keeps data
¨ How many copies of the data exists (clusters only)
¨ How InfluxDB handles shards
¨ Continuous Queries
¨ InfluxQL queries that run automatically and periodically on realtime data and
store query results in InfluxDB
¨ Best to use Kapacitor
Using Telegraf
© 2017 InfluxData. All rights reserved.20
Telegraf Input Plugins 100+
Input plugins collect metrics from the system, services, or third-party APIs
Some of the available input plugins
● System
● StatsD
● Exec
● Socket Listener
● Procstat
● PostgreSQL
● Kubernetes
● MySQL
● MQTT
Some of the available output plugins
● InfluxDB
● AWS CloudWatch
● Graphite
© 2017 InfluxData. All rights reserved.21
Telegraf Configuration File
(https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md_
[[outputs.influxdb]]
urls = [ "http://localhost:8086" ]
database = "telegraf"
precision = "s"
# Drop all measurements that start with
"aerospike"
namedrop = ["aerospike*"]
[[outputs.influxdb]]
urls = [ "http://localhost:8086" ]
database = "telegraf-aerospike-data"
precision = "s"
# Only accept aerospike data:
namepass = ["aerospike*"]
[[outputs.influxdb]]
urls = [ "http://localhost:8086" ]
database = "telegraf-cpu0-data"
precision = "s"
# Only store measurements where the tag "cpu"
matches the value "cpu0"
[outputs.influxdb.tagpass]
cpu = ["cpu0"]
[global_tags]
dc = "denver-1"
[agent]
interval = "10s"
# OUTPUTS
[[outputs.influxdb]]
url = "http://192.168.59.103:8086" # required.
database = "telegraf" # required.
precision = "s"
# INPUTS
[[inputs.cpu]]
percpu = true
totalcpu = false
# filter all fields beginning with 'time_'
fielddrop = ["time_*"]
© 2017 InfluxData. All rights reserved.22
What’s Next
¨ Documentation
¨ https://docs.influxdata.com/
¨ Videos
¨ https://www.influxdata.com/university/
¨ On the Web
¨ https://community.influxdata.com
¨ On GitHub
¨ https://github.com/influxdata
¨ On Slack
¨ https://gophersinvite.herokuapp.com/
¨ #influxdb
¨ On Twitter:
¨ @influxDB
¨
Questions?
Thank you

More Related Content

Virtual training Intro to InfluxDB & Telegraf

  • 1. Getting Started Series: Introduction to the InfluxDB & Telegraf
  • 2. © 2017 InfluxData. All rights reserved.2 Agenda ¨ Basic Concepts ¨ What is InfluxDB ¨ What is Telegraf ¨ How do InfluxDB and Telegraf work together ¨ Usage ¨ Using InfluxDB/Telegraf with Chronograf ¨ Using InfluxDB/Telegraf without Chronograf
  • 3. © 2017 InfluxData. All rights reserved.3 Architecture Telegraf InfluxDB Plugin-driven agent for: ¨ Collecting data ¨ Processing data ¨ Aggregating data ¨ Writing data Time series database for: ¨ Storing data ¨ Managing data ¨ Querying data
  • 4. © 2017 InfluxData. All rights reserved.4 Architecture (continued) Telegraf InfluxDB Collect CPU usage data Line Protocol Write data to Stores the CPU usage data Query and manage the data
  • 5. Using Telegraf and InfluxDB with Chronograf
  • 6. © 2017 InfluxData. All rights reserved.6 Install & Start InfluxDB Download* wget https://dl.influxdata.com/influxdb/releases/influxdb_1.3.2_amd64.deb sudo dpkg -i influxdb_1.3.2_amd64.deb sudo systemctl start influxdb Install Start *Other builds available at https://portal.influxdata.com/downloads
  • 7. © 2017 InfluxData. All rights reserved.7 Install & Start Telegraf Download* wget https://dl.influxdata.com/telegraf/releases/telegraf_1.3.5-1_amd64.deb sudo dpkg -i telegraf_1.3.5-1_amd64.deb sudo systemctl start telegraf Install Start *Other builds available at https://portal.influxdata.com/downloads
  • 8. © 2017 InfluxData. All rights reserved.8 Install & Start Chronograf Download* wget https://dl.influxdata.com/chronograf/releases/chronograf_1.3.6.1_amd64.deb sudo dpkg -i chronograf_1.3.6.1_amd64.deb sudo systemctl start chronograf Install Start *Other builds available at https://portal.influxdata.com/downloads
  • 9. © 2017 InfluxData. All rights reserved.9 Chronograf Setup Go to http://localhost:8888
  • 10. © 2017 InfluxData. All rights reserved.10 Telegraf & InfluxDB in Chronograf
  • 11. © 2017 InfluxData. All rights reserved.11 Telegraf & InfluxDB in Chronograf
  • 12. © 2017 InfluxData. All rights reserved.12 Telegraf & InfluxDB in Chronograf
  • 14. © 2017 InfluxData. All rights reserved.14 InfluxDB Data Model Terminology name: cpu time usage_idle host ---- ---------- ---- 2017-03-15T20:11T00Z 97.085 where-the-chronobirds-are 2017-03-15T20:11T00Z 99.499 where-the-chronobirds-are 2017-03-15T20:11T10Z 96.987 where-the-chronobirds-are 2017-03-15T20:11T10Z 98.500 where-the-chronobirds-are Database Measurement Tag Key Tag Value Tag Field Key Field Value Field Timestamp Series Point
  • 15. © 2017 InfluxData. All rights reserved.15 InfluxDB Line Protocol cpu,host=where-the-chronowilds-are usage_idle=97.085 1489613760000000000 measurement tag field timestamp cpu,host=a,location=b usage_idle=97.085,value=2i 1489613760000000000 measurement tags fields timestamp cpu,value=2 measurement field
  • 16. © 2017 InfluxData. All rights reserved.16 InfluxDB Line Protocol $ influx Connected to http://localhost:8086 version 1.3.2 InfluxDB shell 1.3.2 >CREATE DATABASE test >USE test Using database test >INSERT cpu,host=where-the-chronowilds-are usage_idle=97.085 1489613760000000000 >INSERT cpu,host=a,location=b usage_idle=97.085,value=21 1489613760000000000 >INSERT cpu value=2 >SELECT * FROM “cpu” name: cpu time host location usage_idle value ---- ---- ---- ---------- ---- 1489613760000000000 where-the-chronowilds-are 97.085 1489613760000000000 a b 97.085 2 1489615178325854586 2
  • 17. © 2017 InfluxData. All rights reserved.17 InfluxDB Query Language Schema Exploration SHOW DATABASES SHOW SERIES SHOW MEASUREMENTS SELECT field-key(s),tag-key(s) FROM measurement SELECT function(field-key) FROM measurement SELECT [...] WHERE [tag-conditional | field-conditional | time-conditional] SELECT [...] GROUP BY [tag-key(s) | time-interval] CREATE [DATABASE | RETENTION POLICY] DROP [DATABASE | RETENTION POLICY] DELETE Data Exploration Data Management *Other builds available at https://portal.influxdata.com/downloads
  • 18. © 2017 InfluxData. All rights reserved.18 InfluxDB Data Management ¨ Retention Policies ¨ How long InfluxDB keeps data ¨ How many copies of the data exists (clusters only) ¨ How InfluxDB handles shards ¨ Continuous Queries ¨ InfluxQL queries that run automatically and periodically on realtime data and store query results in InfluxDB ¨ Best to use Kapacitor
  • 20. © 2017 InfluxData. All rights reserved.20 Telegraf Input Plugins 100+ Input plugins collect metrics from the system, services, or third-party APIs Some of the available input plugins ● System ● StatsD ● Exec ● Socket Listener ● Procstat ● PostgreSQL ● Kubernetes ● MySQL ● MQTT Some of the available output plugins ● InfluxDB ● AWS CloudWatch ● Graphite
  • 21. © 2017 InfluxData. All rights reserved.21 Telegraf Configuration File (https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md_ [[outputs.influxdb]] urls = [ "http://localhost:8086" ] database = "telegraf" precision = "s" # Drop all measurements that start with "aerospike" namedrop = ["aerospike*"] [[outputs.influxdb]] urls = [ "http://localhost:8086" ] database = "telegraf-aerospike-data" precision = "s" # Only accept aerospike data: namepass = ["aerospike*"] [[outputs.influxdb]] urls = [ "http://localhost:8086" ] database = "telegraf-cpu0-data" precision = "s" # Only store measurements where the tag "cpu" matches the value "cpu0" [outputs.influxdb.tagpass] cpu = ["cpu0"] [global_tags] dc = "denver-1" [agent] interval = "10s" # OUTPUTS [[outputs.influxdb]] url = "http://192.168.59.103:8086" # required. database = "telegraf" # required. precision = "s" # INPUTS [[inputs.cpu]] percpu = true totalcpu = false # filter all fields beginning with 'time_' fielddrop = ["time_*"]
  • 22. © 2017 InfluxData. All rights reserved.22 What’s Next ¨ Documentation ¨ https://docs.influxdata.com/ ¨ Videos ¨ https://www.influxdata.com/university/ ¨ On the Web ¨ https://community.influxdata.com ¨ On GitHub ¨ https://github.com/influxdata ¨ On Slack ¨ https://gophersinvite.herokuapp.com/ ¨ #influxdb ¨ On Twitter: ¨ @influxDB ¨