我在哪里可以找到 Prometheus 指标的描述?
Where can I find descriptions of Prometheus metrics?
我正在 Grafana 中构建一个仪表板,使用来自 Prometheus 的数据来监控 Kubernetes 集群中的命名空间。我需要所有这些来查看负载测试期间会发生什么。
现在我花了半天时间寻找有关 Prometheus 中不同指标的信息。我已经通读了 Prometheus docs and kube state metrics docs(它从我们的集群中获取数据),但我没有找到任何关于哪个指标做什么的描述。我只能根据查询结果和随处可见的示例进行猜测,但这比我想要的更慢且更不安全。
但是,我遇到了 SO 答案,所以我认为引文一定是从某处复制的。有人要吗?
我想你想找到 "which metric does what" 这与 kubernetes 无关。
Prometheus 将从导出器获取数据并存储在其数据库中,因此您必须向正在导出矩阵的导出器询问此问题。
当量。您可以从节点导出器获取基本 CPU 内存。您可以在下面 link.
中找到 Node 导出的所有矩阵
https://github.com/prometheus/node_exporter
现在的问题是导出哪个矩阵可以从 Prometheus 中的目标找到 UI。
我找到了问题的答案。 gave me the hint to have a look at exporters and I found the other half of the answer here.
所以在 Prometheus UI 上,有一个导出器列表及其抓取的端点(状态 > 目标)。如果我调用其中一个端点,则响应包含端点提供的每个指标的描述和类型。
通话:
curl http://exporter.endpoint:9100/metrics
回复样本:
# HELP http_response_size_bytes The HTTP response sizes in bytes.
# TYPE http_response_size_bytes summary
http_response_size_bytes{handler="prometheus",quantile="0.5"} 16310
http_response_size_bytes{handler="prometheus",quantile="0.9"} 16326
http_response_size_bytes{handler="prometheus",quantile="0.99"} 16337
http_response_size_bytes_sum{handler="prometheus"} 1.46828673e+09
http_response_size_bytes_count{handler="prometheus"} 90835
# HELP node_arp_entries ARP entries by device
# TYPE node_arp_entries gauge
node_arp_entries{device="cali6b3dc03715a"} 1
node_arp_entries{device="eth0"} 15
如何完成这项工作对我来说并非易事。我登录到集群,发现 curl
没有收到任何端点的响应。解决方案是将端点 url 的基础添加到 no_proxy
变量(我的机器和服务器都位于公司代理后面)。
但无论如何,这就是阅读 Prometheus 指标描述的方式。
您可以使用以下 curl 表达式获取指标的元数据:
url=http://urpromhost:9090
curl -G $url/api/v1/targets/metadata \
--data-urlencode 'metric=metricname' \
--data-urlencode 'match_target={}'
我正在 Grafana 中构建一个仪表板,使用来自 Prometheus 的数据来监控 Kubernetes 集群中的命名空间。我需要所有这些来查看负载测试期间会发生什么。
现在我花了半天时间寻找有关 Prometheus 中不同指标的信息。我已经通读了 Prometheus docs and kube state metrics docs(它从我们的集群中获取数据),但我没有找到任何关于哪个指标做什么的描述。我只能根据查询结果和随处可见的示例进行猜测,但这比我想要的更慢且更不安全。
但是,我遇到了
我想你想找到 "which metric does what" 这与 kubernetes 无关。
Prometheus 将从导出器获取数据并存储在其数据库中,因此您必须向正在导出矩阵的导出器询问此问题。
当量。您可以从节点导出器获取基本 CPU 内存。您可以在下面 link.
中找到 Node 导出的所有矩阵
https://github.com/prometheus/node_exporter
现在的问题是导出哪个矩阵可以从 Prometheus 中的目标找到 UI。
我找到了问题的答案。
所以在 Prometheus UI 上,有一个导出器列表及其抓取的端点(状态 > 目标)。如果我调用其中一个端点,则响应包含端点提供的每个指标的描述和类型。
通话:
curl http://exporter.endpoint:9100/metrics
回复样本:
# HELP http_response_size_bytes The HTTP response sizes in bytes.
# TYPE http_response_size_bytes summary
http_response_size_bytes{handler="prometheus",quantile="0.5"} 16310
http_response_size_bytes{handler="prometheus",quantile="0.9"} 16326
http_response_size_bytes{handler="prometheus",quantile="0.99"} 16337
http_response_size_bytes_sum{handler="prometheus"} 1.46828673e+09
http_response_size_bytes_count{handler="prometheus"} 90835
# HELP node_arp_entries ARP entries by device
# TYPE node_arp_entries gauge
node_arp_entries{device="cali6b3dc03715a"} 1
node_arp_entries{device="eth0"} 15
如何完成这项工作对我来说并非易事。我登录到集群,发现 curl
没有收到任何端点的响应。解决方案是将端点 url 的基础添加到 no_proxy
变量(我的机器和服务器都位于公司代理后面)。
但无论如何,这就是阅读 Prometheus 指标描述的方式。
您可以使用以下 curl 表达式获取指标的元数据:
url=http://urpromhost:9090
curl -G $url/api/v1/targets/metadata \
--data-urlencode 'metric=metricname' \
--data-urlencode 'match_target={}'