Reputation: 113
I use Kapacitor auto load directory for delivering tick scripts to all envs https://docs.influxdata.com/kapacitor/v1.4/guides/load_directory/ one requirement: you need set "dbrp" other way you get error:
failed to create task: must specify dbrp
In the same time I want to debug/modify (see log) of this alert in Chronograf web interface (http://****:8888/sources/1/tickscript/)
but can not do it cause Error message:
cannot specify dbrp in implicitly and explicitly
as Chronograf provide one more "select database" control.
May be someone now is it possible to debug pre-load tick script in Chronograf ui?
Upvotes: 0
Views: 999
Reputation: 1
In https://docs.influxdata.com/kapacitor/v1.5/tick/syntax/#declarations
the following paragraph is instructive:
A database declaration begins with the keyword dbrp and is followed by two strings separated by a period. The first string declares the default database, with which the script will be used. The second string declares its retention policy. Note that the database and retention policy can also be declared using the flag -dbrp when defining the task with the command kapacitor define on the command-line, so this statement is optional. ...
Since it is optional in the TICKscript, then you can just set database declaration can be set from the command line when you load the script, e.g.
kapacitor define load_1 -tick ~/tick/telegraf-autogen/load_1.tick -dbrp "telegraf"."autogen"
Defined this way, the dbrp is considered implicitly set since it's not defined in the TICKscript. If you define it in the TICKscript, then it is explicitly set. This small detail unlocks this conundrum - define dbrp on the load script and not the TICKscript.
Coded this way, if you later save the TICKscript in the cronograf TICKscript editor, you won't get this error, since it's not explicitly set in the TICKscript.
Yes, you have to track two pieces of code, e.g. the TICKscript and the command line you use to load it into kapacitor. Suggestion, add a hint in the TICKscript will help reduce confusion regarding the intended dbrp. Also, group TICKscripts in subdirs by dbrp (as shown above) along with the load script in that dir, would keep things clean.
Upvotes: 0