-
I try to use the "statusmap" plugin by flant display data of an activity log. The example for using the plugin in mysql says: I'm new in displaying data with grafana and I'm not an expert in sql language.
I know those are a bunch of questions, but maybe anyone could help me anyway. Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
I was also trying to make it work with PostgreSQL using a similar query
but no success. Kind Regards |
Beta Was this translation helpful? Give feedback.
-
Guten Tag! The Mysql datasource has two modes: "Query builder mode" and "Raw SQL mode". The query from the README is a query built by "Query builder" and then copied from "Raw SQL mode". In "Query builder" it looks like this: I've got a table "coffee_makers". It is made for test purposes:
Purpose of these columns:
Column names are not important, you can name them as you want. As you can see in the "Query builder", you need a "Time column" (I choose "date_insert"), a Is this a good query? Honestly, no. As you can see, we show only "max" status for each interval, we've lost other statuses. Here is the most tricky part: to "extract" all statuses for a particular interval we need to define multiple queries — one query for one possible status value, similar to a Prometheus setup here: https://github.com/flant/grafana-statusmap/#panel. For example, Next, we add 4 more queries for statusi=1, statusi=2, etc. Look, we've got a bucket with two statuses: 0 and 1! Just one last thing: "discrete statuses". We consider that each status is represented by a numeric value, but numerics are for computers. Humans should see more descriptive statuses. So, go to Options->Colors and define a description and a color for each value: Thank you to follow me on this journey to a good looking and human-friendly graph: p.s. The PostgreSQL datasource should have similar macros. |
Beta Was this translation helpful? Give feedback.
-
I tried it out, but it still doesn't work. I tried to display the data via a chart and firsteval it didn't work until I averaged the data then it bizzarly worked. Any suggestions? |
Beta Was this translation helpful? Give feedback.
Guten Tag! The Mysql datasource has two modes: "Query builder mode" and "Raw SQL mode". The query from the README is a query built by "Query builder" and then copied from "Raw SQL mode".
In "Query builder" it looks like this:
I've got a table "coffee_makers". It is made for test purposes: