A Netbox plugin to provide Netbox entires to Prometheus HTTP service discovery
Project description
netbox-plugin-prometheus-sd
Provide Prometheus http_sd compatible API Endpoint with data from Netbox.
HTTP SD is a new feature in Prometheus 2.28.0 that allows hosts to be found via a URL instead of just files. This plugin implements API endpoints in Netbox to make devices, IPs and virtual machines available to Prometheus.
Installation
The plugin is available as a Python package in pypi and can be installed with pip
pip install netbox-plugin-prometheus-sd
Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:
PLUGINS = ['netbox_prometheus_sd']
The plugin has not further plugin configuration at the moment.
Usage
The plugin only provides a new API endpoint on the Netbox API. There is no further action required after installation.
API
The plugin reuses Netbox API view sets with new serializers for Prometheus. This means that all filters that can be used on the Netbox api can also be used to filter Prometheus targets.
GET /api/plugins/prometheus-sd/devices/ Get a list of devices in a prometheus compatible format
GET /api/plugins/prometheus-sd/virtual-machines/ Get a list of vms in a prometheus compatible format
GET /api/plugins/prometheus-sd/ip-addresses/ Get a list of ip in a prometheus compatible format
The plugin also reuses the Netbox authentication and permission model. Depending on the configuration, a token must be passed to Netbox for authentication.
Development
We use Poetry for dependency management and invoke as task runner. As Netbox plugins cannot be tested standalone, we need invoke to start all code embedded in Netbox Docker containers.
All code to run in docker is located under development which is also the starting point for VScode remote containers (not finished yet).
To start a virtual env managed by poetry run poetry shell.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file netbox-plugin-prometheus-sd-0.1.0.tar.gz.
File metadata
- Download URL: netbox-plugin-prometheus-sd-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.8.0-1042-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45aa6cac6eeac5d3b559e1a6e4ac9fe1fe43be16a526e03ff533a2279da0231e
|
|
| MD5 |
f270692e34e8fe26bab631d7cb12aa25
|
|
| BLAKE2b-256 |
7d737e1bec3dc5c3325efe94d8440ef41889f786a962d902d51635f5cb187237
|
File details
Details for the file netbox_plugin_prometheus_sd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netbox_plugin_prometheus_sd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.8.0-1042-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12678ea8cb7cf4c9ef5c447910b37cff6e98b06f250df6a4a2249bab3ae8ff79
|
|
| MD5 |
01f24c0bd45f24acee788e1a2ad3d7aa
|
|
| BLAKE2b-256 |
332734e8fad9f857d561d8ae3ac59e45e8d3931454f26a3856e3d722216e63c3
|