anryko / grafana-influx-dashboard

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

allow instance selection #63

Closed einsiedlerkrebs closed 8 years ago

einsiedlerkrebs commented 8 years ago

Hey,

thanks a lot for this project. it makes my day. I was wondering, if it would be possible, to have a more precise metrics selection, like

dashboard/script/getdash.js?host=onehost.com,anotherhost.com&metric=interface&instance=eth0

so one could control a specific interface over all hosts.

and again, thanks!

anryko commented 8 years ago

Hi @einsiedlerkrebs, I added initial implementation to the separate branch. It supports regex inputs too.

http://localhost:3000/dashboard/script/getdash.js?host=vagrant-ubuntu-precise-32&metric=disk&instance=sda1
http://localhost:3000/dashboard/script/getdash.js?host=vagrant-ubuntu-precise-32&metric=disk&instance=sd*
http://localhost:3000/dashboard/script/getdash.js?host=vagrant-ubuntu-precise-32&metric=disk&instance=sda[0-3]

Please test and let me know what you think.

einsiedlerkrebs commented 8 years ago

Hey anryko,

that was fast. Yes, that is what I thought it should do. Thank you

eins.

anryko commented 8 years ago

Thanks for the nice idea @einsiedlerkrebs. Merged to master.

einsiedlerkrebs commented 8 years ago

Hey,

i am working on support for IRQ Plugin. The interrupts are numbers. cat /proc/interrupts. The problem is, that i have trouble with the regexing. When i have a interrupt "4" it matches "47" as well. Do you have a hint how to stop the regexing? thanks.

eins

Another question is if you cant hint some docu-link where i can figure out, to do some math. Might be in your code or maybe grafana? i would like to have a graph for interupts/minute.

and thanks again

anryko commented 8 years ago

Hi @einsiedlerkrebs, There should be no regexp match when you don't use any special characters. instance=4 is translated to regexp /^4$/ which should match only 4 and not 47. If you need multiple values but struggle to find exact regexp to match those you can use a list notation, like instance=4,6,13,101.

for the interrupt/minute graph you should use 'apply': 'derivative(1m)' in your plugin graph configuration. Check how it is described in the getdash repository README file (// collectd disk plugin configuration).

anryko commented 8 years ago

Heh, I think i understood your issue only after posting the answer :). You are actually asking about plugin configuration regexp and not GET instance request... let me think about it and do some tests.

einsiedlerkrebs commented 8 years ago

yes. sorry, if i did not clearify this. and now i understood you answer! ;)

and thanks a lot for the apply = derivative(1m). very nice!

anryko commented 8 years ago

one way I can think of is to use exact regexp match

'graph': {                                                                   
    '/^4$/': { 'apply': 'derivative(1m)' }                          
}

let me know if this helps :).

einsiedlerkrebs commented 8 years ago

yes that helps. i thought i tried this.

cool. thanks it works.

I will see, if i can build the plugin in a bit more generic and will send you a pull request.

thanks for your help

anryko commented 8 years ago

you are welcome

einsiedlerkrebs commented 8 years ago

Thanks again. #65