【发布时间】:2022-12-27 13:17:38
【问题描述】:
I have installed prometheus on my Linux PC and I am trying to post some metrics value. I have the following job configured in my yml file:
scrape_configs:
- job_name: test_job
metrics_path: /metrics
static_configs:
- targets: ["localhost:9090"]
I would expect the following curl request:
echo "some_metric 3.14" | curl --data-binary @- http://127.0.0.1:9090/metrics/test_job
to post the metric value, but curl is returning HTTP 404 not found. I have checked port 9090 in the browser and it is used by prometheus, not by some other server software.
Any suggestions? Thanks.
【问题讨论】:
-
That is not how it works, you do not post metrics to a Prometheus server. Prometheus server scrapes targets (usually where an exporter is running and exposing metrics in data model format ) and read metric values from them. To do some quick testing you can try textfile-collector
-
If you really want to push metrics to Prometheus, although it is not the recommended implementation as mentioned above, you can check Prometheus Pushgateway prometheus.io/docs/practices/pushing
标签: prometheus