carlessanagustin
6/27/2018 - 1:56 PM

InfluxDB Cheat Sheet

TICK Cheat Sheet (Telegraf, InfluxDB, Chronograf & 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>
#!/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 ;}