anryko / grafana-influx-dashboard

Grafana InfluxDB scripted dashboard
MIT License
132 stars 44 forks source link

Two plugins for one measurement #37

Closed nordewal closed 8 years ago

nordewal commented 8 years ago

Hi I just started using this great grafana dashboard generator. I am wondering if there is a possibility to create two getdash plugins for the same collectd plugin, ie:

plugins.disk = new Plugin();
  //plugins.disk.config.multi = true;

  plugins.disk.diskOps = {
    'graph': {
      'read': {
//        'color': '#447EBC',
        'apply': 'derivative',
        'type': 'disk_ops'
      },
      'write': {
//        'color': '#508642',
        'math': '* -1',
        'apply': 'derivative',
        'type': 'disk_ops'
      }
    },
    'panel': {
      'title': 'Disk Operations', // for @metric',
      'grid': { 'max': null, 'min': null, 'leftMin': null },
      'y_formats': [ 'iops' ]
    }
  };

and

plugins.diskdetailed = new Plugin();
  plugins.diskdetailed.config.multi = true;

  plugins.diskdetailed.diskOps = {
    'graph': {
      'read': {
        'color': '#447EBC',
        'apply': 'derivative',
        'type': 'disk_ops'
      },
      'write': {
        'color': '#508642',
        'math': '* -1',
        'apply': 'derivative',
        'type': 'disk_ops'
      }
    },
    'panel': {
      'title': 'Disk Operations for @metric',
      'grid': { 'max': null, 'min': null, 'leftMin': null },
      'y_formats': [ 'iops' ]
    }
  };

Thanks

anryko commented 8 years ago

Hey nordewal, Sure this should be possible. However you need plugin name to match actual metrics beginning part. So in your case something like this should work:

plugins.disk_ = new Plugin();

  plugins.disk_.diskOps = {
    'graph': {
      'read': {
        'apply': 'derivative',
        'type': 'disk_ops'
      },
      'write': {
        'math': '* -1',
        'apply': 'derivative',
        'type': 'disk_ops'
      }
    },
    'panel': {
      'title': 'Disk Operations',
      'grid': { 'max': null, 'min': null, 'leftMin': null },
      'y_formats': [ 'iops' ]
    }
  };

plugins.disk = new Plugin();
  plugins.disk.config.multi = true;

  plugins.disk.diskOps = {
    'graph': {
      'read': {
        'color': '#447EBC',
        'apply': 'derivative',
        'type': 'disk_ops'
      },
      'write': {
        'color': '#508642',
        'math': '* -1',
        'apply': 'derivative',
        'type': 'disk_ops'
      }
    },
    'panel': {
      'title': 'Disk Operations for @metric',
      'grid': { 'max': null, 'min': null, 'leftMin': null },
      'y_formats': [ 'iops' ]
    }
  };
nordewal commented 8 years ago

Thanks, that works. When trying to add only one definition to a group, either both plugin definitions are loaded or none. How is this supposed to work?

anryko commented 8 years ago

Hmm, this is strange. I just tested it and it works as expected for me.

Here is what I'm doing: I added new groups for the test

  plugins.groups.net = [
    'interface',
    'interface_'
  ];
  plugins.groups.net1 = [
    'interface'
  ];
  plugins.groups.net2 = [
    'interface_'
  ];

and all 3 work as expected. I used interface plugin for my test, but yours should work the same way with 'disk' and 'disk_'.

Please let me know if this helps. Otherwise plz post here or gist relevant parts of your config so I would be able to reproduce the issue.

anryko commented 8 years ago

Hey nordewal, Have you figured out your getdash plugin group issue? Can we close this?

nordewal commented 8 years ago

Hey anryko, it works thanks :-)