SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
Agenda: Seasoned Developers Track
WORKSHOPAGENDA
8:00 AM – 9:00 AM Breakfast
9:00 AM – 10:00 AM InfluxDB Functional Query Language (IFQL) Paul Dix
10:00 AM – 10:50 AM Writing a Telegraf Plugin Noah Crowley
10:50 AM – 11:20 AM Break
11:20 AM – 12:10 PM Using InfluxDB for Open Tracing Chris Goller
12:10 PM – 1:10 PM Lunch
1:10 PM – 2:00 PM Advanced Kapacitor Michael DeSa
2:00 PM – 2:10 PM Break
2:10 PM – 3:10 PM Setting Up InfluxData for IoT David Simmons
3:10 PM – 4:00 PM A True Story About Database Orchestration Gianluca Arbezzano
4:00 PM Pizza and Beer
Michael DeSa
Software Engineer
@mjdesa
Advanced Kapacitor
Michael DeSa is a Software Engineer at InfluxData who focuses
on increasing the performance capabilities of InfluxDB. He has
led the InfluxDB training course across the US, providing
students with an in depth understanding of how InfluxDB works
as well as sharing best practices. He has a degree in Math, with
a focus on Abstract Algebra, from the University of California, at
Berkeley and was an Instructor of the Web Development
Immersive series at General Assembly in San Francisco.
Kapacitor
© 2017 InfluxData. All rights reserved.4
Agenda
¨ What is Kapacitor
¨ Understand TICKscript
¨ Quoting rules
¨ Understand Batch vs Stream
¨ Use Kapacitor for
¨ Downsampling
¨ Alerting
¨ Creating Templated Tasks
¨ Using Topics
¨ Debugging TICKscript
¨ Examples
¨ Working with Telegraf Data
© 2017 InfluxData. All rights reserved.5
© 2017 InfluxData. All rights reserved.6
What is it?
¨ Native time-series processing engine
¨ Process stream and batch data from
InfluxDB
¨ Generates Alerts on dynamic criteria
¨ match metrics for patterns
¨ compute statistical anomalies
¨ perform specific actions
¨ Integrates with 15+ Alert Providers
¨ OpsGenie
¨ Sensu
¨ PagerDuty
¨ Slack
¨ and more.
© 2017 InfluxData. All rights reserved.7
Kapacitor Components
Server Daemon (kapacitord)
● Config for
inputs/outputs/services/ etc.
Tasks - units of work
● Defined by a TICKscript
● Stream or Batch
● DAG - pipeline
CLI (kapacitor)
● Calls for HTTP API or server
● Not interactive
Recordings - saved data
● Useful for isolated testing
Templates -
● Building many instances of a
templated task
Topics & topics handlers
● Generic rules for all alters
Defining Tasks
© 2017 InfluxData. All rights reserved.9
TICKScript
var measurement = 'requests'
var data = stream
|from()
.measurement(measurement)
|where(lambda: "is_up" == TRUE)
|where(lambda: "my_field" > 10)
|window()
.period(5m)
.every(5m)
// Count number of points in window
data
|count('value')
.as('the_count')
// Compute mean of data window
data
|mean('value')
.as('the_average')
● Chain invocation language
○ | chains together different nodes
○ . refers to specific attributes on a node
● Variables refer to values
○ Strings
○ Ints, Floats
○ Durations
○ Pipelines
© 2017 InfluxData. All rights reserved.10
TICKScript Syntax - Quoting Rules
// ' means the use the literal string value
var measurement = 'requests'
var data = stream
|from()
.measurement(measurement)
// " means use the reference value
|where(lambda: "is_up" == TRUE)
|where(lambda: "my_field" > 10)
|window()
.period(5m)
.every(5m)
// ' means the use the literal string value
data
|count('value')
.as('the_count')
● Double Quotes
○ References data in lambda expression
● Single Quotes
○ Literal String value
© 2017 InfluxData. All rights reserved.11
Create a Stream TICKscript
// cpu.tick
stream
|from()
.measurement('cpu')
|log()
● Logs all data from the measurement cpu
© 2017 InfluxData. All rights reserved.12
Create a Stream Task
$ kapacitor define cpu 
-tick cpu.tick 
dbrp “telegraf”.”autogen”
// cpu.tick
stream
|from()
.measurement('cpu')
|log()
© 2017 InfluxData. All rights reserved.13
Create a Stream Task
$ kapacitor define cpu 
-tick cpu.tick 
// cpu.tick
dbrp “telegraf”.”autogen”
dbrp “telegraf”.”not_autogen”
stream
|from()
.measurement('cpu')
.database(‘telegraf’)
.retentionPolicy(‘not_autogen’)
|log()
© 2017 InfluxData. All rights reserved.14
Show a Stream Task
$ kapacitor define cpu 
-tick cpu.tick 
-type stream 
-dbrp telegraf.autogen
$ kapacitor enable cpu
$ kapacitor show cpu
ID: cpu
Error:
Template:
Type: stream
Status: enabled
Executing: true
Created: 10 Oct 17 16:05 EDT
Modified: 10 Oct 17 16:05 EDT
LastEnabled: 01 Jan 01 00:00 UTC
Databases Retention Policies: ["telegraf"."autogen"]
TICKscript:
// cpu.tick
stream
|from()
.measurement('cpu')
|log()
DOT:
digraph cpu {
stream0 -> from1;
from1 -> log2;
}
© 2017 InfluxData. All rights reserved.15
Create a More Interesting Stream TICKscript
// cpu.tick
stream
|from()
.measurement('cpu')
|window()
.period(5m)
.every(1m)
|mean('usage_user')
.as('mean_usage_user')
|log()
● Create 5m windows of data that emit every 1m
● Compute the average of the field usage_user
● Log the result
© 2017 InfluxData. All rights reserved.16
An even more interesting TICKscript
// cpu.tick
stream
|from()
.measurement('cpu')
|where(lambda: "cpu" == 'cpu-total')
|window()
.period(5m)
.every(1m)
|mean('usage_user')
.as('mean_usage_user')
|log()
● Filter on the tag cpu=cpu-total
● Create 5m windows of data that emit every 1m
● Compute the average of the field usage_user
● Log the result
© 2017 InfluxData. All rights reserved.17
Adding Alerts
// cpu.tick
stream
|from()
.measurement('cpu')
|where(lambda: "cpu" == 'cpu-total')
|window()
.period(5m)
.every(1m)
|mean('usage_user')
.as('mean_usage_user')
|alert()
.crit(lambda: "mean_usage_user" > 80)
.message('cpu usage high!')
.slack()
.channel('alerts')
.email('oncall@example.com')
● Filter on the tag cpu=cpu-total
● Create 5m windows of data that emit every 1m
● Compute the average of the field usage_user
● Alert when mean_usage_user > 80
● Send alert to
○ Slack channel alerts
○ Email oncall@example.com
© 2017 InfluxData. All rights reserved.18
Create a Batch TICKscript
// batch_cpu.tick
batch
|query('''
SELECT mean("usage_user") AS mean_usage_user
FROM "telegraf"."autogen"."cpu"
''')
.period(5m)
.every(1m)
|log()
● Query 5m windows of data every 1m
● Compute the average of the field usage_user
● Log the result
© 2017 InfluxData. All rights reserved.19
Create a Batch Task
$ kapacitor define batch_cpu 
-tick batch_cpu.tick 
-type batch 
-dbrp telegraf.autogen
// cpu.tick
stream
|from()
.measurement('cpu')
|log()
// batch_cpu.tick
batch
|query('''
SELECT mean("usage_user") AS mean_usage_user
FROM "telegraf"."autogen"."cpu"
''')
.period(5m)
.every(1m)
|log()
© 2017 InfluxData. All rights reserved.20
Create a Batch TICKscript
// batch_cpu.tick
batch
|query('''
SELECT mean("usage_user") AS mean_usage_user
FROM "telegraf"."autogen"."cpu"
''')
.period(5m)
.every(1m)
|alert()
.crit(lambda: "mean_usage_user" > 80)
.message('cpu usage high!')
.slack()
.channel('alerts')
.email('oncall@example.com')
● Query 5m windows of data every 1m
● Compute the average of the field usage_user
● Alert when mean_usage_user > 80
● Send alert to
○ Slack channel alerts
○ Email oncall@example.com
© 2017 InfluxData. All rights reserved.21
Batching Streaming
● Queries InfluxDB periodically
● Does not buffer as much of data
in RAM
● Places additional query load on
InfluxDB
● Writes are mirrored onto the
InfluxDB instance
● Buffers all data in RAM
● Places additional write load on
Kapacitor
Using Kapacitor for
Downsampling
© 2017 InfluxData. All rights reserved.23
¨ Computing the average, max, min, etc of a window of data for a particular series
What is Downsampling?
Downsampling is the process of reducing a sequence of points in a series to a single
data point
© 2017 InfluxData. All rights reserved.24
¨ Faster queries
¨ Store less data
Why Downsample?
© 2017 InfluxData. All rights reserved.25
¨ Create a task that aggregates your data
¨ Can be stream or batch depending on your use-case
¨ Writes data back into InfluxDB
¨ Typically back into another retention policy
Downsample using Kapacitor
Offload computation to a separate host
© 2017 InfluxData. All rights reserved.26
Example
// batch_cpu.tick
batch
|query('''
SELECT mean("usage_user") AS usage_user
FROM "telegraf"."autogen"."cpu"
''')
.period(5m)
.every(5m)
|influxDBOut()
.database('telegraf')
.retenionPolicy('5m')
.tag('source', 'kapacitor')
● Downsample the data into 5m windows
● Store that data back into a the 5m retention
policy in the telegraf database
Defining Task Templates
© 2017 InfluxData. All rights reserved.28
Create a Stream Template
$ kapacitor define-template generic 
-tick generic.tick 
-type stream 
// generic.tick
var measurement string
var where_filter = lambda: TRUE
var groups = [*]
var field string
var crit lambda
var window = 5m
stream
|from()
.measurement(measurement)
.where(where_filter)
.groupBy(groups)
|window()
.period(window)
.every(window)
|mean(field)
|alert()
.crit(crit)
.slack()
.channel(slack_channel)
© 2017 InfluxData. All rights reserved.29
Create a Stream Task from a Template
$ kapacitor define generic_task 
-template generic 
-vars generic_vars.json
-dbrp telegraf.autogen// generic_vars.json
{
"measurement": {"type" : "string", "value" : "cpu" },
"where_filter": {"type": "lambda", "value": ""cpu" == 'cpu-total'"},
"groups": {"type": "list", "value": [{"type":"string", "value":"host"},{"type":"string", "value":"dc"}]},
"field": {"type" : "string", "value" : "usage_idle" },
"crit": {"type" : "lambda", "value" : ""mean" < 10.0" },
"window": {"type" : "duration", "value" : "1m" },
}
© 2017 InfluxData. All rights reserved.30
Show a Templated Task
$ kapacitor show generic_taskstream
|from()
.measurement(measurement)
.where(where_filter)
.groupBy(groups)
|window()
.period(window)
.every(window)
|mean(field)
|alert()
.warn(warn)
.crit(crit)
.slack()
.channel(slack_channel)
Vars:
Name Type Value
crit lambda "mean" < 10.0
field string usage_idle
groups list [host, dc]
measurement string cpu
warn lambda "mean" < 10.0
where_filter lambda "cpu" ==
'cpu-total'
window duration 1m0s
Kapacitor Topics
© 2017 InfluxData. All rights reserved.32
Kapacitor Topics
⠒ Specified in a Tickscript
⠒ Allows users to separate the handling of alerts from the task that
generates them
⠒ Gives users the ability to handle alerts in a more sophisticated way
⠒ Follows a publish/subscribe pattern
○ Alerts are published to a topic
○ Handlers subscribe to a topic
⠒ Handlers are scoped to a topic
© 2017 InfluxData. All rights reserved.33
Without Topics
● All alert handlers had to be
defined in tickscript
● Adding a new handler required
redefining the task
○ All current task state would be lost
● Couldn’t have cascading alerts
be triggered
● Simplistic condition matching
// example.tick
stream
|from()
.measurement('cpu')
.groupBy(*)
|alert()
.warn(lambda: "usage_idle" < 20)
.crit(lambda: "usage_idle" < 10)
.slack()
.channel('#alerts')
.slack()
.channel('#on_call')
© 2017 InfluxData. All rights reserved.34
With Topics: Creating/Using a topic
● Remove all handlers in the
tickscript
● Add a topic handler
Note: Using a topic in a tickscript
creates the topic.
// example.tick
stream
|from()
.measurement('cpu')
.groupBy(*)
|alert()
.warn(lambda: "usage_idle" < 20)
.crit(lambda: "usage_idle" < 10)
.topic('basic')
© 2017 InfluxData. All rights reserved.35
With Topics: List topics
● Shows
○ Topic Name - ID
○ Current Alert Level - Level
○ Number of Alerts Published -
Collected
$ kapacitor list topics
ID Level Collected
basic OK 245
© 2017 InfluxData. All rights reserved.36
With Topics: Show Topic
● Shows
○ Topic Name - ID
○ Current Alert Level - Level
○ Number of Alerts Published -
Collected
○ Sample of Collected Events - Events
$ kapacitor show-topic basic
ID: basic
Level: OK
Collected: 247
Handlers: []
Events:
Event Level Message Date
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:10 EDT
© 2017 InfluxData. All rights reserved.37
Creating Topic Handlers
● Defining a topic handlers
requires:
○ Topic Name
○ Handler Name
○ yaml File
● Yaml file specifies
○ Type of handler - kind
■ Typically the property method
name from tickscript (e.g.
slack, post, pagerduty, etc)
○ Required Parameters - options
■ Typically the property
methods from tickscript
// alerts.yaml
kind: slack
topic: basic
id: alerts-channel
options:
channel: "#alerts"
// on_call.yaml
kind: slack
topic: basic
id: on-call-chan
options:
channel: "#on_call"
$ kapacitor define-topic-handler alerts.yaml
$ kapacitor define-topic-handler alerts.yaml
$ kapacitor define-topic-handler on_call.yaml
© 2017 InfluxData. All rights reserved.38
With Topics: List topics handlers
● Shows
○ Topic Name - Topic
○ Handler Name - ID
○ Type of handler - Kind
$ kapacitor list topic-handlers
Topic ID Kind
basic alerts-channel slack
basic on-call-chan slack
© 2017 InfluxData. All rights reserved.39
With Topics: Show Topic Handler
● Shows
○ Handler Name - ID
○ Handler Topic - Topic
○ Type of handler - Kind
○ Matching logic for alerts - Match
○ Handler Options - Options
$ kapacitor show-topic-handler basic
alerts-channel
ID: alerts-channel
Topic: basic
Kind: slack
Match:
Options: {"channel":"#alerts"}
$ kapacitor show-topic-handler basic
on-call-chan
ID: on-call-chan
Topic: basic
Kind: slack
Match:
Options: {"channel":"#on_call"}
© 2017 InfluxData. All rights reserved.40
With Topics: Show Topic (again)
● Shows
○ Topic Name - ID
○ Current Alert Level - Level
○ Number of Alerts Published -
Collected
○ Current topic handlers - Handlers
○ Sample of Collected Events - Events
$ kapacitor show-topic basic
ID: basic
Level: OK
Collected: 285
Handlers: [alerts-channel, on-call-chan]
Events:
Event Level Message Date
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 20:55 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:05 EDT
cpu OK cpu ... 05 Jul 17 21:10 EDT
© 2017 InfluxData. All rights reserved.41
Chaining Topics using Handlers
● Topics can be chained together
using a publish action.
○ This allows you to further group your
alerts into various topics.
// chain.yaml
kind: publish
topic: basic
id: chain
options:
topics:
- ops_team
$ kapacitor define-topic-handler chain.yaml
© 2017 InfluxData. All rights reserved.42
Using Match Conditions in Handlers
● Conditions for matching a
handle may be set in the match
section of the yaml file
● Must be boolean expression
● Functions
○ Any built-in Kapacitor function
○ changed()
○ level()
○ name()
○ taskName()
○ duration()
// chain.yaml
kind: publish
topic: basic
id: chain
match: changed() == TRUE
options:
topics:
- ops_team
$ kapacitor define-topic-handler chain.yaml
© 2017 InfluxData. All rights reserved.43
With Topics: Show Topic Handler
● Shows
○ Handler Name - ID
○ Handler Topic - Topic
○ Type of handler - Kind
○ Matching logic for alerts - Match
○ Handler Options - Options
$ kapacitor show-topic-handler basic chain
ID: chain
Topic: basic
Kind: publish
Match: changed() == TRUE
Options: {"topics":["ops_team"]}
© 2017 InfluxData. All rights reserved.44
Summary
● Kapacitor users can utilize topics instead of explicitly handling alerts in
tickscript
○ Requires use of topic handlers
● Handlers are scoped to a topic
○ Typically referred to as topic handlers
● Topics may be chained together using the publish handler
● Handlers have additional matching logic to allow for more sophisticated
alert event handling
● For more information visit the documentation
http://docs.influxdata.com/kapacitor/v1.4/guides/using_alert_topics/
TICKscript Examples
© 2017 InfluxData. All rights reserved.46
¨ Join data from the same period of time, yesterday
Example
© 2017 InfluxData. All rights reserved.47
¨ Join the last hour of data with the last month of data
Example
© 2017 InfluxData. All rights reserved.48
¨ Minimize the amount of fields that the window node buffers
Example
© 2017 InfluxData. All rights reserved.49
¨ Gracefully handle data that is missing fields
Example
© 2017 InfluxData. All rights reserved.50
¨ Have an alert with an OK state that is based on the absence of data
Example
© 2017 InfluxData. All rights reserved.51
¨ Trigger an CRIT, WARN, and INFO level alert if the condition for each occurs more
than once
Example
Questions?
Thank You

