And I want to make a script that makes the same dashboard, but on an older version of Grafana I used “dashboard.rows.push” to make dashboard looks the way I wanted but with the actual Grafana’s version my script makes dashboards looking like this :
As you can see on the first screenshot my panel is on two rows, is there an equivalent of “dashboard.rows.push” working with gridPos ? Or any other way that could help me ?
A row is now a sort of panel but in your case I don’t think you need rows at all. There is a panels array now instead of a rows array.
The way to handle the x,y coordinates and the height and width is the gridPos object. The grid is 24 slots wide so setting w to 24 is full width, 12 would be half and for the height each point is 30 pixels (so 10 would be 300 pixels).
Is there any way to create Grafana dashboard as code with Python using Influxdb as datasource. Already I tried with Grafana lib but it doesn’t support influx.
I have the same issue with gridpos, in the same row we can use the span, ie:
panels: [{
title: ‘panel text 1’,
type: ‘text’,
height: ‘400px’,
span: 4,
fill: 1,
content: ‘# 1’
},{
title: ‘panel text 2’,
type: ‘text’,
height: ‘400px’,
span: 8,
fill: 1,
content: ‘# 2’
} …
I generated the json for a dashboard with 120 panels, each line should present a {Text panel}, a {singlestat panel} and {2 gauge panels}.
Text panel has width 6, height 3.
All other panels has has height 3 and width 2.
When I paste the json with the arrays generated it seems to crash, as a lot of panels get overlaid.
if I input each panel json individually they work, from the second line on it starts get messing.
But when I past all its like chaos, several panels overlayd and singlestat and gauge panels assuming position and size of the Text panels.
What should be a good practice to follow in order to prevent this from happening.
the grid position and sizes of the panels looks mathematically correct.
Is there something I can do to prevent this issue from happening?