The links generated in alerts are all localhost

Hi, Dear Team, I use 2.31.0 version of PMM, and the links in the alerts are all based on localhost. e.g.:

Annotations:
- description = mountpoint /data values=[ var='A' labels={agent_id=/agent_id/aafd723e-93ea-44d6-82af-b08c06fe6df0, agent_type=node_exporter, device=/dev/mapper/vg4-data, environment=labs, fstype=xfs, instance=/agent_id/aafd723e-93ea-44d6-82af-b08c06fe6df0, job=node_exporter_agent_id_aafd723e-93ea-44d6-82af-b08c06fe6df0_hr, machine_id=/machine_id/034a266eff0645645dd1787900000012, mountpoint=/data, node_id=/node_id/ecf6a94c-927d-4050-8282-a3ad1a442a66, node_name=db1.labs.some.net, node_type=generic} value=93.03093095697335 ]
- rule = disk usage space is critical Alerting Rule
- summary = disk is running out of usage
Source: https://localhost/graph/alerting/grafana/rzzydWI4z/view

consider my PMM service has a domain name like pmm.labs.some.net, I want to the Source item in the above alert to be:

Source: https://pmm.labs.some.net/graph/alerting/grafana/rzzydWI4z/view

what’s the configuration for this? Thanks

1 Like

Hello @Luke03011 , on the PMM Settings page you can public address.

1 Like

Thanks @artem_gavrilov But I checked this page and found I already configured a public address for it.

This seems not working.

1 Like

Hmm…I believe the value grafana uses is comes from the file in /usr/share/grafana/conf/defaults.ini

#################################### Server ##############################
[server]
# Protocol (http, https, h2, socket)
protocol = http

# The ip address to bind to, empty will bind to all interfaces
http_addr =

# The http port to use
http_port = 3000

# The public facing domain name used to access grafana from a browser
domain = localhost

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
enforce_domain = false

# The full public facing url
root_url = %(protocol)s://%(domain)s:%(http_port)s/

but when you apply the override in the settings as Artem pointed out we override that as a config parameter (ps -ef | grep grafana) and you should see something like:
cfg:default.server.root_url=https://%(domain)s/graph cfg:default.server.domain=pmm.labs.some.net

if both of those are in sync then did you do any template customizations or are you using the default notification templates for the given contact point (and which contact point are you using?)?

1 Like

@Steve_Hoffman Thanks. I found /usr/share/grafana/conf/defaults.ini is the default config file for Grafana and I can overwrite the domain option in the server section at /etc/grafana/grafana.ini. After that, the alert message can be built as expected. Thanks.

2 Likes