Más contenido relacionado

La actualidad más candente

カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩
Masayuki Ozawa
 

La actualidad más candente (20)

Kafka Connect - debezium
Kafka Connect - debeziumKafka Connect - debezium
Kafka Connect - debezium
 
Redis
RedisRedis
Redis
 
カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩カラムストアインデックス 最初の一歩
カラムストアインデックス 最初の一歩
 
MongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTigerMongoDB World 2015 - A Technical Introduction to WiredTiger
MongoDB World 2015 - A Technical Introduction to WiredTiger
 
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
 
Json in Postgres - the Roadmap
 Json in Postgres - the Roadmap Json in Postgres - the Roadmap
Json in Postgres - the Roadmap
 
이스티오 (Istio) 자습서 v0.5.0
이스티오 (Istio) 자습서 v0.5.0이스티오 (Istio) 자습서 v0.5.0
이스티오 (Istio) 자습서 v0.5.0
 
さいきんの InnoDB Adaptive Flushing (仮)
さいきんの InnoDB Adaptive Flushing (仮)さいきんの InnoDB Adaptive Flushing (仮)
さいきんの InnoDB Adaptive Flushing (仮)
 
Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)Prometheus (Prometheus London, 2016)
Prometheus (Prometheus London, 2016)
 
InnoDB MVCC Architecture (by 권건우)
InnoDB MVCC Architecture (by 권건우)InnoDB MVCC Architecture (by 권건우)
InnoDB MVCC Architecture (by 권건우)
 
