'Grafana & Prometheus: get target from a job_name
I need in grafana's dashboard to get a list of the targets (activemq01, activemq02, activemq03) from a specfic job_name (activemq-job).
Actually I can get on my dashboard only the job_name but I can't filter by target.
Prometheus.yaml
- job_name: activemq-job
static_configs:
- targets: ['activemq01:8060', 'activemq02:8060', 'activemq03:8060']
Dashboard.json
{
"allValue": null,
"current": {},
"datasource": "${DS_PROMETHEUS}",
"definition": "label_values(job)",
"hide": 0,
"includeAll": true,
"index": -1,
"label": null,
"multi": true,
"name": "Component",
"options": [],
"query": "label_values(job)",
"refresh": 2,
"regex": "(activemq-job)",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
Solution 1:[1]
Use the following in the variable definition:
Query = label_values(instance)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcelo Ãvila de Oliveira |
