场景:
通过在系统中通过iframe展示Grafana时报如下异常:
使用方法
<iframe width="100%" height="500px" src="http://localhost:3001/d/RE36JmuZk/sheng-chan-qu-xian?orgId=1&from=1581856853544&to=1584448853544&panelId=2&fullscreen"></iframe>
解决方法:
需要对Grafana的配置文件进行修改,才可以使画面可以通过iframe在其他页面中加载。配置文件时Grafana目录下conf目录中的defaults.ini文件。
设置为允许匿名访问(这个根据实际需求设置)
[auth.anonymous]
# enable anonymous access
enabled = true
允许通过iframe访问(主要就是设置这个)
allow_embedding = true