{"id":19339481,"url":"https://github.com/code-tool/inventor","last_synced_at":"2026-04-27T09:02:33.805Z","repository":{"id":246807050,"uuid":"823490168","full_name":"code-tool/inventor","owner":"code-tool","description":"Prometheus HTTP SD implementation","archived":false,"fork":false,"pushed_at":"2024-10-04T12:23:51.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T14:46:43.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-tool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-03T06:16:32.000Z","updated_at":"2024-10-04T12:23:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"eb8dd7d1-0068-4420-9c80-86d1e49cf76f","html_url":"https://github.com/code-tool/inventor","commit_stats":null,"previous_names":["code-tool/inventor"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-tool%2Finventor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-tool%2Finventor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-tool%2Finventor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-tool%2Finventor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-tool","download_url":"https://codeload.github.com/code-tool/inventor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240442507,"owners_count":19801912,"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-10T03:22:23.946Z","updated_at":"2026-04-27T09:02:33.773Z","avatar_url":"https://github.com/code-tool.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# inventor\n\nPrometheus HTTP SD implementation\n\n## Description\n\nThe Inventor is a Prometheus HTTP SD Server allows users to dynamcially add or remove prometheus targets and labels and expose it to a [Prometheus HTTP SD](https://prometheus.io/docs/prometheus/latest/http_sd/) job.\n\n## Usage\n\nRunning the server:\n```\ncd src\ngo run main.go\n```\n\nInstalling with Helm\n```bash\nhelm repo add inventor https://code-tool.github.io/inventor/\n```\n\nRegistering new target:\n```bash\ncurl -X PUT -H \"x-api-token: secret\" http://127.0.0.1:9101/target \\\n-d '{\"static_config\": {\"targets\": [\"10.0.10.2:9100\",], \"labels\": {\"__meta_datacenter\": \"dc-01\", \"__meta_prometheus_job\": \"node\"}, \"target_group\": \"mygroup\"}}'\n```\n\nMore examples: `./test/end-to-end`\n\nPrometheus SD config example\n```yaml\nscrape_configs:\n  - job_name: http_sd\n    http_sd_configs:\n      - url: http://127.0.0.1:9101/discover\n        # if SD_TOKEN env variable is set\n        headers:\n          - \"x-sd-token: REDACTED\"\n\n```\n\nPrometheus SD config with groups example\n```yaml\nscrape_configs:\n  - job_name: http_sd_mygroup\n    http_sd_configs:\n      - url: http://127.0.0.1:9101/group?name=mygroup\n        # if SD_TOKEN env variable is set\n        headers:\n          - \"x-sd-token: REDACTED\"\n\n```\n\n\n## Configuration Environmet Valiables\n\n  * `REDIS_ADDR`: redis server addres to store metrics and targets\n  * `REDIS_PORT`: redis server port\n  * `REDIS_DBNO`: redis server keyspace\n  * `TTL_SECONDS`: ttl for storing target, default is 6h (21600 seconds)\n  * `API_TOKEN`: API token for manipulating targets\n  * `SD_TOKEN`: Options token for Prometheus HTTP SD, is empty by default and not validating (header `x-sd-token`)\n\n\n## Custom discovered labels\n\n  * `__meta_inventor_sd_module`: contains element of `modules: []`, useful for relabeling to add `__param_module`\n\nData file with modules for [exporter_exporter](https://github.com/QubitProducts/exporter_exporter) example:\n```json\n{\n  \"static_config\": {\n  \"targets\": [\"host.local:9999\"],\n  \"labels\": {\n    \"__inventor_sd_metrics_path\": \"/proxy\",\n    \"__inventor_sd_job\": \"inventor-exporter-proxy\",\n    \"datacenter\": \"the-dc\"\n  },\n  \"modules\": [\"node_exporter\",\"ipmi_exporter\"],\n  \"target_group\": \"inventor-default\"\n  }\n}\n```\n\nPrometheus SD config with\n[relabel_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) example\n```yaml\nscrape_configs:\n  - job_name: http_sd_mygroup\n    http_sd_configs:\n      - url: http://127.0.0.1:9101/discover\n        # if SD_TOKEN env variable is set\n        headers:\n          - \"x-sd-token: REDACTED\"\n    relabel_configs:\n      # discovered label\n      - source_labels: [ __meta_inventor_sd_module ]\n        target_label: __param_module\n      # labels from data file\n      - source_labels: [ __inventor_sd_metrics_path ]\n        target_label: __metrics_path__\n      - source_labels: [ __inventor_sd_job ]\n        target_label: job\n```\n\nThis produces scrape jobs with `module` parameter:\n```\nhttp://host.local:9999/proxy\u0026module=node_exporter\nhttp://host.local:9999/proxy\u0026module=ipmi_exporter\n```\n\n## API Methods\n\n* **GET /discover**\n    * Returning the list of targets in Prometheus HTTP SD format\n* **GET /group**\n    * Returning targets by group name `/group?name=mygroup`\n* **PUT /target**\n    * Adds the new target\n* **GET /target**\n    * Returning target by ID\n* **DELETE /target**\n    * Removing target by ID\n* **GET /metrics**\n    * Metrics in prometheus format\n* **GET /healthcheck**\n    * Health Check for kubernetes deployments\n\n\n## Build Docker image\n```bash\ndocker build -t ghcr.io/code-tool/inventor/inventor:$(cat VERSION.txt) --build-arg BUILD_VERSION=$(cat VERSION.txt) -f docker/Dockerfile .\n```\npulling image:\n```bash\nghcr.io/code-tool/inventor/inventor:0.3.0\n```\n\n## License\n\nCovered under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-tool%2Finventor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-tool%2Finventor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-tool%2Finventor/lists"}