anryko / grafana-influx-dashboard

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

collectd:interface module does not work with this scripted dashboard. #36

Closed mikaelkall closed 8 years ago

mikaelkall commented 8 years ago

Have issue with get the collectd interface module work with the influx dashboard.

https://collectd.org/wiki/index.php/Plugin:Interface

I think the issue may be that interface is a reserved keyword? If this is easy to fix i would gladly see it fixed. Will try my best to figure out this myself and create a pull request.

anryko commented 8 years ago

Hi Mike, This plugin works OK for me with the default configuration. I'm testing with Grafana 2.6.0 and InfluxDB v0.9.6.1.

Could you check if series are present in InfluxDB?

$ curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode "db=collectd" --data-urlencode "q=SHOW SERIES WHERE host = 'vagrant-ubuntu-trusty-64';" | grep interface
                    "name": "interface_rx",
                            "interface_rx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_errors",
                            "interface_rx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_octets",
                            "interface_rx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_packets",
                    "name": "interface_tx",
                            "interface_tx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_errors",
                            "interface_tx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_octets",
                            "interface_tx,host=vagrant-ubuntu-trusty-64,instance=eth0,type=if_packets",

Also it would be interesting to see the query generated by Grafana in your case. To get it you should press on the graph title and select "Edit", then switch editor mode for the raw query. In my case it looks like this:

SELECT derivative(mean("value"), 1s) * -1 FROM "interface_rx" WHERE "host" = 'vagrant-ubuntu-trusty-64' AND "instance" = 'eth0' AND "type" = 'if_octets' AND $timeFilter GROUP BY time($interval)
mikaelkall commented 8 years ago

Hi thanks for you took the time to answer and for a great application. Here are some debug data.

curl -sG 'http://localhost:8086/query?pretty=true' --data-urlencode "db=collectd" --data-urlencode "q=SHOW SERIES WHERE host = 'example.com';" | grep interface "name": "interface_", "interface_,host=example.com,instance=bond0,type=if_packets", "interface_,host=example.com,instance=bond0,type=if_errors", "interface_,host=example.com,instance=bond0,type=if_octets",

The query is not generated at all by Grafana. The other modules cpu memory df and load is rendered successful. They all worked right out of the box by just by adding the module in collectd. I have looked in "getdash.conf.js" and the interface definition is there.

My influxdb version.

curl -sl -I localhost:8086/ping |grep "X-Influxdb-Version" X-Influxdb-Version: 0.9 And grafana. ./grafana -v Version 2.6.0 (commit: v2.6.0)

My setup is that I have ported grafana and influxdb to be OMD compliant ( http://omdistro.org/ ) So maybe my issue is related to that? Will boot a default installation of influx and grafana and investigate if the issue persist. Thanks for your help and patience.

mikaelkall commented 8 years ago

Just noticed my name of the metric is a bit different from yours. Will investigate if that could be the issue.

mikaelkall commented 8 years ago

Great thanks that was the problem!

Solution for me was to change

` // collectd interface plugin configuration plugins.interface = new Plugin(); plugins.interface.config.multi = true;

plugins.interface.traffic = { 'graph': { 'rx': { 'color': '#447EBC', 'alias': 'octets-rx', 'apply': 'derivative', 'math': '* -1', 'type': 'if_octets' }, 'tx': { 'color': '#508642', 'alias': 'octets-tx', 'apply': 'derivative', 'type': 'if_octets' } }, 'panel': { 'title': 'Network Traffic on @metric', 'y_formats': [ 'Bps' ], 'grid': { 'max': null, 'min': null, 'leftMin': null } } };

plugins.interface.packets = { 'graph': { 'rx': { 'color': '#447EBC', 'alias': 'packets-rx', 'apply': 'derivative', 'math': '* -1', 'type': 'if_packets' }, 'tx': { 'color': '#508642', 'alias': 'packets-tx', 'apply': 'derivative', 'type': 'if_packets' } }, 'panel': { 'title': 'Network Packets on @metric', 'y_formats': [ 'pps' ], 'grid': { 'max': null, 'min': null, 'leftMin': null } } }; `

To this

` // collectd interface plugin configuration plugins.interface = new Plugin(); plugins.interface.config.multi = true;

plugins.interface.traffic = { 'graph': { '': { 'color': '#447EBC', 'alias': 'octets-rx', 'apply': 'derivative', 'math': '* -1', 'type': 'if_octets' }, '': { 'color': '#508642', 'alias': 'octets-tx', 'apply': 'derivative', 'type': 'if_octets' } }, 'panel': { 'title': 'Network Traffic on @metric', 'y_formats': [ 'Bps' ], 'grid': { 'max': null, 'min': null, 'leftMin': null } } };

plugins.interface.packets = { 'graph': { '': { 'color': '#447EBC', 'alias': 'packets-rx', 'apply': 'derivative', 'math': '* -1', 'type': 'if_packets' }, '': { 'color': '#508642', 'alias': 'packets-tx', 'apply': 'derivative', 'type': 'if_packets' } }, 'panel': { 'title': 'Network Packets on @metric', 'y_formats': [ 'pps' ], 'grid': { 'max': null, 'min': null, 'leftMin': null } } }; `

anryko commented 8 years ago

This is not right. "tx" and "rx" should be in the metric name, type or instance. Otherwise there is no way for you to know it the data is coming to the interface or out of it. I think you should investigate your collectd interface plugin configuration to get it working right.

mikaelkall commented 8 years ago

Thanks noticed that after posted. I was just happy the graph was displayed. Think the behaviour may be because of me using latest collectd 5.5. Will investigate the possibility to split it correctly.