Unfortunately there is not. A possible workaround would be to use tasks templates https://docs.influxdata.com/kapacitor/v1.0/examples/template_tasks/ and have one task per db, not sure if that is reasonable in your case or not. Then you could pass the database name down as a argument to the script based on the database var:
var db string stream |from() .database(db) .measurement('a') |where(lambda: "val"=="1") |alert() .crit(lambda:TRUE) .exec('/usr/bin/python','sample.py', db) On Thursday, October 20, 2016 at 6:00:04 AM UTC-6, mohamad...@gmail.com wrote: > > On Wednesday, October 19, 2016 at 11:45:21 PM UTC-4, mohamad...@gmail.com > wrote: > > Hello everyone, > > > > I have a question concerning specifying the db name in the Kapacitor > exec node. > > I have a tick script which calls a python script using the .exec node. > > The tick script looks like this: > > > > stream > > |from() > > .measurement('a') > > |where(lambda: "val"=="1") > > |alert() > > .crit(lambda:TRUE) > > .exec('/usr/bin/python','sample.py') > > > > This code works on multiple databases that contain the measurement 'a'. > > In sample.py, I am reading the stdin and getting the data passed from > the tick script as a JSON object. > > However, the JSON object doesn't contain the database name. In other > word, in sample.py, I can't know if the data came from db1 or db2. > > > > Is there a way for sample.py to know from which database the streamed > data originated? > > Is there a way to pass the database name as an argument like: > > .exec('/usr/bin/python','sample.py','<database name variable>')? > > > > Thank you for you help > > I forgot to mention that I am using InfluxDB v1.0.2 and Kapacitor v1. > > Thank you > > -- Remember to include the version number! --- You received this message because you are subscribed to the Google Groups "InfluxData" group. To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+unsubscr...@googlegroups.com. To post to this group, send email to influxdb@googlegroups.com. Visit this group at https://groups.google.com/group/influxdb. To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/b3ca83c6-94d9-488d-851e-0f397d202955%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.