ClickHouse Mark Cache, by Mik Kocikowski, Cloudflare
ClickHouse Mark Cache, by Mik Kocikowski, CloudflareClickHouse Mark Cache, by Mik Kocikowski, Cloudflare
ClickHouse Mark Cache, by Mik Kocikowski, Cloudflare
 
Plazma - Treasure Data’s distributed analytical database -
Plazma - Treasure Data’s distributed analytical database -Plazma - Treasure Data’s distributed analytical database -
Plazma - Treasure Data’s distributed analytical database -
 
Odoo Performance Limits
Odoo Performance LimitsOdoo Performance Limits
Odoo Performance Limits
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
データベース03 - SQL(CREATE, INSERT, DELETE, UPDATEなど)
データベース03 - SQL(CREATE, INSERT, DELETE, UPDATEなど)データベース03 - SQL(CREATE, INSERT, DELETE, UPDATEなど)
データベース03 - SQL(CREATE, INSERT, DELETE, UPDATEなど)
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
A Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert HodgesA Fast Intro to Fast Query with ClickHouse, by Robert Hodges
A Fast Intro to Fast Query with ClickHouse, by Robert Hodges
 
ProxySQL at Scale on AWS.pdf
ProxySQL at Scale on AWS.pdfProxySQL at Scale on AWS.pdf
ProxySQL at Scale on AWS.pdf
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
 

