{"id":16756440,"url":"https://github.com/flxpeters/netbox-prometheus-sd","last_synced_at":"2025-03-21T23:31:41.042Z","repository":{"id":41876223,"uuid":"338147180","full_name":"FlxPeters/netbox-prometheus-sd","owner":"FlxPeters","description":"Service discovery for VMs, IPs and devices in Netbox","archived":false,"fork":false,"pushed_at":"2023-04-10T04:58:11.000Z","size":313,"stargazers_count":42,"open_issues_count":5,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-14T03:25:51.766Z","etag":null,"topics":["netbox","prometheus","service-discovery"],"latest_commit_sha":null,"homepage":"","language":"Python","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/FlxPeters.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}},"created_at":"2021-02-11T20:40:19.000Z","updated_at":"2024-10-06T18:56:32.000Z","dependencies_parsed_at":"2023-02-17T01:50:20.271Z","dependency_job_id":null,"html_url":"https://github.com/FlxPeters/netbox-prometheus-sd","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlxPeters%2Fnetbox-prometheus-sd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlxPeters%2Fnetbox-prometheus-sd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlxPeters%2Fnetbox-prometheus-sd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlxPeters%2Fnetbox-prometheus-sd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlxPeters","download_url":"https://codeload.github.com/FlxPeters/netbox-prometheus-sd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221820523,"owners_count":16886191,"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":["netbox","prometheus","service-discovery"],"created_at":"2024-10-13T03:25:53.983Z","updated_at":"2024-10-28T11:11:35.815Z","avatar_url":"https://github.com/FlxPeters.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Netbox Prometheus SD\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![CI](https://github.com/FlxPeters/netbox-prometheus-sd/workflows/CI/badge.svg?event=push)](https://github.com/FlxPeters/netbox-prometheus-sd/actions?query=workflow%3ACI)\n[![Dockerhub](https://img.shields.io/docker/pulls/flxpeters/prometheus-netbox-sd.svg)](https://hub.docker.com/r/flxpeters/prometheus-netbox-sd)\n\nFile based service discovery script for [Prometheus](https://prometheus.io/).\nMake virtual machines, IPs and devices managed from [Netbox](https://github.com/netbox-community/netbox) available as Prometheus targets with labels.\n\n\u003e **Deprecation** This project got obsolet since Prometheus supports HTTP based service discovery. Use https://github.com/FlxPeters/netbox-plugin-prometheus-sd as Netbox plugin to directly connect Prometheus with Netbox. I will still maintain this project based on the dependabot updates, but there will be no further feature development. \n\n## Requirement\n\n- Python \u003e= 3.7\n- [Pynetbox](https://github.com/netbox-community/pynetbox).\n\n## Config\n\nThe app is configured with env variables.\n\n```yaml\n    NETBOX_SD_URL: https://netboxdemo.com\n    NETBOX_SD_TOKEN:  72830d67beff4ae178b94d8f781842408df8069d\n    NETBOX_FILTER: \"{\\\"status\\\":\\\"active\\\",\\\"site\\\":\\\"ds9\\\"}\"\n    NETBOX_SD_FILE_PATH: /data/netbox/netbox.json\n    NETBOX_SD_LOG_LEVEL: \"DEBUG\"\n    NETBOX_SD_VERIFY_SSL: \"FALSE\"\n    NETBOX_THREADING: \"True\"\n    NETBOX_SD_LOOP_DELAY: \"60\"\n    NETBOX_SD_METRICS_PORT: \"8000\"\n    NETBOX_OBJECTS: \"vm device\" # space separated list of netbox objects to discover. Currently supported: vm, device and ip_address\n```\n\nFilters are applied as JSON which is mapped to Netbox filter criterias.  \nSee the Netbox for more Details: https://netbox.readthedocs.io/en/stable/rest-api/filtering/\n\n# Usage\n\n```\npython3 netbox-prometheus-sd.py\n```\n\nThe service discovery script requires the URL to the Netbox instance, an\nAPI token that can be generated into the user profile page of Netbox and a path\nto an output file.\n\nIn the Prometheus configuration, declare a new scrape job using the `file_sd_configs`\nservice discovery:\n\n```\n- job_name: 'netbox'\n  file_sd_configs:\n  - files:\n    - '/path/to/my/output.json'\n```\n\n## Example\n\nSee `example` directory for an example on how this service discovery.\nCurrently we use netboxdemo.com for this. This should be changed to a local Docker based Netbox stack.\n\n## Thanks \u0026 Credits\n\nThis project is based on a Script from ENIX SAS:\n* https://github.com/enix/netbox-prometheus-sd\n* https://enix.io/fr/blog/service-discovery-avec-netbox-et-prometheus/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxpeters%2Fnetbox-prometheus-sd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflxpeters%2Fnetbox-prometheus-sd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxpeters%2Fnetbox-prometheus-sd/lists"}