Hi,
I'm creating a Canvas dashboard using data from the Heartbeat plugin, and using the opportunity to learn Canvas syntax.
I'm using an SQL query to pull the data from Heartbeat like so:
filters
| essql
query="SELECT \"@timestamp\", \"monitor.status\" FROM \"heartbeat*\" WHERE QUERY('service_name:my_service') ORDER BY \"@timestamp\" DESC LIMIT 1 "
| table
| render
This returns a table with timestamp and monitor.status as expected.
Now I want to change the text depending on the response; instead of up
I want to see Healthy
. I've seen this kind of thing done in other types of queries (mostly TimeLion) with switches, but I would also expect to be able to do something like this:
filters
| essql
query="SELECT \"@timestamp\", \"monitor.status\" FROM \"heartbeat*\" WHERE QUERY('service_name:my_service') ORDER BY \"@timestamp\" DESC LIMIT 1 "
| if {compare \"monitor.status\" to="up"} then ="healthy"
| table
| render
This breaks the visualization though. Can anyone advise or point me to examples where switches / conditionals are used with essql queries?