Thanks for the quick response. I appreciate your advice and I know that instance label shouldn't contain the port number and that should be the ideal way forward, but now my setup is huge. I'll have to change things over all my dashboards and I am monitoring close to 3000 servers. Eventually, I am going to change the instance label altogether but currently I need a short term solution to remove the port from alert annotations. Is it at all possible?
On Sunday, March 15, 2020 at 2:32:03 PM UTC+5:30, Brian Candler wrote: > > On Sunday, 15 March 2020 08:12:20 UTC+1, Yagyansh S. Kumar wrote: >> >> Hi. I want to add the dashboard link in the alert of that particular >> service. That dashboard takes the server IP and hostname as input. From the >> instance label, I want to remove the port number and pass it as input to be >> dashboard. >> > > I strongly recommend you do the opposite: make sure the instance label > doesn't contain the port number in the first place. > > This is described in outline here: > https://www.robustperception.io/controlling-the-instance-label > > <https://www.robustperception.io/controlling-the-instance-label> > The general idea is: copy the __address__ label explicitly to 'instance', > and then add :9100 (or whatever) to the __address__ label. For example, > the instance label is "foo.example.com" and the scraped address is " > foo.example.com:9100" > > You can take this further, and have the instance label be a short/friendly > name, while the address is either a FQDN or an IP address. For a working > config which does this see > https://github.com/candlerb/netbox-prometheus#targets > > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/7d908d7d-56b6-4a19-b313-00bbe4c6a681%40googlegroups.com.

