N
N
Nikolay Baranenko2017-12-20 12:05:49
Monitoring
Nikolay Baranenko, 2017-12-20 12:05:49

Checking target on promtool returns "error while linting: text format parsing error in line 1: invalid metric name"?

Hello.
Wrote a python application that, by API request
http://server01:8001/metrics
, returns both in
print(stdout)
and in

def do_GET(s):
s.wfile.write(output.encode())

# Found hosts: 2
some_metrics{hostname="sever01", key_="system.cpu.util.usage"} 4
some_metrics{hostname="server01", key_="vfs.fs.size[/data,free]"} 180073318400
some_metrics{hostname="server02", key_="system.cpu.util.usage"} 0
some_metrics{hostname="server02", key_="vfs.fs.size[/data,free]"} 597773049856

in prometheus I
registered a new target like this,
- job_name: some_metrics
    metrics_path: /metrics
    static_configs:
      - targets: ['server01:8001']

It was not possible to find data in promtheus.
Checked with promtool
curl -s http://server01:8001/metrics | /data/prometheus/promtool check metrics

it returned an error
error while linting: text format parsing error in line 1: invalid metric

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aleksei_korobov, 2021-06-30
@aleksei_korobov

Try going to the Status -> Targets section in the prometheus web interface . And there may be an additional error for your endpoint.
In my case, it was that it was not authorized (server returned HTTP status 401 Unauthorized)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question