Hi, I am using Tickscript and my purpose is to run the python script if the value is 0. Below is my code:
var data = batch
|queryFlux('''
from(bucket: "bucket_name")
|> range(start: -3h)
|> filter(fn: (r) => r["_measurement"] == "measurement_name")
|> filter(fn: (r) => r["_field"] == "field_name")
|> filter(fn: (r) => r["_value"] > 0)
|> truncateTimeColumn(unit: 1h)
''')
.org('org_name')
.period(190m)
.every(30m)
var alert = data
|alert()
.crit(lambda: "_value" > 0)
.exec('python3', 'python-file-location', '--node', '{{ index .Fields "_value" }}')
I was trying to use template and pass a random parameter, However I am getting “{{ index .Fields “_value” }}” in python file instead of some actual string. My requirement is to pass value of tag column say “A” as an argument to python file. How can I get that value.