Skip to content

Instantly share code, notes, and snippets.

@carlessanagustin
Last active December 13, 2018 12:56
Show Gist options
  • Save carlessanagustin/666dbc354bc09f4d4d31edfa6c665939 to your computer and use it in GitHub Desktop.
Save carlessanagustin/666dbc354bc09f4d4d31edfa6c665939 to your computer and use it in GitHub Desktop.
TICK Cheat Sheet (Telegraf, InfluxDB, Chronograf & Kapacitor)
#!/usr/bin/env bash
influx_show(){ docker exec $1 influx -ssl -unsafeSsl -database 'telegraf' -execute "SHOW SERIES WHERE \"host\" = '$2'" ;}
influx_drop(){ docker exec $1 influx -ssl -unsafeSsl -database 'telegraf' -execute "DROP SERIES WHERE \"host\" = '$2'" ;}
influx_restart(){ cd /opt/TICK-docker && docker-compose restart influxdb ;}
kapacitor_restart(){ cd /opt/TICK-docker && docker-compose restart kapacitor ;}

InfluxDB

Login to Influx CLI

influx -ssl -unsafeSsl
    USE telegraf

Launch Influx commands

influx -ssl -unsafeSsl \
    -database 'telegraf' \
    -execute "SHOW SERIES WHERE \"host\" = 'my_host'"

Delete host

SHOW SERIES WHERE "host" = 'my_host'
DROP SERIES WHERE "host" = 'my_host'
SHOW SERIES WHERE "host" = 'my_host'

Delete measurement in host

SHOW SERIES FROM "measurement" WHERE "host" = 'my_host'
DROP SERIES FROM "measurement" WHERE "host" = 'my_host'
SHOW SERIES WHERE "host" = 'my_host'

Show measurement

SHOW MEASUREMENTS ON telegraf

Delete measurement

DROP MEASUREMENT "measurement_name"

Kapacitor

  • List tasks:
kapacitor -skipVerify list tasks
  • Disable all tasks:
kapacitor -skipVerify disable $(kapacitor -skipVerify list tasks | awk '{if (NR!=1) {print $1}}')
  • Enable all tasks:
kapacitor -skipVerify enable $(kapacitor -skipVerify list tasks | awk '{if (NR!=1) {print $1}}')
  • Debugging:
# option 1
kapacitor -skipVerify watch <task_id>

# option 2
## @TICKscript
|httpOut('id')
## @browser
http://kapacitor-host:9092/kapacitor/v1/tasks/<task_id>/<httpOut_id>

# option 3
kapacitor -skipVerify show <task_id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment