How to use the grafana-dash-gen.Dashboard 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
// We don't need to go deeper than 100, prevents circular substitution
    var i = 0;
    while(i < 100 && !doSubsitutePossible(vars)) {
        i++;
    }
}

var templateVariables = config.get('gen-dashboard.variable');
substituteVariables(templateVariables);

function getTarget(path) {
    return strformat(config.get('gen-dashboard.template.' + path),
                     templateVariables);
}

var dashboard = new grafana.Dashboard({
    title: config.get('gen-dashboard.dashboard-title')
});

function lineGraph(opts) {
    var graph = new grafana.Panels.Graph(opts);
    graph.state.fill = 0;

    return graph;
}

function createSystemRow() {
    var row = new grafana.Row();
    row.state.title = 'SYSTEM';
    row.state.showTitle = true;

    row.addPanel(lineGraph({
github magma / magma / nms / app / packages / magmalte / grafana / dashboards / Dashboards.js View on Github external
export function createDashboard(dbdata: GrafanaDBData) {
  const rows = dbdata.rows.map(conf => {
    const row = new Grafana.Row({title: conf.title});
    conf.panels.forEach(panel => row.addPanel(newPanel(panel)));
    return row;
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: dbdata.title,
    templating: dbdata.templates,
    description: dbdata.description,
    rows,
  });
  db.state.editable = false;

  // Necessary to make custom templates display "all" option
  for (const template of db.state?.templating?.list) {
    if (template.type === 'custom' && template.includeAll) {
      template.options.unshift({selected: true, text: 'All', value: '$__all'});
    }
    template.current = template.options[0];
  }
  return db;
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / CWFDashboards.js View on Github external
export function AccessPointDashboard() {
  const row = new Grafana.Row({title: ''});
  APNPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'CWF - Access Points',
    templating: [apnTemplate()],
    rows: [row],
    editable: false,
  });
  db.state.editable = false;
  db.state.description =
    'Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / CWFDashboards.js View on Github external
export function SubscribersDashboard() {
  const row = new Grafana.Row({title: ''});
  SubscribersPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'CWF - Subscribers',
    templating: [imsiTemplate()],
    rows: [row],
    editable: false,
  });
  db.state.editable = false;
  db.state.description =
    'Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / Dashboards.js View on Github external
export function InternalDashboard() {
  const row = new Grafana.Row({title: ''});
  InternalPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'Internal',
    templating: [networkTemplate(), gatewayTemplate()],
    rows: [row],
  });
  db.state.editable = false;
  db.state.description =
    'Metrics relevant to the internals of gateways. Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / CWFDashboards.js View on Github external
export function CWFNetworkDashboard() {
  const row = new Grafana.Row({title: ''});
  NetworkPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'CWF - Network',
    templating: [networkTemplate()],
    rows: [row],
    editable: false,
  });
  db.state.editable = false;
  db.state.description =
    'Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / Dashboards.js View on Github external
export function TemplateDashboard() {
  const row = new Grafana.Row({title: ''});
  row.addPanel(
    newPanel({
      title: 'Variable Demo',
      targets: [
        {expr: `cpu_percent{networkID=~"$networkID",gatewayID=~"$gatewayID"}`},
      ],
    }),
  );
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'Template',
    templating: [networkTemplate(), gatewayTemplate()],
    rows: [row],
  });
  db.state.editable = true;
  db.state.description =
    'Template dashboard with network and gateway variables preconfigured. Copy from this template to create a new dashboard which includes the networkID and gatewayID variables.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / Dashboards.js View on Github external
export function GatewaysDashboard() {
  const row = new Grafana.Row({title: ''});
  GatewayPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'Gateways',
    templating: [networkTemplate(), gatewayTemplate()],
    rows: [row],
    editable: false,
  });
  db.state.editable = false;
  db.state.description =
    'Metrics relevant to the gateways. Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}
github magma / magma / nms / app / fbcnms-packages / fbcnms-platform-server / grafana / dashboards / Dashboards.js View on Github external
export function NetworksDashboard() {
  const row = new Grafana.Row({title: ''});
  NetworkPanels.forEach(conf => {
    row.addPanel(newPanel(conf));
  });
  const db = new Grafana.Dashboard({
    schemaVersion: 6,
    title: 'Networks',
    templating: [networkTemplate()],
    rows: [row],
    editable: false,
  });
  db.state.editable = false;
  db.state.description =
    'Metrics relevant to the whole network. Do not edit: edits will be overwritten. Save this dashboard under another name to copy and edit.';
  return db;
}

grafana-dash-gen

A grafana dashboard generator

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis