How to use the grafana-dash-gen.configure function in grafana-dash-gen

To help you get started, we’ve selected a few grafana-dash-gen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber-node / ringpop-common / tools / grafana-dash / gen-dashboard.js View on Github external
var getConfig = require('zero-config');
var grafana = require('grafana-dash-gen');
var path = require('path');
var strformat = require('strformat');

var args = process.argv.slice(2);
var configDir = __dirname;
if(args.length > 0 && args[0].length > 0 && args[0][0]!='-') {
    // Use first positional argument as configDir
    configDir =  args[0];
}

var config = getConfig(configDir);

grafana.configure({
    cookie: config.get('grafana.cookie'),
    url: config.get('grafana.url')
});

function substituteVariables(vars) {
    // Iteratively subsitutes variables
    var doSubsitutePossible = function(vars) {
        var varsDone = {};
        var keys = Object.keys(vars);
        var allDone = true;
        for(var i = 0,length = keys.length; i < length; i++) {
            if(vars[keys[i]].indexOf('{') >= 0) {
                allDone = false;
            } else {
                varsDone[keys[i]] = vars[keys[i]];
            }

grafana-dash-gen

A grafana dashboard generator

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis