I have a query looking for a value from mySQL. In this case It’s “Heartbeat Failure”. In my Alarm Mode Settings I have Mode: Equal but the setpoint has caused me headaches. I’ve used
{[.]ascada_host_cleanup.value} = “Heartbeat Failure”
if ({[.]ascada_host_cleanup.value} = “Heartbeat Failure”, “Failed”, “OK”)
and many others I cannot remember now. What am I doing wrong?
Just put static text into the mode’s value, you don’t need to use a binding, assuming the query tag has the alarm
The only way I’ve been able to get the alarm to be active is to set Alarm Mode Settings | Mode: Any Change. But then I cannot get it off.
yes the query tag has the alarm. The query tag gets a value of Heartbeat Failure. I still cannot get the alarm to trigger unless I use the Mode of Any Change. But then, of course, it will not go away. I have tried what you said but the alarm still doesn’t work.
If you can’t get it to recognize changes on the query tag you could try creating an expression tag of type boolean and just have a simple expression looking for the state you want to alarm on. So basically, just a string compare that gives you a boolean state. I tested this with a simple query tag and it appears to be working.
It’s easy to trigger an alarm on a boolean.
Also, I just did an upgrade from 8.0.x to 8.1.4 and a lot of my scripts that were referencing “.value” broke so it’s possible you need to take off the .value. I’ve been too busy to keep track of what all has changed but they definitely removed .value from some things.
A Bool is the only thing I’ve used so far to do the alarm and dozen of times. But this still has my butt kicked and I’m still a noob. Could you pass me the screen shots for I can understand the correct way to setup the tag and the alarm on that tag?
Sure,
This is the test I did. My query tag is just running a query that says “Select ‘Bonk’” so it’s not actually pulling data from tables. So basically, I’m using a query tag that returns a string and then using a boolean expression tag to set a flag based on the value of that string. All you’d have to do is add an alarm to the boolean expression tag and it should work for you.
oh, so 2 tags. Thanks I’ll try that.
You shouldn’t need 2 tags. What’s the data type of your query tag set to? It should be set to String if you’re returning a single column and row value (if you return multiple columns and rows then your tag will store the first column and row’s value)
Actually, it doesn’t look like you can use a string in the alarm’s Setpoint prop
If you want to alarm on string, you either have to modify your query to return a bool result, or use 2 tags as @Steve_Laubach suggested.
e.g.
SELECT CASE pname WHEN 'sqlt_data_1_2020_05' THEN 1 WHEN 'something else' THEN 1 ELSE 0 FROM sqlth_partitions