Similar a Advanced kapacitor

Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Tom Diederich
 

Similar a Advanced kapacitor (20)

Virtual training Intro to Kapacitor
Virtual training  Intro to Kapacitor Virtual training  Intro to Kapacitor
Virtual training Intro to Kapacitor
 
DOWNSAMPLING DATA
DOWNSAMPLING DATADOWNSAMPLING DATA
DOWNSAMPLING DATA
 
Virtual training Intro to InfluxDB & Telegraf
Virtual training  Intro to InfluxDB & TelegrafVirtual training  Intro to InfluxDB & Telegraf
Virtual training Intro to InfluxDB & Telegraf
 
Monitoring InfluxEnterprise
Monitoring InfluxEnterpriseMonitoring InfluxEnterprise
Monitoring InfluxEnterprise
 
Lessons Learned Running InfluxDB Cloud and Other Cloud Services at Scale by T...
Lessons Learned Running InfluxDB Cloud and Other Cloud Services at Scale by T...Lessons Learned Running InfluxDB Cloud and Other Cloud Services at Scale by T...
Lessons Learned Running InfluxDB Cloud and Other Cloud Services at Scale by T...
 
Lessons Learned: Running InfluxDB Cloud and Other Cloud Services at Scale | T...
Lessons Learned: Running InfluxDB Cloud and Other Cloud Services at Scale | T...Lessons Learned: Running InfluxDB Cloud and Other Cloud Services at Scale | T...
Lessons Learned: Running InfluxDB Cloud and Other Cloud Services at Scale | T...
 
