gpt4 book ai didi

python - 读取 prometheusetheus 错误 : bad_response: readObjectStart: expect { or n, 但发现 #

转载 作者:行者123 更新时间:2023-12-05 03:20:22 28 4
gpt4 key购买 nike

我有运行在 http://localhost:8001/ 的 prometheus 服务器:如果我通过浏览器浏览会显示:

# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 403.0
python_gc_objects_collected_total{generation="1"} 0.0
python_gc_objects_collected_total{generation="2"} 0.0
# HELP python_gc_objects_uncollectable_total Uncollectable object found during GC
# TYPE python_gc_objects_uncollectable_total counter
python_gc_objects_uncollectable_total{generation="0"} 0.0
python_gc_objects_uncollectable_total{generation="1"} 0.0
python_gc_objects_uncollectable_total{generation="2"} 0.0
# HELP python_gc_collections_total Number of times this generation was collected
# TYPE python_gc_collections_total counter
python_gc_collections_total{generation="0"} 39.0
python_gc_collections_total{generation="1"} 3.0
python_gc_collections_total{generation="2"} 0.0
# HELP python_info Python platform information
# TYPE python_info gauge
python_info{implementation="CPython",major="3",minor="10",patchlevel="4",version="3.10.4"} 1.0
# HELP myorg_diskmetric_sizeInBytes Gets the size of the disk in bytes.
# TYPE myorg_diskmetric_sizeInBytes gauge
# HELP myorg_diskmetric_maxSizeInMegabytes Gets or sets the maximum size of the disk in megabytes, which is the size of memory allocated for the disk.
# TYPE myorg_diskmetric_maxSizeInMegabytes gauge
# HELP myorg_m_count Count of ping failures through count.
# TYPE myorg_m_count gauge

但是,当我尝试在 Grafana 中配置与 prometheus datasource 相同的端点时我收到以下错误:

Error reading prometheusetheus: bad_response: readObjectStart: expect { or n, but found #, error found in #1 byte of ...|# HELP pyth|..., bigger context ...|# HELP python_gc_objects_collected_total Objects co|...

Grafana (v.9.0.5) 中的所有其他设置均为默认值。

知道我在这里做错了什么吗?

最佳答案

我在使用 golang 生成类似的 httpprom 时遇到了这个问题:

# HELP python_gc_objects_collected_total Objects collected during gc
# TYPE python_gc_objects_collected_total counter
python_gc_objects_collected_total{generation="0"} 403.0
python_gc_objects_collected_total{generation="1"} 0.0
python_gc_objects_collected_total{generation="2"} 0.0

这是您的指标示例,而不是普罗米修斯服务器的链接。您需要配置您的普罗米修斯服务器来抓取这些指标:例如。在 prometheus.yml 文件中:

global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: proxy
metrics_path: /
static_configs:
- targets:
- localhost:8001

你的 prometheus 服务器应该默认可用在 localhost:9090你可以检查ui来确认然后将该地址 localhost:9090 传递给 grafana,您将通过

关于python - 读取 prometheusetheus 错误 : bad_response: readObjectStart: expect { or n, 但发现 #,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73171022/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com