You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
have you tried setting what you want to send as a variable? (i've noticed some weird things when using {{ something }}) var value = '{{ index .Fields "_value" }}'
and then change your exec line to: .exec('python3', 'python-file-location', '--node', "value")
(not sure if you need the quotes around value)
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.
The text was updated successfully, but these errors were encountered: