# InfluxDB
## Login to Influx CLI
```shell
influx -ssl -unsafeSsl
USE telegraf
```
## Launch Influx commands
```shell
influx -ssl -unsafeSsl \
-database 'telegraf' \
-execute "SHOW SERIES WHERE \"host\" = 'my_host'"
```
## Delete host
```sql
SHOW SERIES WHERE "host" = 'my_host'
DROP SERIES WHERE "host" = 'my_host'
SHOW SERIES WHERE "host" = 'my_host'
```
## Delete measurement in host
```sql
SHOW SERIES FROM "measurement" WHERE "host" = 'my_host'
DROP SERIES FROM "measurement" WHERE "host" = 'my_host'
SHOW SERIES WHERE "host" = 'my_host'
```
## Show measurement
```sql
SHOW MEASUREMENTS ON telegraf
```
## Delete measurement
```sql
DROP MEASUREMENT "measurement_name"
```
# Kapacitor
* List tasks:
```shell
kapacitor -skipVerify list tasks
```
* Disable all tasks:
```shell
kapacitor -skipVerify disable $(kapacitor -skipVerify list tasks | awk '{if (NR!=1) {print $1}}')
```
* Enable all tasks:
```shell
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 ;}