我对Grafana并不陌生,我正在尝试创建一个面板,该面板提供每个组件的软件的最新版本。我的数据源是普罗米修斯。下面是Grafana中的查询检查器。问题是value
属性在version
字段(即1.4.3)中时,metric
始终为1。理想情况下,该表将显示job
,pod
,service
和version
{
"xhrStatus": "complete",
"request": {
"method": "GET",
"url": "api/datasources/proxy/4/api/v1/query_range?query=fabric_version&start=1570982400&end=1571025600&step=43200&timeout=60s"
},
"response": {
"status": "success",
"data": {
"resultType": "matrix",
"result": [
{
"metric": {
"endpoint": "https",
"instance": "10.129.0.13:8443",
"job": "ibp-os-metrics",
"namespace": "ibp",
"pod": "oskrgfu1-7bf78b7ff8-99ktp",
"service": "ibp-os-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.129.0.14:8443",
"job": "ibp-os-metrics",
"namespace": "ibp",
"pod": "oskrgfu3-758874c4dd-xg672",
"service": "ibp-os-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.129.0.15:9443",
"job": "ibp-org1-metrics",
"namespace": "ibp",
"pod": "org1peer1-5794969465-zbfrq",
"service": "ibp-org1-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.130.0.17:8443",
"job": "ibp-os-metrics",
"namespace": "ibp",
"pod": "oskrgfu4-7d7fb7f8d9-hhm4r",
"service": "ibp-os-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.130.0.19:9443",
"job": "ibp-org1-metrics",
"namespace": "ibp",
"pod": "org1peer2-66d6dc8b97-wvxbm",
"service": "ibp-org1-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.131.0.13:8443",
"job": "ibp-os-metrics",
"namespace": "ibp",
"pod": "oskrgfu2-5fc85bfb46-2sfv9",
"service": "ibp-os-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
},
{
"metric": {
"endpoint": "https",
"instance": "10.131.0.15:8443",
"job": "ibp-os-metrics",
"namespace": "ibp",
"pod": "oskrgfu5-b68d5bd7b-564g7",
"service": "ibp-os-metrics",
"version": "1.4.3"
},
"values": [
[
1570982400,
"1"
],
[
1571025600,
"1"
]
]
}
]
}
}
}
我可以使用fabric-version
查询,但是不能自定义表格列
答案 0 :(得分:1)
"version": "1.4.3"
是指标的标签,即指标1
中的值。指标值存储在"values":[]
数组中。此指标可以显示为:
fabric_version{...,version="1.4.3"} 1
如何解决它:
fabric_version{version="1.4.3"}
1.4.3
的Pod列表fabric_version
声明为gauge 1.4.3
或其他内容