Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: All panels #42

Closed
p0ntsNL opened this issue May 1, 2017 · 25 comments
Closed

Feature request: All panels #42

p0ntsNL opened this issue May 1, 2017 · 25 comments
Assignees
Milestone

Comments

@p0ntsNL
Copy link

p0ntsNL commented May 1, 2017

Would love to see a wildcard possibility with the "PanelId(s)" option.

For example I have a dashboard with the following templatings:

$host = SHOW TAG VALUES FROM "filesystems" WITH KEY = "hostname"
$filesystem = SHOW TAG VALUES FROM "filesystems" WITH KEY = "metric" WHERE hostname =~ /$host/

Which means for each host there is a different number of panels available for this dashboard, and because its hardcoded now I can not use the grafana module for this specific dashboard.

If a wildcard (*) option would exist, it would check with grafana how many panels there are and just show them all.

Currently I have a very ugly way with my hacked grafana graph version to loop through the dashboard this way:

/usr/bin/curl http://icinga:3000/api/dashboards/db/icinga2-filesystems 2> /dev/null | python -m json.tool | sed -n -e '/panels/,$p'| grep '"id"' | grep -o [0-9]*

This will list the panel numbers:

root@icinga:/# /usr/bin/curl http://icinga:3000/api/dashboards/db/icinga2-filesystems 2> /dev/null | python -m json.tool | sed -n -e '/panels/,$p'| grep '"id"' | grep -o [0-9]*

1
2
3
4
5
6
7
8

Maybe you are able to find a better and easier way to query grafana for this information?

@p0ntsNL
Copy link
Author

p0ntsNL commented May 1, 2017

btw, the reason this gives trouble is if a host has only 1 panel but the grafana settings want panels 1,2,3,4 it will query grafana for panels that dont exist which will result in a unresponsive webinterface untill grafana gives error and show no graph.

@p0ntsNL
Copy link
Author

p0ntsNL commented May 1, 2017

I think this is not possible because the grafana curl api does not allow any variables in the url.

works: http://icinga:3000/api/dashboards/db/icinga2-filesystems

does not work: http://icinga:3000/api/dashboards/db/icinga2-filesystems?var-host=nfs02&var-filesystem=All

I will have a look if anything else is possible

@Mikesch-mp
Copy link
Owner

Hi,

with v1.2.0 there will be a link thats leads to a page with all service graphs of a host.

Best regards,

Carsten

@p0ntsNL
Copy link
Author

p0ntsNL commented May 16, 2017

Sounds great, looking forward to see how you did it!

Keep up the good work!

@Mikesch-mp Mikesch-mp self-assigned this May 21, 2017
@Mikesch-mp
Copy link
Owner

Duplicate of #30

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

not duplicate btw, this would be a feature to show all graphs for a certain dashboard not a host.

2 different features

@Mikesch-mp Mikesch-mp reopened this May 22, 2017
@Mikesch-mp
Copy link
Owner

i Know, but as long we cant get all panels via api from Grafana, there will be no solution for this issue. Maybe you open a feature request at the Grafana repository?

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

yes that is true, I will have a look at it!

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

grafana/grafana#8434

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

got the following answer:

The templating queries & variables and evaluation of repeated panels & rows is all done in the browser, so the api cannot return the info you want.

@Mikesch-mp
Copy link
Owner

Matches what i expected. So i can only give you the featrue to show all services of a host on one page.

@lesinigo
Copy link

Not sure if it is relevant here, but the actual query used to get possible variable values is done by grafana-server to its backend. Grafana is definitely able to give you a list of host and services, if you have them as tags in InfluxDB (or any other grafana backend that can manage templating queries.).

It is the interpolation of those results with the dashboard definition that's done in the browser (and gives you the number of rows and graphs and series in a graph, according to the various templating / repetition settings).

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

indeed, lets do that and close this issue!

@lesingo that was exactly what I was looking for, for example server01 has 1 filesystem and server02 has 2 filesystems.

server01 will have 1 panel
server02 will have 2 panels

When I give the filesystem service in the grafana module panels 1,2 it will also try to pull panel 2 for server01 which it shouldnt.

I thought it would be possible to use for example * and select all panels based on a variable in the url, but as stated by the grafana DEV in grafana/grafana#8434 it is indeed not possible because its done in the browser and not on server side.

