I presume you are statically mentioning targets in the Prometheus config file as follows:
- job_name: "node_exporter"
static_configs:
- targets: ['localhost:9100']
In that case, if you see the {{instance_name}}
in grafana, it will give you the same as your target name ['localhost:9100']
. This is because it uses the static_configs
to avail labels for your metrics.
In order to remove the :9100
from the labels, you can use service discovery to recognize targets.
For example: ec2_sd_config
where the labels will be availed from labels mentioned in AWS EC2 dashboard, file_sd_config
where you can provide the targets and their labels in json or yaml format, etc.
Please refer to the link for detailed information.
Hope this helps!