Search code examples
grafana

Grafana: Status History with fixed amount of boxes


I am trying to visualize the uptime of some nodes in Grafana 9.4.3. Let's say I have 5 nodes and I want to have the uptime of those nodes in my network over time, say the last 6 hours. If in a certain time interval a node was online, show a green box, if it was offline, show a red box. A data source would provide information about whether the nodes for a time interval (e.g. 1pm - 2 pm) was available (let's simplify it here to be a "yes" or "no" answer)

I need to use "Status History", where supposedly 6 boxes are displayed per row, and in total wed have 5 rows (one for each node).

Now, when trying to build the panel, I use test data from grafana to build the dashboard before linking it up with the actual data sources. Test data (Scenario: "Grafana Live", Channel: "random-2s-stream"). What I get is the boxes, but with a flexible width as more data is generated:

enter image description here

What I want and need is that a fixed set of boxes is shown - and these boxes have a fixed width and height, always. An example is shown in the documentation for Status History: https://grafana.com/docs/grafana/v9.4/panels-visualizations/visualizations/status-history/

This is the "query":

enter image description here

Anyone can point me where this can be achieved?


Solution

  • Width and height of boxes calculated automatically based on number on samples and number of time series supplied to panel.

    The easiest way to fix the width is to specify Max data points within Query options. enter image description here

    As for height - afaik, there is now way to limit number of results of query. So you'll need to guarantee that your query returns same number of time series by yourself.