kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

import/export alerts

Open petercelentano opened this issue 9 years ago • 8 comments

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 avatar May 01 '17 13:05 petercelentano

@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

nathanielc avatar May 01 '17 15:05 nathanielc

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 avatar May 26 '17 18:05 petercelentano

@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.

nathanielc avatar May 26 '17 20:05 nathanielc

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?

petercelentano avatar May 26 '17 21:05 petercelentano

It was added in v1.3.0. The file is not encrypted and is actually a boltdb file.

nathanielc avatar May 26 '17 21:05 nathanielc

Thank you, I'll look into upgrading. Thanks for the info on the DB file.

petercelentano avatar May 26 '17 21:05 petercelentano

@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?

ajayanaj avatar Nov 27 '18 07:11 ajayanaj

@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.

@nathanielc how to import from the .db file ?

whoAbhishekSah avatar Jul 03 '20 06:07 whoAbhishekSah