blob: 7c57924b93d73ded630b9df644c09d0b83ef8508 [file] [log] [blame]
koder aka kdanilovdda86d32015-03-16 11:20:04 +02001/* global _ */
2
3/*
4 * Complex scripted dashboard
5 * This script generates a dashboard object that Grafana can load. It also takes a number of user
6 * supplied URL parameters (int ARGS variable)
7 *
8 * Return a dashboard object, or a function
9 *
10 * For async scripts, return a function, this function must take a single callback function as argument,
11 * call this callback function with the dashboard object (look at scripted_async.js for an example)
12 */
13
14
15
16// accessable variables in this scope
17var window, document, ARGS, $, jQuery, moment, kbn;
18
19// Setup some variables
20var dashboard;
21
22// All url parameters are available via the ARGS object
23var ARGS;
24
25// Intialize a skeleton with nothing but a rows array and service object
koder aka kdanilova639e0a2015-03-17 15:30:36 +020026dashboard = {rows : []};
koder aka kdanilovdda86d32015-03-16 11:20:04 +020027
28// Set a title
29dashboard.title = 'Tests dash';
30
31// Set default time
32// time can be overriden in the url using from/to parameteres, but this is
33// handled automatically in grafana core during dashboard initialization
34dashboard.time = {
koder aka kdanilova639e0a2015-03-17 15:30:36 +020035 from: "now-5m",
36 to: "now"
koder aka kdanilovdda86d32015-03-16 11:20:04 +020037};
38
koder aka kdanilova639e0a2015-03-17 15:30:36 +020039dashboard.rows.push({
koder aka kdanilovdda86d32015-03-16 11:20:04 +020040 title: 'Chart',
41 height: '300px',
koder aka kdanilova639e0a2015-03-17 15:30:36 +020042 panels: %s
43});
koder aka kdanilovdda86d32015-03-16 11:20:04 +020044
45
46return dashboard;