I guess this case can be closed, unfortunately. (I dont know how to solve this issue with current config)

@lesinigo
Copy link

@p0nt I am not sure if I understood your original question correctly.

If you want one graph per service, with all the performance data on it, even if you don't know how many performance data you get, that should be doable. As an example, think about filesystem space from the disk check, which you don't know beforehand how many filesystem you will have. You can repeat the query in a single graph using the group by feature.

You can have a single graph with a query like this (InfluxDB example) SELECT mean("value") FROM /^$measurement$/ WHERE "hostname" =~ /^$hostname$/ AND "metric" =~ /^$metric$/ AND $timeFilter GROUP BY time($__interval), "metric" fill(none) (and then add ALIAS BY $tag_metric).
All the data you need to pass is already known to IcingaWeb2: hostname, check_command (measurement) and service (metric).

@p0ntsNL
Copy link
Author

p0ntsNL commented May 22, 2017

thank you for your help @lesinigo, actually I wanted a different panel for each filesystem so this would not solve the problem.

filesystems in 1 graph would be ok, but interface graphs with in/out metrics would not fix for that purpose.

@Caez83
Copy link

Caez83 commented Jun 26, 2017

I have a similar problem with some of graphs.
For example, i'm using all_disks plugin with return every disk on the server (And some servers have not the same disks )

I have each value on perfdata
Label Value
/var 296.49 GiB
/ 2.04 GiB

On grafana i've created a $disk variable for splitting graphs

If it's not possible to have all the grafana panelids, it is possible to repeat a defined variable for each perfdata value ( if i have 5 disks i have 5 graphs ) ?
for example &disk=$perfdatalabel$ ?

@Mikesch-mp
Copy link
Owner

@p0nt @Caez83 i have an idea to mark graphs as repeatable, but the have to be the only graph/panel in the dashboard to work. Then i could loop through panels = count(perfdata array). But i need to finish all panels for host first.

@Caez83
Copy link

Caez83 commented Jun 26, 2017

Thank you

@p0ntsNL
Copy link
Author

p0ntsNL commented Jun 26, 2017

Thanks from me 2!

@Mikesch-mp Mikesch-mp added this to the 1.1.10 milestone Aug 12, 2017
Mikesch-mp pushed a commit that referenced this issue Aug 12, 2017
@Mikesch-mp
Copy link
Owner

Implemented with 777261f

@dnsmichi
Copy link
Collaborator

Screenshot for README.md? :)

@Mikesch-mp
Copy link
Owner

@dnsmichi its not easy to show it in one screenshot, but i added an example dashboard.

@p0ntsNL
Copy link
Author

p0ntsNL commented Aug 15, 2017

I have just tested this, I can't seem to understand how this works.

Settings:
http://shot.xsnews.nl/stefan/dcef62f99ffd630b.png

How it looks:
http://shot.xsnews.nl/stefan/c25b791a01fb73fb.png

As you can see there is allot of white space around the 2 graphs.

What should I fill it at 'PanelId(s) *' to make this work?

It gives 4 iframe's while there are only 2 graphs in that panel:
http://shot.xsnews.nl/stefan/b45f7a23d0bebdb4.png

@p0ntsNL
Copy link
Author

p0ntsNL commented Aug 15, 2017

I found it, there were only 2 graphs in the panel but for some reason they had id 2 and 3 which means he was showing id 0 and 1 also but they were non existant

@Mikesch-mp
Copy link
Owner

@p0nt see the example dashboard to get an idea how this showld work.
For example you have a check thats has all disks at once in it, lets asume "c:=50% d:=50% e:=60% f:=55%" as the perfdata we get. You setup a dashboard where you get the metrics for that check with a template like

SHOW TAG VALUES FROM /^disk$/ WITH KEY = "metric" where hostname =~ /^$hostname$/ and service =~ /^$service$/' 

and in you panel you have a query

SELECT mean("value") FROM "disk" WHERE "hostname" =~ /^$hostname$/ AND "service" =~ /^$service$/ AND "metric" =~ /^$perf$/ AND $timeFilter GROUP BY time($interval), "metric" fill(none)

Now you can repeat the row or the panel for $perf. The module will then load all the panels that grafana will auto generate.

Pic before the auto repeat will hit:
image

And now with auto repeat

image

This works no matter how many metrics are there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants