Was this page helpful?
Caution
You're viewing documentation for a previous version of ScyllaDB Monitoring. Switch to the latest stable version.
The following document explains how to update or create Grafana dashboards for the Scylla Monitor.
It will explain about Scylla Monitor dashboard templates and how to modify them.
Scylla Monitor uses Grafana for its dashboards. The dashboards are provisioned from files and are stored in Grafana internal storage. There are consistency issues here, between restarts and between upgrades.
By default, Grafana internal storage is inside the container. That means whenever you restart the Scylla Monitor (explicitly when restarting Grafana) any local changes will be gone. If you are doing and saving changes from the GUI make sure to configure an external directory for Grafana.
As mentioned earlier, the dashboards are provisioned from files, this means that when the files are changed, any changes stored locally will be overridden.For this reason, do not make permanent changes to a dashboard, or your changes eventually will be lost.
Note
You can save a dashboard change you made from the GUI, but it can be overridden and should be avoided.
At large, we suggest maintaining your dashboards as files, as Scylla Monitor does.
Why does Scylla Monitor use dashboard templates?
We found the Grafana dashboards Json format too verbose to be maintainable.
Each element in the dashboard file (Each Json object) contains all of its attributes and values.
For example a typical graph panel would look like:
{
"aliasColors": {},
"bars": false,
"datasource": "prometheus",
"editable": true,
"error": false,
"fill": 0,
"grid": {
"threshold1": null,
"threshold1Color": "rgba(216, 200, 27, 0.27)",
"threshold2": null,
"threshold2Color": "rgba(234, 112, 112, 0.22)"
},
"gridPos": {
"h": 6,
"w": 10,
"x": 0,
"y": 4
},
"id": 2,
"isNew": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": false,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [
{}
],
"span": 5,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum(node_filesystem_avail) by (instance)",
"intervalFactor": 1,
"legendFormat": "",
"refId": "A",
"step": 1
}
],
"timeFrom": null,
"timeShift": null,
"title": "Available Disk Size",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"transparent": false,
"type": "graph",
"xaxis": {
"show": true
},
"yaxes": [
{
"format": "percent",
"logBase": 1,
"max": 101,
"min": 0,
"show": true
},
{
"format": "short",
"logBase": 1,
"max": null,
"min": null,
"show": true
}
]
}
As you can imagine, most panels would have similar values.
To reduce the redundancy of Grafana JSON format, we added dashboard templates.
Scylla Monitor dashboard templates use class
attribute that can be added to any JSON object in a template file.
The different classes are defined in a file.
The class
system resembles CSS classes. It is hierarchical, so a class
type definition can have a class
attribute and
it would inherit that class attributes, the inherit class can add or override inherited attributes.
In the template file, you can also add or override attributes.
The Scylla Monitor generation script, uses the types.json file and a template file and creates a dashboard.
When generating dashboards, each class will be replaced by its definition.
For example row in the type.json defined
{
"base_row": {
"collapse": false,
"editable": true
},
"row": {
"class": "base_row",
"height": "250px"
}
}
In a Template it will be used like
{
"class": "row",
"height": "150px",
"panels": [
]
}
The output will be
{
"class": "row",
"collapse": false,
"editable": true,
"height": "150px",
"panels": [
]
}
We can see that the template added the panels
attribute and override the height
attribute.
Look at the following example that defines a row inside a dashboard with a graph panel for the available disk size.
{
"class": "row",
"panels": [
{
"class": "bytes_panel",
"span": 3,
"targets": [
{
"expr": "sum(node_filesystem_avail) by (instance)",
"intervalFactor": 1,
"legendFormat": "",
"metric": "",
"refId": "A",
"step": 1
}
],
"title": "Available Disk Size"
}
]
}
In the example, we used the bytes_panel class that generate a graph with bytes as units (that would mean that your Y axis unit would adjust themselves to make the graph readable (i.e. GB, MB, bytes, etc’)
You can also see that we override the span attribute to set the panel size.
To get a grasp of the difference, take a look at the Grafana panel example and see how it looks originally.
The Grafana layout used to be based on rows, where each contains multiple panels. Each row would have a total span of 12, if the total span of the panels be larger than 12, it would break the lines into multiple lines.
Starting from Grafana version 5.0 and later, rows are no longer supported, it was replaced with a layout that uses absolute positions (ie. X,Y, height, width).
The server should be backward compatible, but we’ve found it had issues with parsing it correctly. More so, absolute positions are impossible to get right when done by hand.
To overcome these issues, the dashboard generation script will generate the dashboards in the Grafana version 5.0 format. In the transition, rows will be replaced with a calculated absolute position.
Panels height will be taken from their row. The span attribute is stil supported like you expect it to work, so does row height.
you can use the gridPos attribute which is a Grafana 5.0 format, but not like Grafana, you can use partial attributes.
gridPos has the following attributes:
{
"x": 0,
"y": 0,
"w": 24,
"h": 4
}
When using Scylla’s template you don’t need to supply them all, so for example to specify that a row is 2 units height you can use:
{
"gridPos": {
"h": 2
}
}
Python 2.7
make_dashboards.py is a utility that generates dashboards from templates or help you update the template when working in reverse mode (the -r flag).
Use the -h flag to get help information.
You can use the make_dashboards.py to generate a single dashboard, but it’s usually easier to use the generate-dashboards.sh wrapper.
When you’re done changing an existing dashboard template, run the generate-dashboards.sh with the current version, this will replace your existing dashboards.
For example, if you are changing a dashboard in Scylla Enterprise version 2018.1 run:
.\generate-dashboards.sh -v 2018.1
Note
generate-dashboards.sh will update the dashboards in place, no need for a restart for the changes to take effect, just refresh the dashboard.
After making changes to a template, run the generate_generate-dashboards.sh
you should see that it run without any errors.
Refresh your browser for changes to take effect.
Make sure that your panels contain data, if not, maybe there is something wrong with your expr
attribute.
Was this page helpful?
On this page