Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I use Boolean type in alert rules #162

Closed
misiek303 opened this issue Feb 8, 2023 · 2 comments
Closed

How do I use Boolean type in alert rules #162

misiek303 opened this issue Feb 8, 2023 · 2 comments

Comments

@misiek303
Copy link

There is no way to set a condition that is in boolean format. Below is my use case

A: query:

  • outputs if the machine is running or not. The output is the INTEGER type as the status machine code
  • condition is using range option: VALUE > INTEGER < VALUE

B: query:

  • outputs if the machine is scheduled or not. The output is the. BOOLEAN
  • missing condition: VALUE = True

A simple transformation would work as well, but I can't find a way even using expressions.

Any ideas?

@idastambuk
Copy link
Contributor

Hi @misiek303,

Grafana alerting doesn't support booleans as alert values or transforming a boolean value to get an alert rule in Grafana.
However, there should be a way to transform boolean values on AWS SiteWise side to 1 and 0 and then make a math alert rule out of that. Can you try following the steps below and see if that does what you need it to?

  1. Click the Edit in the Asset Model configuration for your asset and scroll down to the Transform tab. This is what that looks like in the console:

Screen Shot 2023-02-21 at 3 19 46 PM

  1. Add a transform rule for one of your measurements. "if" and "eq" for strings should give you what you need, maybe another one from here too, but this is what worked for me

Screen Shot 2023-02-21 at 3 23 10 PM

  1. Once you Save and re-query the asset in Grafana panel, you should have the new field (isSW, for example) in the asset property list. It will return an array of 0s or 1s for for the time series. If you use this query as the input for your Threshold rule (or use a Math expression), you should be able to create an alert that fires when >0, or the machine is scheduled.

Screen Shot 2023-02-21 at 3 25 15 PM

Hope this helps!

@fridgepoet
Copy link
Member

Closing as this is stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants