Documentation Index
Fetch the curated documentation index at: https://archive.grafana.com/llms.txt
Fetch the complete documentation index at: https://archive.grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/grafana/v9.0/dashboards/scripted-dashboards.md (append .md) or send Accept: text/markdown to /docs/grafana/v9.0/dashboards/scripted-dashboards/. For the curated documentation index, use https://archive.grafana.com/llms.txt. For the complete documentation index, use https://archive.grafana.com/llms-full.txt.
Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
Scripted dashboards
Note: Looking for prebuilt Grafana dashboards? Check out our full library of dashboards and more →
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.