{"id":18601719,"url":"https://github.com/eficode/prometheus-catalog","last_synced_at":"2025-05-16T17:33:42.247Z","repository":{"id":56164868,"uuid":"270943461","full_name":"eficode/prometheus-catalog","owner":"eficode","description":"Simple service that keeps list of prometheus scrape targets in redis. The service allows servers to self-register for monitoring and prometheus to query the list of self-registered scrape targets.","archived":false,"fork":false,"pushed_at":"2023-05-01T20:41:14.000Z","size":11,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-18T01:33:29.135Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eficode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-09T08:18:13.000Z","updated_at":"2020-12-02T06:42:10.000Z","dependencies_parsed_at":"2025-02-18T01:30:59.367Z","dependency_job_id":"82710882-0e4f-4c46-973b-7771d0129f37","html_url":"https://github.com/eficode/prometheus-catalog","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fprometheus-catalog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fprometheus-catalog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fprometheus-catalog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fprometheus-catalog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eficode","download_url":"https://codeload.github.com/eficode/prometheus-catalog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254576422,"owners_count":22094366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T02:09:13.528Z","updated_at":"2025-05-16T17:33:42.233Z","avatar_url":"https://github.com/eficode.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prometheus Catalog\n\nSimple service that keeps list of prometheus scrape targets in redis. The service allows servers to self-register for monitoring and prometheus to query the list of self-registered scrape targets.\n\nService can be used as sidecar container or standalone service.\n\n`$FILE_SD_CONFIG` file can be used to directly integrate into Prometheus' scrape config, either by mounting the file to Prometheus container or as a sidecar container.\n\nAs a standalone service, cronjob can be used to periodically fetch with `http://\u003cprometheus-catalog-host\u003e/list` API call, format of the content matches `$FILE_SD_CONFIG` file.\n\n\n## Usage\n\n    docker run -p 5000:80 -v $(pwd)/state:/var/prometheus-catalog -ti --rm eficode/prometheus-catalog:latest\n\n\n## Environment variables\n\n- `DB_FILE`: Json database file name, use volume for persistence. Default: `/var/prometheus-catalog/db.json`\n- `TIME_TO_LIVE`: Registered entry expiration time in seconds. Default is 1 day\n- `FILE_SD_CONFIG`: Prometheus file-based service discovery, file can be used as is, therefore it can be mounted directly to Prometheus container. File is rewritten on every API change. Default: `/var/prometheus-catalog/file_sd_config.json`\n\n\n## API\n\n### Register\n\nExample for registering:\n\n    curl -d'{\"labels\":{\"job\":\"nodes\"},\"targets\":[\"node.some-domain.com:9100\"],\"hostname\":\"some-domain.com\"}' -H'Content-Type: application/json' http://127.0.0.1:5000/register\n\nIf the metrics route is not \"/metrics\", but something else:\n\n    curl -d'{\"labels\":{\"job\":\"nodes\",\"__metrics_path__\":\"/some-metrics\"},\"targets\":[\"node.some-domain.com:9100\"],\"hostname\":\"some-domain.com\"}' -H'Content-Type: application/json' http://127.0.0.1:5000/register\n\nThe subsequent registrations with same `hostname`, will update/add `labels` and/or add `targets`.\nFor removing `labels` or `targets`, you need to unregister first and then do the register again with correct values.\nAPI will return Bad Request if the entry with same `labels` and `targets` already exist, regardless of `hostname` value.\n\n### Unregister\n\n    curl -XDELETE http://127.0.0.1:5000/unregister/some-domain.com\n\n### List\n\n    curl http://127.0.0.1:5000/list\n\n### Metrics\n\n    curl http://127.0.0.1:5000/metrics\n\n### Health\n\n    curl http://127.0.0.1:5000/healthz\n\n\n## Develop\n\n    virtualenv .\n    pip install -r requirements.txt\n    bin/python app/__init__.py\n\nAPI will be available at port 5000, also note that entry expiration will not work when running without `uwsgi`\n\n\n## Links\n\n[Prometheus file-based service discovery file](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feficode%2Fprometheus-catalog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feficode%2Fprometheus-catalog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feficode%2Fprometheus-catalog/lists"}