Share Grafana dashboard on a web page

Dear Grafana users,

I am new in this world and obviously like any begginer I need support :slight_smile:
I have created an Grafana Dashboard and now I want to share it on a web site. I have read the documentation and I think I understood the main steps, however it’s not working. I have used the simple HTML command:

with no success. If I access the web page on the server where Grafana and web page are hosted, it opens the Grafana login page, but when I actually log in, it just jumps back to the login page. If I attempt to open the web page from anywhere else externally, I get the "localhost refused to connect" error message. Is there any configuration which I am missing? Maybe in the .ini file? Thanks for the support

To be able to embed dashboards as an iframe in an external site, you have to enable this setting in the security section of your ini file.

Here is a simple example of an html page that embeds a Grafana dashboard:

<html>
  <head> </head>
  <body>
<iframe src="http://grafana.staged-by-discourse.com/d-solo/YFlVmSTmk/mytestdashboard?orgId=1&from=1585822429489&to=1585823329490&panelId=18" width="450" height="200" frameborder="0"></iframe>
  </body>
</html>

Hello Daniel,
Thank you for your fast reply.
I have the 4.4.3 version and I cannot find the allow_embedding command in the ini file. Can I simply add the command there or should I first upgrade to the last Grafana version?
Thanks
Sebastian

Well, you should probably upgrade, 4.4.3 is several years old :slight_smile:

But in that version you don’t need the allow_embedding command that got added later as a security fix.

What html are you using and what settings do you have in your ini file?

OK: I have upgarded to the latest version, I have modified the .ini as suggested by you, I only used the html example from you… still same results…
I have the feeling that is either a security issue or something related to the “server” settings in .ini file?!.. but what is wrong?

See below the corresponding .ini sections:

  • Server section has only
    [server]

Protocol (http, https, h2, socket)

protocol = http

The http port to use

;http_port = 3000
http_port = 8989
The rest is commented.

  • The security section has only the allow_embedding = true; the rest is commented;
    Any other hints?
    Thanks

If you are opening it from anywhere else externally, then Grafana is not on localhost. You would need to replace localhost with the IP address or url.

This sounds like the login is failing for some reason. But before we dig into that - do you want a login screen for these embedded panels? Usually you would turn on anonymous users so that users don’t have to login:

Hello,
Very strange, but it’s not working either. It’s clear I’m missing something of essential importance (I would not be surprised if it is something very obvious :slight_smile:

In the meanwhile I have done a different test: in the iframe I placed an non secured URL (a random one) and this way is working the connection. So something is blocking my Grafana URL. I have disabled all firewalls (that I know about) including the antivirus, cleared the Cache, DNS flush… no success.

To answer your second question: at the moment I’m not interestead in logging in from this panel. At least to display it.
Thanks again for the support and patience :slight_smile:
Sebastian