Skip to content

Instantly share code, notes, and snippets.

@perzizzle
Last active September 12, 2018 13:46
Show Gist options
  • Select an option

  • Save perzizzle/6a881edcf2300dcc1ceed098d66ef5b3 to your computer and use it in GitHub Desktop.

Select an option

Save perzizzle/6a881edcf2300dcc1ceed098d66ef5b3 to your computer and use it in GitHub Desktop.
Example template for sideloading a value for threshold
//template
var data = batch
|query(query)
.period(window)
.every(every)
.groupBy(groups)
|sideload()
.source(path)
.order(file)
.field(key, default)
data
|alert()
.warn(criteria)
.id(id)
.message(msg)
.details(details)
.exec(exe, script, event_class)
//abridged task
template-id: value_sideload
dbrps:
- db: 'telegraf'
rp: 'autogen'
vars:
query:
type: string
value: 'SELECT * FROM "telegraf"."autogen"."infra_mq_queue"'
groups:
type: list
value:
- type: string
value: 'host'
- type: string
value: 'queue_mgr'
- type: string
value: 'queues'
window:
type: duration
value: 5m
every:
type: duration
value: 1m
path:
type: string
value: 'file:/app/uid/kapacitor/sideload'
file:
type: string
value: '{{.queues}}.yml'
key:
type: string
value: 'depth_threshold'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment