Mikesch-mp / icingaweb2-module-grafana

Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
https://icinga.com/community/
GNU General Public License v2.0
240 stars 93 forks source link

Link to grafana no longer works with grafana 7 and the new image renderer plugin in grafana #254

Closed mdicss closed 1 year ago

mdicss commented 4 years ago

Grafana 7 breaks the grafana integration in icinga web 2, see https://community.icinga.com/t/fyi-grafana-upgrade-v6-to-v7-breaks-grafana-integration-with-icingaweb2/4263/10 I had to use chrome standalone instead of the chrome packaged in plugin-linux-x64-glibc and add GF_RENDERER_PLUGIN_IGNORE_HTTPS_ERRORS=true to /etc/defaults/grafana-server as described above. I use centos. Now, the graphs are displayed correctly in icinga web 2 but I had the problem, that the link from the graph to grafana didn’t work. It made a redirect to localhost:3000 and ended in a error message with ’ PR_END_OF_FILE_ERROR’, probalbly a security/certificate problem. Then I patched /usr/share/icingaweb2/modules/grafana/library/Grafana/ProvidedHook/Grapher.php

# diff Grapher.php Grapher.php.orig
571c571
<                     $html .= '<a href="%s://%s/d/%s/%s?var-hostname=%s&var-service=%s&var-command=%s%s&from=%s&to=%s&orgId=%s&viewPanel=%s" target="_blank">%s</a>';
---
>                     $html .= '<a href="%s://%s/d/%s/%s?var-hostname=%s&var-service=%s&var-command=%s%s&from=%s&to=%s&orgId=%s&panelId=%s&fullscreen" target="_blank">%s</a>';
590c590
<                     $html .= '<a href="%s://%s/dashboard/%s/%s?var-hostname=%s&var-service=%s&var-command=%s%s&from=%s&to=%s&orgId=%s&viewPanel=%s" target="_blank">%s</a>';
---
>                     $html .= '<a href="%s://%s/dashboard/%s/%s?var-hostname=%s&var-service=%s&var-command=%s%s&from=%s&to=%s&orgId=%s&panelId=%s&fullscreen" target="_blank">%s</a>';

Without &fullscreen and with viewPanel= instead of panelId= it seems to work now. Can you verify this and include a change in a next version of the grafana module?

phil-or commented 4 years ago

I also use Grafana 7.x and had the same problem. So I also changed these two lines and it works. When you change the code on github, then you should consider an option for users with older Grafana versions (< 7). Maybe a switch in the config? Otherwise users with older versions will have the same problem.

phil-or commented 3 years ago

Seems v1.4.2 solved this problem!? Thx Carsten!!! In my opinion you could close this issue