# How can I override the DEFAULT\_GRAFANA\_HOST variable?

**URL:** <https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886>\
**Category:** Dashboard, Monitoring & Debugging\
**Created:** [January 9, 2023, 2:58am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886 "2023-01-09T02:58:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brian\_Law](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/brian_law/32/3393_2.png) [@Brian\_Law](https://discuss.ray.io/u/Brian_Law)\
**Post date:** [January 9, 2023, 2:58am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/1 "2023-01-09T02:58:52Z")

</div>

- Low: It annoys or frustrates me for a moment.

How can I override the DEFAULT\_GRAFANA\_HOST in [metric\_heads.py](https://github.com/ray-project/ray/blob/ray-2.2.0/dashboard/modules/metrics/metrics_head.py)?

For my setup, `localhost` isn’t working and I need to change it to the full link.  
I have tried manually inserting the full link in the browser and that works.

Thanks

---

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [January 10, 2023, 3:49am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/2 "2023-01-10T03:49:51Z")

</div>

It is not merged yet, but this can probably helps? [Improve documentation for setting up grafana and prometheus by alanwguo · Pull Request #31129 · ray-project/ray · GitHub](https://github.com/ray-project/ray/pull/31129)

---

<div class="post-metadata">

**Author:** ![Brian\_Law](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/brian_law/32/3393_2.png) [@Brian\_Law](https://discuss.ray.io/u/Brian_Law)\
**Post date:** [January 10, 2023, 4:44am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/3 "2023-01-10T04:44:06Z")

</div>

Thanks @sangcho I just had a look at the docu and tried setting RAY\_GRAFANA\_HOST as discussed. It seems my dashboard is still trying to hit localhost?

Does that require a new Ray release too? Or it should work and maybe Ray just isn’t picking up the env var?

---

<div class="post-metadata">

**Author:** ![Brian\_Law](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/brian_law/32/3393_2.png) [@Brian\_Law](https://discuss.ray.io/u/Brian_Law)\
**Post date:** [January 10, 2023, 5:28am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/4 "2023-01-10T05:28:54Z")

</div>

Okay I had a bit of a play around and I think I know my issue now.

I am running Ray Dashboard on a databricks cluster.

I think from looking at the code what Ray is doing is first to ping the RAY\_GRAFANA\_HOST/api/health endpoint then expose the graph on the UI.

When accessing Grafana from my web-browser, given the way the Databricks driver proxy is setup, I need to hit:

`https://dbc-dp-<my_env_number>.cloud.databricks.com/driver-proxy/o/<my_account>/<my_cluster>/<port>/<grafana_page_link>`

If I set RAY\_GRAFANA\_HOST to the Databricks proxy then it’ll error out on the health check as Databricks will bounce the request from ray dashboard to a login service first that Ray Dashboard cannot handle.

But if I don’t set RAY\_GRAFANA\_HOST then the health check passes and Ray Dashboard loads the widgets but my local browser can’t load `localhost:3000` as the proxy requires It to hit: `https://dbc-dp-<my_env_number>.cloud.databricks.com/driver-proxy/o/<my_account>/<my_cluster>/<port>/` as the root address.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Huaiwei\_Sun](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huaiwei_sun/32/1316_2.png) [@Huaiwei\_Sun](https://discuss.ray.io/u/Huaiwei_Sun)\
**Post date:** [January 12, 2023, 3:00am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/5 "2023-01-12T03:00:30Z")

</div>

cc: @aguo for ideas on this

---

<div class="post-metadata">

**Author:** ![aguo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/aguo/32/2558_2.png) [@aguo](https://discuss.ray.io/u/aguo)\
**Post date:** [January 13, 2023, 6:30pm UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/6 "2023-01-13T18:30:39Z")

</div>

Hi Brian,

We actually have two env vars that so that you can customize both the host the dashboard api server uses to hit grafana and the the url that the browser uses to embed the grafana graphs.

The first, `RAY_GRAFANA_HOST` can use your localhost value since it sounds like the dashboard api server is running on the same host as your grafana instance.

The second, `RAY_GRAFANA_IFRAME_HOST` allows you to customize the host used by the browser. This should be set to your `https://dbc-db...` hostname value.

Let me know if that works!

`RAY_GRAFANA_IFRAME_HOST` is more a less a “private” configuration since we weren’t sure if users would find it useful. If it is a common usecase, we can make this public and document it.

---

<div class="post-metadata">

**Author:** ![Brian\_Law](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/brian_law/32/3393_2.png) [@Brian\_Law](https://discuss.ray.io/u/Brian_Law)\
**Post date:** [January 14, 2023, 12:15pm UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/7 "2023-01-14T12:15:45Z")

</div>

Thanks @aguo that `RAY_GRAFANA_IFRAME_HOST` was what I needed and fixes it

---

<div class="post-metadata">

**Author:** ![tirbo06](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/tirbo06/32/4986_2.png) [@tirbo06](https://discuss.ray.io/u/tirbo06)\
**Post date:** [August 28, 2023, 10:33am UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/8 "2023-08-28T10:33:57Z")

</div>

```auto
Ray==2.6.3
Python==3.10.12

```

Hi,

Thank you for your dedication in the Ray library !

I am fetching over lan, the ip of the head node where the dashboard is hosted. I can access the ray dashboard with configured prometheus and grafana servers also, but it seems that the ray’s iframe embedding grafana’s metrics has an error in the url as the protocol `http://` is missing:

`<iframe src="192.168.1.18:3000/d-solo/rayDefaultDashboard/default-dashboard?orgId=1&[...]"`

When i modify the code in the front-end it works great with :

`<iframe src="http://192.168.1.18:3000/d-solo/rayDefaultDashboard/default-dashboard?orgId=1&[...]"`

Configuration:

- i have configured `RAY_GRAFANA_IFRAME_HOST` to the IP of the head node 192.168.1.18
- i have not configured the others `RAY_GRAFANA/PROMETHEUS_HOST` as it seems not required.
- I launch the cluster with the flag `--dashboard-host 192.168.1.18`
- I use a custom `grafana.ini` with :

```auto
[server]
protocol = http
http_port = 3000
domain = 192.168.1.18
enforce_domain=false
# Tried both
root_url=%(protocol)s://%(domain)s:%(http_port)s/
root_url=http://192.168.1.18:3000
....

```

I am certainly missing something but at this point i can’t find it.  
Should i had some extra configuration to the `grafana.ini` ?

Thanks  
(Not sure if i should reply here or open a new post)

---

<div class="post-metadata">

**Author:** ![Huaiwei\_Sun](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/huaiwei_sun/32/1316_2.png) [@Huaiwei\_Sun](https://discuss.ray.io/u/Huaiwei_Sun)\
**Post date:** [August 28, 2023, 4:08pm UTC](https://discuss.ray.io/t/how-can-i-override-the-default-grafana-host-variable/8886/9 "2023-08-28T16:08:34Z")

</div>

What error did you see?

Have you configured all the settings as per the instruction here? [Configuring and Managing Ray Dashboard — Ray 2.6.1](https://docs.ray.io/en/latest/cluster/configure-manage-dashboard.html#embedding-grafana-visualizations-into-ray-dashboard)
