项目作者: narate

项目描述 :
Prometheus file service discovery with RESTful API
高级语言: Python
项目地址: git://github.com/narate/prom-file-sd.git
创建时间: 2018-11-08T16:36:48Z
项目社区:https://github.com/narate/prom-file-sd

开源协议:

下载


prom-file-sd

Prometheus file service discovery with RESTful API

Create directory for Prometheus data

  1. mkdir -p prometheus_data
  2. chown -R $USER:65534 prometheus_data

Run

  1. docker-compose up -d

Add/Update target

  1. curl -H 'Content-Type: application/json' \
  2. http://localhost:5000/targets \
  3. -d '{
  4. "target": "localhost:9090",
  5. "labels": {
  6. "env": "prom",
  7. "job": "prom"
  8. }
  9. }'

Get targets

  1. curl http://localhost:5000/targets

Delete target

  1. curl -XDELETE \
  2. -H 'Content-Type: application/json' \
  3. http://localhost:5000/targets \
  4. -d {"id": "5be488a46b045b30130fcbfa"}

Prometheus Targets

TODO

  • Add Support custom metrics_path (e.g. /api/v1/metrics)
  • Add Web UI

Custom metrics_path

  1. curl -H 'Content-Type: application/json' \
  2. http://localhost:5000/targets \
  3. -d '{
  4. "target": "example.com:3000",
  5. "labels": {
  6. "env": "prom",
  7. "job": "prom",
  8. "__metrics_path__": "/api/v1/metrics"
  9. }
  10. }'

USE FILE-BASED SERVICE DISCOVERY TO DISCOVER SCRAPE TARGETS

https://prometheus.io/docs/guides/file-sd/