Scripted dashboards
Warning: This feature is deprecated and will be removed in a future release.
If you have lots of metric names that change (new servers etc) in a defined pattern it is irritating to constantly have to create new dashboards.
With scripted dashboards you can dynamically create your dashboards using javascript. In the Grafana install folder
under public/dashboards/
there is a file named scripted.js
. This file contains an example of a scripted dashboard. You can access it by using the URL:
http://grafana_url/dashboard/script/scripted.js?rows=3&name=myName
If you open scripted.js you can see how it reads URL parameters from ARGS variable and then adds rows and panels.
Example
var seriesName = 'argName';
if (!_.isUndefined(ARGS.name)) {
seriesName = ARGS.name;
}
dashboard.panels.push({
title: 'Events',
type: 'graph',
fill: 1,
linewidth: 2,
gridPos: {
h: 10,
w: 24,
x: 0,
y: 10,
},
targets: [
{
target: "randomWalk('" + seriesName + "')",
},
{
target: "randomWalk('random walk2')",
},
],
});
return dashboard;
More examples
You can find more examples in public/dashboards/
directory of your Grafana installation.
Related Grafana resources
Opening keynote: What's new in Grafana 9?
Raj Dutt, Myrle Krantz, and Torkel Ödegaard unveil what's new in Grafana 9. Watch the opening keynote presentation from GrafanaCONline 2022. On-demand.
Unify your data with Grafana plugins: Splunk, MongoDB, Datadog, and more
Show how Grafana can be used to take data from multiple different sources and unify it, without disrupting the investments that are working today.
Getting started with Grafana Enterprise and observability
Join the Grafana Labs team for a 30-minute demo of how to get started with the Grafana Stack, so you can go from zero to observability in just a few minutes.