ubuntu-18.04influxdbkapacitor

batch query is not allowed to request data from "".""


I'm getting started with Kapacitor and have been trying to run the first guide in the Kapacitor documentation, but with data I already have. I managed to define a task, but I can neither enable it nor can I run a backfill. I came across this question, which is similar to my problem, but the answer there didn't help. In contrast to the error message there I get empty strings for database, retention policy, and/or measurement.

In Kapacitor config I set an InfluxDB connection to the local host instance with the name localhost (which has a database mydb and the measurements weather.current.clouds and weather.current.visibility with default retention policy autogen) and created the following weathertest.tick script:

dbrp "mydb"."autogen"

var clouds = batch
  |query('select mean(value) / 100.0 as val from "mydb"."autogen"."weather.current.clouds"')
    .period(1h)
    .every(1h)
    .groupBy(time(1m), *)
    .fill(0)

var vis = batch
  |query('select mean(value) / 10000.0 as val from "mydb"."autogen"."weather.current.visibility"')
    .period(1h)
    .every(1h)
    .groupBy(time(1m), *)
    .fill(0)

clouds
  |join(vis)
    .as('c', 'v')
  |eval(lambda: 100 * (1 - "c.val") * "v.val")
    .as('pcent')
  |influxDBOut()
    .cluster('localhost')
    .database('mydb')
    .retentionPolicy('autogen')
    .measurement('testmetric')
    .tag('host', 'myhost.local')
    .tag('key', 'weather.current.lightidx')

This is what I came up with after hours of trial and (especially) error. As given in the title, when I try to enable my task with kapacitor enable weathertest, I get the error message enabling task weathertest: batch query is not allowed to request data from ""."". Same thing when I try to record as in the "Backfill" example. Also, in that example there is a start and a stop date for limiting the time frame. The time format given there is wrong and is not understood by Kapacitor. Instead of e. g. 2015-10-01 I have to put in 2015-10-01T00:00Z to make it at least pass the error message regarding time format error.

In the Kapacitor logs there is not a single line regarding these errors, only when I try to remove a record, I get something like remove /var/lib/kapacitor/replay/1f5...750.brpl: no such file or directory and this can be found in the logs. There are lots of info lines in the logs showing successful POSTs to/from InfluxDB for the _internal database with HTTP response result 204.

Has anyone an Idea what I may be doing wrong?


Solution

  • OK, after the weekend I tried again. Without any change it accepted my script now in the failing steps, however, now I was able to find error messages in the log. The node mentioned there was the eval node and pointed towards a type mismatch. When I changed the line

    |eval(lambda: 100 * (1 - "c.val") * "v.val")
    

    to

    |eval(lambda: 100.0 * (1.0 - "c.val") * "v.val")
    

    the error messages were gone and the command kapacitor show weathertest showed a rather sane content now.

    Furthermore, I redefined, recorded, replayed and deleted the tasks and recordings during my tests over and over again and I may have forgotten to redefine tasks after making changes to the tick script (not really sure). After changing the above, redefining the task and replaying it I finally found the expected data in the InfluxDB instance.