FMK2019 being an optimist in a pessimistic world by vincenzo menanno
FMK2019 being an optimist in a pessimistic world by vincenzo menannoFMK2019 being an optimist in a pessimistic world by vincenzo menanno
FMK2019 being an optimist in a pessimistic world by vincenzo menanno
 
Accelerating Spark MLlib and DataFrame with Vector Processor “SX-Aurora TSUBASA”
Accelerating Spark MLlib and DataFrame with Vector Processor “SX-Aurora TSUBASA”Accelerating Spark MLlib and DataFrame with Vector Processor “SX-Aurora TSUBASA”
Accelerating Spark MLlib and DataFrame with Vector Processor “SX-Aurora TSUBASA”
 
Setting Up a TIG Stack for Your Testing
Setting Up a TIG Stack for Your TestingSetting Up a TIG Stack for Your Testing
Setting Up a TIG Stack for Your Testing
 
IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8
 
How to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita GalkinHow to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita Galkin
 
Write your own telegraf plugin
Write your own telegraf pluginWrite your own telegraf plugin
Write your own telegraf plugin
 
Episode 3: Kubernetes and Big Data Services
Episode 3: Kubernetes and Big Data ServicesEpisode 3: Kubernetes and Big Data Services
Episode 3: Kubernetes and Big Data Services
 
Finding OOMS in Legacy Systems with the Syslog Telegraf Plugin
Finding OOMS in Legacy Systems with the Syslog Telegraf PluginFinding OOMS in Legacy Systems with the Syslog Telegraf Plugin
Finding OOMS in Legacy Systems with the Syslog Telegraf Plugin
 
Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)Ingesting streaming data for analysis in apache ignite (stream sets theme)
Ingesting streaming data for analysis in apache ignite (stream sets theme)
 
Elastic Stack @ Swisscom Application Cloud
Elastic Stack @ Swisscom Application CloudElastic Stack @ Swisscom Application Cloud
Elastic Stack @ Swisscom Application Cloud
 
iguazio - nuclio overview to CNCF (Sep 25th 2017)
iguazio - nuclio overview to CNCF (Sep 25th 2017)iguazio - nuclio overview to CNCF (Sep 25th 2017)
iguazio - nuclio overview to CNCF (Sep 25th 2017)
 
Adtech scala-performance-tuning-150323223738-conversion-gate01
Adtech scala-performance-tuning-150323223738-conversion-gate01Adtech scala-performance-tuning-150323223738-conversion-gate01
Adtech scala-performance-tuning-150323223738-conversion-gate01
 
Adtech x Scala x Performance tuning
Adtech x Scala x Performance tuningAdtech x Scala x Performance tuning
Adtech x Scala x Performance tuning
 
nuclio Overview October 2017
nuclio Overview October 2017nuclio Overview October 2017
nuclio Overview October 2017
 

Más de InfluxData

How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 

Más de InfluxData (20)

Announcing InfluxDB Clustered
Announcing InfluxDB ClusteredAnnouncing InfluxDB Clustered
Announcing InfluxDB Clustered
 
Best Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow EcosystemBest Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow Ecosystem
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
 
Build an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING StackBuild an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING Stack
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using RustMeet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using Rust
 
Introducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud DedicatedIntroducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud Dedicated
 
Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
 
Introducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage EngineIntroducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage Engine
 
Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage Engine
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDBStreamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
 

Último

Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 

Último (20)

2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 

