Error message when defining TICK script. name "value" is undefined. Names in scope:


I’m working on a tick script (batch) to get data relating to two locations but am having problems with the with the eval node.

var data = batch
SELECT last(“Success”)
FROM “ClientName”.“year”.citrixLoginSimulation
WHERE “ServerTagName” = ‘Manchester’ OR “ServerTagName” = ‘Newcastle’


  |eval(lambda: if("Success" != 0 AND "ServerTagName" == 'Newcastle' OR "ServerTagName" == 'Manchester', 'fail', 'pass'))

var alert = data
  .crit("last_attempt" == 'fail')

I’m following the documentation regarding lambda expressions but when i define the script i get the error message:
name “last_attempt” is undefined. Names in scope:

The value i need isn’t set in a variable at the top of the script, I was under the impression that the variable of ‘last_attempt’ is created when i run the evaluation node which would allow me to work with that variable. Now I’m not sure.

Influx version: v1.3.8-c1.3.8 - Enterprise.
Kapacitor: Kapacitor 1.3.3

I have other scripts that give me a value from the |eval node but they don’t contain any IF statements so I don’t know if that is the issue or not.

Can anyone spot any mistakes or offer any help on this? This option seemed easier than using subqueries but would sub queries be the best way to go?



Use it like

|eval(lambda: if(“Success” != 0 AND ( “ServerTagName” == ‘Newcastle’ OR “ServerTagName” == ‘Manchester’ ) , ‘fail’, ‘pass’ )

and pass me output of Kapacitor SHOW