从同一网络上的另一台计算机访问Grafana

时间:2019-09-06 14:49:11

标签: port grafana

我按照网站上安装的服务器上的说明安装了Grafana。当我从这台特定的机器卷曲http://localhost:3000/时,我得到了响应。如果我卷曲http://ip-address-of-grafana-machine:3000/

也是如此

但是,当我尝试卷曲同一网络中另一台计算机上的http://ip-address-of-grafana-machine:3000/时,出现了连接超时。我尝试了所有在网上找到的内容,但仍然有问题。

  • 根据我们的IT服务,在安装Grafana的计算机的网络中,所有端口均可访问。
  • 机器未安装防火墙。我手动启用/禁用了ufw。启用后,我允许端口3000但仍然没有运气。

我认为问题与与端口相关的一些基本问题有关,但是由于我不是网络专家,所以我无法弄清楚。这使我相信,默认情况下,可以从已安装Grafana的计算机上访问Grafana,并且如果需要从另一台计算机上访问它,则需要进行一些更改。

我还使用了/etc/grafana/grafana.ini的[server]部分中的所有配置属性,但是我没有运气。

我在这里错过了一些非常基础的知识吗?

1 个答案:

答案 0 :(得分:0)

我使用Apache反向代理解决了这个问题。首先,我将以下内容添加到/ etc / apache2 / sites-enabled /

下的000-default.conf中。
ServerName http://ip-address-of-grafana-machine
RewriteEngine on
RewriteRule ^/?$ /grafana/ [R=permanent,L]
<Location "/grafana">
    ProxyPass http://localhost:3000
</Location>
ProxyPassReverse /grafana http://localhost:3000

我必须启用Apache中的反向代理模块才能使其正常工作(请记住,请重新启动Apache来加载它们)。如果没有,Apache将无法启动。

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo systemctl restart apache2

所以,我想通过地址http://ip-address-of-grafana-machine/grafana访问grafana UI(这就是为什么我在000-default.conf中有/ grafana路径的原因)我设置了grafana.ini参数root_url / etc / grafana下的root_url = http://ip-address-of-grafana-machine:3000/grafana(请记住一开始要删除;并确保您输入了端口号)。