Right IP address instead of localhost in mail alerts

In mail alert you have two options or links to to “View your alert” and “Go to alerts”. Both links redirects you to “localhost”. Dead link, in fact. How can I replace or define localhost with IP address, so both links will lead me to somethink usefull and not to dead “localhost”.
Maybe, I have to replace http_addr with IP address of my server. But I am running Grafana in docker and there is no way to simple edit grafana.ini. As long as I know, I have to edit grafana.env. OK, but what I have ti write into this file to define http_addr? I have tried GF_SERVER_HTTP_ADDR but this doesn’t work.

Easy for for making grafana.ini editable: run the container with this volume mount:
-v ./grafana/etc:/etc/grafana:ro

Now you can edit /etc/grafana/grafana.ini inside the container simply by editing ./grafan/etc/grafana.ini
I changed root_url to “root_url = http://DOCKERHOST.MYDOMAIN:3000

Thank You for the hint. It is a good idea. But are does those changes persistant if i delete container or image?
I have found settings in grafana.env: GF_SERVER_ROOT_URL=http://IP_of_server:3000

Since I do a bind mount (the -v ./grafana/etc:/etc/grafana:ro), the config file which is in ./grafana/etc/grafana.ini is kept outside the container, so it’s persistent.

In your case you can set a variable in grafana.env, which works too. It does only work as long as you can use those special environment variables though, but in your case that’s ok.

1 Like