Advanced kapacitor

  • 1. Agenda: Seasoned Developers Track WORKSHOPAGENDA 8:00 AM – 9:00 AM Breakfast 9:00 AM – 10:00 AM InfluxDB Functional Query Language (IFQL) Paul Dix 10:00 AM – 10:50 AM Writing a Telegraf Plugin Noah Crowley 10:50 AM – 11:20 AM Break 11:20 AM – 12:10 PM Using InfluxDB for Open Tracing Chris Goller 12:10 PM – 1:10 PM Lunch 1:10 PM – 2:00 PM Advanced Kapacitor Michael DeSa 2:00 PM – 2:10 PM Break 2:10 PM – 3:10 PM Setting Up InfluxData for IoT David Simmons 3:10 PM – 4:00 PM A True Story About Database Orchestration Gianluca Arbezzano 4:00 PM Pizza and Beer
  • 2. Michael DeSa Software Engineer @mjdesa Advanced Kapacitor Michael DeSa is a Software Engineer at InfluxData who focuses on increasing the performance capabilities of InfluxDB. He has led the InfluxDB training course across the US, providing students with an in depth understanding of how InfluxDB works as well as sharing best practices. He has a degree in Math, with a focus on Abstract Algebra, from the University of California, at Berkeley and was an Instructor of the Web Development Immersive series at General Assembly in San Francisco.
  • 4. © 2017 InfluxData. All rights reserved.4 Agenda ¨ What is Kapacitor ¨ Understand TICKscript ¨ Quoting rules ¨ Understand Batch vs Stream ¨ Use Kapacitor for ¨ Downsampling ¨ Alerting ¨ Creating Templated Tasks ¨ Using Topics ¨ Debugging TICKscript ¨ Examples ¨ Working with Telegraf Data
  • 5. © 2017 InfluxData. All rights reserved.5
  • 6. © 2017 InfluxData. All rights reserved.6 What is it? ¨ Native time-series processing engine ¨ Process stream and batch data from InfluxDB ¨ Generates Alerts on dynamic criteria ¨ match metrics for patterns ¨ compute statistical anomalies ¨ perform specific actions ¨ Integrates with 15+ Alert Providers ¨ OpsGenie ¨ Sensu ¨ PagerDuty ¨ Slack ¨ and more.
  • 7. © 2017 InfluxData. All rights reserved.7 Kapacitor Components Server Daemon (kapacitord) ● Config for inputs/outputs/services/ etc. Tasks - units of work ● Defined by a TICKscript ● Stream or Batch ● DAG - pipeline CLI (kapacitor) ● Calls for HTTP API or server ● Not interactive Recordings - saved data ● Useful for isolated testing Templates - ● Building many instances of a templated task Topics & topics handlers ● Generic rules for all alters
  • 9. © 2017 InfluxData. All rights reserved.9 TICKScript var measurement = 'requests' var data = stream |from() .measurement(measurement) |where(lambda: "is_up" == TRUE) |where(lambda: "my_field" > 10) |window() .period(5m) .every(5m) // Count number of points in window data |count('value') .as('the_count') // Compute mean of data window data |mean('value') .as('the_average') ● Chain invocation language ○ | chains together different nodes ○ . refers to specific attributes on a node ● Variables refer to values ○ Strings ○ Ints, Floats ○ Durations ○ Pipelines
  • 10. © 2017 InfluxData. All rights reserved.10 TICKScript Syntax - Quoting Rules // ' means the use the literal string value var measurement = 'requests' var data = stream |from() .measurement(measurement) // " means use the reference value |where(lambda: "is_up" == TRUE) |where(lambda: "my_field" > 10) |window() .period(5m) .every(5m) // ' means the use the literal string value data |count('value') .as('the_count') ● Double Quotes ○ References data in lambda expression ● Single Quotes ○ Literal String value
  • 11. © 2017 InfluxData. All rights reserved.11 Create a Stream TICKscript // cpu.tick stream |from() .measurement('cpu') |log() ● Logs all data from the measurement cpu
  • 12. © 2017 InfluxData. All rights reserved.12 Create a Stream Task $ kapacitor define cpu -tick cpu.tick dbrp “telegraf”.”autogen” // cpu.tick stream |from() .measurement('cpu') |log()
  • 13. © 2017 InfluxData. All rights reserved.13 Create a Stream Task $ kapacitor define cpu -tick cpu.tick // cpu.tick dbrp “telegraf”.”autogen” dbrp “telegraf”.”not_autogen” stream |from() .measurement('cpu') .database(‘telegraf’) .retentionPolicy(‘not_autogen’) |log()
  • 14. © 2017 InfluxData. All rights reserved.14 Show a Stream Task $ kapacitor define cpu -tick cpu.tick -type stream -dbrp telegraf.autogen $ kapacitor enable cpu $ kapacitor show cpu ID: cpu Error: Template: Type: stream Status: enabled Executing: true Created: 10 Oct 17 16:05 EDT Modified: 10 Oct 17 16:05 EDT LastEnabled: 01 Jan 01 00:00 UTC Databases Retention Policies: ["telegraf"."autogen"] TICKscript: // cpu.tick stream |from() .measurement('cpu') |log() DOT: digraph cpu { stream0 -> from1; from1 -> log2; }
  • 15. © 2017 InfluxData. All rights reserved.15 Create a More Interesting Stream TICKscript // cpu.tick stream |from() .measurement('cpu') |window() .period(5m) .every(1m) |mean('usage_user') .as('mean_usage_user') |log() ● Create 5m windows of data that emit every 1m ● Compute the average of the field usage_user ● Log the result
  • 16. © 2017 InfluxData. All rights reserved.16 An even more interesting TICKscript // cpu.tick stream |from() .measurement('cpu') |where(lambda: "cpu" == 'cpu-total') |window() .period(5m) .every(1m) |mean('usage_user') .as('mean_usage_user') |log() ● Filter on the tag cpu=cpu-total ● Create 5m windows of data that emit every 1m ● Compute the average of the field usage_user ● Log the result
  • 17. © 2017 InfluxData. All rights reserved.17 Adding Alerts // cpu.tick stream |from() .measurement('cpu') |where(lambda: "cpu" == 'cpu-total') |window() .period(5m) .every(1m) |mean('usage_user') .as('mean_usage_user') |alert() .crit(lambda: "mean_usage_user" > 80) .message('cpu usage high!') .slack() .channel('alerts') .email('oncall@example.com') ● Filter on the tag cpu=cpu-total ● Create 5m windows of data that emit every 1m ● Compute the average of the field usage_user ● Alert when mean_usage_user > 80 ● Send alert to ○ Slack channel alerts ○ Email oncall@example.com
  • 18. © 2017 InfluxData. All rights reserved.18 Create a Batch TICKscript // batch_cpu.tick batch |query(''' SELECT mean("usage_user") AS mean_usage_user FROM "telegraf"."autogen"."cpu" ''') .period(5m) .every(1m) |log() ● Query 5m windows of data every 1m ● Compute the average of the field usage_user ● Log the result
  • 19. © 2017 InfluxData. All rights reserved.19 Create a Batch Task $ kapacitor define batch_cpu -tick batch_cpu.tick -type batch -dbrp telegraf.autogen // cpu.tick stream |from() .measurement('cpu') |log() // batch_cpu.tick batch |query(''' SELECT mean("usage_user") AS mean_usage_user FROM "telegraf"."autogen"."cpu" ''') .period(5m) .every(1m) |log()
  • 20. © 2017 InfluxData. All rights reserved.20 Create a Batch TICKscript // batch_cpu.tick batch |query(''' SELECT mean("usage_user") AS mean_usage_user FROM "telegraf"."autogen"."cpu" ''') .period(5m) .every(1m) |alert() .crit(lambda: "mean_usage_user" > 80) .message('cpu usage high!') .slack() .channel('alerts') .email('oncall@example.com') ● Query 5m windows of data every 1m ● Compute the average of the field usage_user ● Alert when mean_usage_user > 80 ● Send alert to ○ Slack channel alerts ○ Email oncall@example.com
  • 21. © 2017 InfluxData. All rights reserved.21 Batching Streaming ● Queries InfluxDB periodically ● Does not buffer as much of data in RAM ● Places additional query load on InfluxDB ● Writes are mirrored onto the InfluxDB instance ● Buffers all data in RAM ● Places additional write load on Kapacitor
  • 23. © 2017 InfluxData. All rights reserved.23 ¨ Computing the average, max, min, etc of a window of data for a particular series What is Downsampling? Downsampling is the process of reducing a sequence of points in a series to a single data point
  • 24. © 2017 InfluxData. All rights reserved.24 ¨ Faster queries ¨ Store less data Why Downsample?
  • 25. © 2017 InfluxData. All rights reserved.25 ¨ Create a task that aggregates your data ¨ Can be stream or batch depending on your use-case ¨ Writes data back into InfluxDB ¨ Typically back into another retention policy Downsample using Kapacitor Offload computation to a separate host
  • 26. © 2017 InfluxData. All rights reserved.26 Example // batch_cpu.tick batch |query(''' SELECT mean("usage_user") AS usage_user FROM "telegraf"."autogen"."cpu" ''') .period(5m) .every(5m) |influxDBOut() .database('telegraf') .retenionPolicy('5m') .tag('source', 'kapacitor') ● Downsample the data into 5m windows ● Store that data back into a the 5m retention policy in the telegraf database
  • 28. © 2017 InfluxData. All rights reserved.28 Create a Stream Template $ kapacitor define-template generic -tick generic.tick -type stream // generic.tick var measurement string var where_filter = lambda: TRUE var groups = [*] var field string var crit lambda var window = 5m stream |from() .measurement(measurement) .where(where_filter) .groupBy(groups) |window() .period(window) .every(window) |mean(field) |alert() .crit(crit) .slack() .channel(slack_channel)
  • 29. © 2017 InfluxData. All rights reserved.29 Create a Stream Task from a Template $ kapacitor define generic_task -template generic -vars generic_vars.json -dbrp telegraf.autogen// generic_vars.json { "measurement": {"type" : "string", "value" : "cpu" }, "where_filter": {"type": "lambda", "value": ""cpu" == 'cpu-total'"}, "groups": {"type": "list", "value": [{"type":"string", "value":"host"},{"type":"string", "value":"dc"}]}, "field": {"type" : "string", "value" : "usage_idle" }, "crit": {"type" : "lambda", "value" : ""mean" < 10.0" }, "window": {"type" : "duration", "value" : "1m" }, }
  • 30. © 2017 InfluxData. All rights reserved.30 Show a Templated Task $ kapacitor show generic_taskstream |from() .measurement(measurement) .where(where_filter) .groupBy(groups) |window() .period(window) .every(window) |mean(field) |alert() .warn(warn) .crit(crit) .slack() .channel(slack_channel) Vars: Name Type Value crit lambda "mean" < 10.0 field string usage_idle groups list [host, dc] measurement string cpu warn lambda "mean" < 10.0 where_filter lambda "cpu" == 'cpu-total' window duration 1m0s
  • 32. © 2017 InfluxData. All rights reserved.32 Kapacitor Topics ⠒ Specified in a Tickscript ⠒ Allows users to separate the handling of alerts from the task that generates them ⠒ Gives users the ability to handle alerts in a more sophisticated way ⠒ Follows a publish/subscribe pattern ○ Alerts are published to a topic ○ Handlers subscribe to a topic ⠒ Handlers are scoped to a topic
  • 33. © 2017 InfluxData. All rights reserved.33 Without Topics ● All alert handlers had to be defined in tickscript ● Adding a new handler required redefining the task ○ All current task state would be lost ● Couldn’t have cascading alerts be triggered ● Simplistic condition matching // example.tick stream |from() .measurement('cpu') .groupBy(*) |alert() .warn(lambda: "usage_idle" < 20) .crit(lambda: "usage_idle" < 10) .slack() .channel('#alerts') .slack() .channel('#on_call')
  • 34. © 2017 InfluxData. All rights reserved.34 With Topics: Creating/Using a topic ● Remove all handlers in the tickscript ● Add a topic handler Note: Using a topic in a tickscript creates the topic. // example.tick stream |from() .measurement('cpu') .groupBy(*) |alert() .warn(lambda: "usage_idle" < 20) .crit(lambda: "usage_idle" < 10) .topic('basic')
  • 35. © 2017 InfluxData. All rights reserved.35 With Topics: List topics ● Shows ○ Topic Name - ID ○ Current Alert Level - Level ○ Number of Alerts Published - Collected $ kapacitor list topics ID Level Collected basic OK 245
  • 36. © 2017 InfluxData. All rights reserved.36 With Topics: Show Topic ● Shows ○ Topic Name - ID ○ Current Alert Level - Level ○ Number of Alerts Published - Collected ○ Sample of Collected Events - Events $ kapacitor show-topic basic ID: basic Level: OK Collected: 247 Handlers: [] Events: Event Level Message Date cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:10 EDT
  • 37. © 2017 InfluxData. All rights reserved.37 Creating Topic Handlers ● Defining a topic handlers requires: ○ Topic Name ○ Handler Name ○ yaml File ● Yaml file specifies ○ Type of handler - kind ■ Typically the property method name from tickscript (e.g. slack, post, pagerduty, etc) ○ Required Parameters - options ■ Typically the property methods from tickscript // alerts.yaml kind: slack topic: basic id: alerts-channel options: channel: "#alerts" // on_call.yaml kind: slack topic: basic id: on-call-chan options: channel: "#on_call" $ kapacitor define-topic-handler alerts.yaml $ kapacitor define-topic-handler alerts.yaml $ kapacitor define-topic-handler on_call.yaml
  • 38. © 2017 InfluxData. All rights reserved.38 With Topics: List topics handlers ● Shows ○ Topic Name - Topic ○ Handler Name - ID ○ Type of handler - Kind $ kapacitor list topic-handlers Topic ID Kind basic alerts-channel slack basic on-call-chan slack
  • 39. © 2017 InfluxData. All rights reserved.39 With Topics: Show Topic Handler ● Shows ○ Handler Name - ID ○ Handler Topic - Topic ○ Type of handler - Kind ○ Matching logic for alerts - Match ○ Handler Options - Options $ kapacitor show-topic-handler basic alerts-channel ID: alerts-channel Topic: basic Kind: slack Match: Options: {"channel":"#alerts"} $ kapacitor show-topic-handler basic on-call-chan ID: on-call-chan Topic: basic Kind: slack Match: Options: {"channel":"#on_call"}
  • 40. © 2017 InfluxData. All rights reserved.40 With Topics: Show Topic (again) ● Shows ○ Topic Name - ID ○ Current Alert Level - Level ○ Number of Alerts Published - Collected ○ Current topic handlers - Handlers ○ Sample of Collected Events - Events $ kapacitor show-topic basic ID: basic Level: OK Collected: 285 Handlers: [alerts-channel, on-call-chan] Events: Event Level Message Date cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 20:55 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:05 EDT cpu OK cpu ... 05 Jul 17 21:10 EDT
  • 41. © 2017 InfluxData. All rights reserved.41 Chaining Topics using Handlers ● Topics can be chained together using a publish action. ○ This allows you to further group your alerts into various topics. // chain.yaml kind: publish topic: basic id: chain options: topics: - ops_team $ kapacitor define-topic-handler chain.yaml
  • 42. © 2017 InfluxData. All rights reserved.42 Using Match Conditions in Handlers ● Conditions for matching a handle may be set in the match section of the yaml file ● Must be boolean expression ● Functions ○ Any built-in Kapacitor function ○ changed() ○ level() ○ name() ○ taskName() ○ duration() // chain.yaml kind: publish topic: basic id: chain match: changed() == TRUE options: topics: - ops_team $ kapacitor define-topic-handler chain.yaml
  • 43. © 2017 InfluxData. All rights reserved.43 With Topics: Show Topic Handler ● Shows ○ Handler Name - ID ○ Handler Topic - Topic ○ Type of handler - Kind ○ Matching logic for alerts - Match ○ Handler Options - Options $ kapacitor show-topic-handler basic chain ID: chain Topic: basic Kind: publish Match: changed() == TRUE Options: {"topics":["ops_team"]}
  • 44. © 2017 InfluxData. All rights reserved.44 Summary ● Kapacitor users can utilize topics instead of explicitly handling alerts in tickscript ○ Requires use of topic handlers ● Handlers are scoped to a topic ○ Typically referred to as topic handlers ● Topics may be chained together using the publish handler ● Handlers have additional matching logic to allow for more sophisticated alert event handling ● For more information visit the documentation http://docs.influxdata.com/kapacitor/v1.4/guides/using_alert_topics/
  • 46. © 2017 InfluxData. All rights reserved.46 ¨ Join data from the same period of time, yesterday Example
  • 47. © 2017 InfluxData. All rights reserved.47 ¨ Join the last hour of data with the last month of data Example
  • 48. © 2017 InfluxData. All rights reserved.48 ¨ Minimize the amount of fields that the window node buffers Example
  • 49. © 2017 InfluxData. All rights reserved.49 ¨ Gracefully handle data that is missing fields Example
  • 50. © 2017 InfluxData. All rights reserved.50 ¨ Have an alert with an OK state that is based on the absence of data Example
  • 51. © 2017 InfluxData. All rights reserved.51 ¨ Trigger an CRIT, WARN, and INFO level alert if the condition for each occurs more than once Example