Embedding a website in a Grafana dashboard
Asked Answered
D

3

6

I run Grafana 7.2.0 Open Source Edition and need to embed a website into the dashboard itself. That is, I need a row or two of the usual panels of graphs, and below them embed an external web site that needs to be periodically reloaded.

How can I achieve this? There do not seem to be any relevant plugins at https://grafana.com/grafana/plugins. Is it possible to write a custom panel just for my instance? If so, any pointers about how to start would be appreciated.

Dereism answered 22/1, 2021 at 14:50 Comment(0)
S
9

You can use Grafana's standard "Text" panel. Set Display->Mode->HTML in panel settings and add <iframe src="http://your.external.web.page.url"></iframe> in panel content editor.

Semiconscious answered 26/1, 2021 at 15:41 Comment(3)
might need to set allow_embedding = true in the config file.Hertha
The allow_embedding configuration setting controls whether grafana can be embedded on other pages (via the X-Frame-Options header). To get the iframes to show in a text panel, you need to set disable_sanitize_html to true.Dahlberg
Hello, I am doing the same but it is not working for me. I have configured allow_embedding = true disable_sanitize_html = true I am trying to load a ".html" link using iframe. <iframe src="your.external.web.page.html"></iframe>Hyohyoid
K
0
if you want to dynamically change the height of iframe base on panel within 
Grafana using JavaScript, you can achieve this by this:
 <iframe id="embeddedFrame" src="http://your.external.web.page.url" width="100%"> </iframe>
<script>
var iframe = document.getElementById("embeddedFrame");

    function setIframeHeight() {
        iframe.style.height = iframe.parentElement.offsetHeight-5 + "px";
    }

    // Call setIframeHeight when the iframe content is loaded
    iframe.onload = setIframeHeight;

    // Also, call setIframeHeight when the window is resized
    window.addEventListener("resize", setIframeHeight);
</script>
Korikorie answered 10/8, 2023 at 9:5 Comment(0)
C
0

I'm running grafana in docker (docker-compose)

A comment on this site: https://grafana.com/grafana/dashboards/11204-octoprint/?tab=reviews

led me to adding this environment (GF_PANELS_DISABLE_SANITIZE_HTML=true) which let me get my octopi webcam stream going in an iframe text panel as described above.

Cavit answered 22/12, 2023 at 5:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.