import/export alerts
Quick question,
I'm using kapacitor version 1.2 on centos 7 (installed via the official repo). Is there a CLI option to export existing alerts into tick scripts? There doesn't seem to be a clear command to accomplish this.
Thank you!
@petercelentano There is not an easy way to do this with the CLI, but using the HTTP API would be a short script. See https://docs.influxdata.com/kapacitor/v1.2/api/api/#tasks
No worries, created and tested a script that can handle import/export functions, by either exporting all available alerts (if none are selected), exporting specified alerts, and importing specified alerts. I'll research the http api soon, but I would think that having import/export functionality in the cli would be considered a core feature, especially for backup and migration purposes.
@petercelentano The CLI does support a backup command which backs up all tasks, templates, replays, recordings etc.
kapacitor backup path/to/backup/kapacitor-$(date +%s).db
To restore simply provide the backup file to the Kapacitor process on startup. Live restores are not supported, which means it is still not quite an import/export tool but similar.
That's good to know that a backup functionality is there, but what I really needed was the ability to export or import specific alerts without taking downtime.
Starting in which version is the backup command supported? I'm running v.1.1.1, and I do not see that option listed in the help file. Also, is the kapacitor.db file an encrypted sqlite database? If so, where can I find the password to decrypt the database?
It was added in v1.3.0. The file is not encrypted and is actually a boltdb file.
Thank you, I'll look into upgrading. Thanks for the info on the DB file.
@nathanielc Hi, we are taking kapacitor backups using the API and we are able to view the kapacitor tasks using boltdbbrowser, I think the tasks are showing as binary in boltdbbrowser. But we would like to see these tasks as tick script format. Is there any option to import kapacitor tasks in boltdb as tick script format?
@petercelentano The CLI does support a
backupcommand which backs up all tasks, templates, replays, recordings etc.kapacitor backup path/to/backup/kapacitor-$(date +%s).dbTo restore simply provide the backup file to the Kapacitor process on startup. Live restores are not supported, which means it is still not quite an import/export tool but similar.
@nathanielc how to import from the .db file ?