Error reading prometheusetheus: bad_response: readObjectStart: expect { or n, but found #
Asked Answered
Y

1

6

I have prometheus server running at http://localhost:8001/: which if i browse through browser shows this:

# 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

However, when i try to configure the same endpoint in Grafana as prometheus datasource i get following error:

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|...

All other settings in Grafana (v.9.0.5) are defaults.

Any idea what am i doing wrong here?

Yield answered 29/7, 2022 at 21:9 Comment(2)
Same issue here with Traefik prometheus endpoint.Bundy
#70587427Taste
B
6

I had this issue using httpprom from golang generating similar:

# 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

This is an example of your metrics, not the link to a prometheus server. You need to configure your prometheus server to scrape these metrics: eg. in the prometheus.yml file:

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

Your prometheus server should be available by default at localhost:9090 You can check the ui to confirm Then pass that address localhost:9090 to grafana and you will get the metrics through

Backbreaker answered 12/9, 2022 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.