A Netbox plugin to export targets for Prometheus HTTP service discovery
Project description
netbox-plugin-prometheus-http-sd
Demo
docker-compose up -d
docker exec netbox-plugin-prometheus-http-sd-netbox-1 /opt/netbox/netbox/manage.py load_initializer_data --path /etc/netbox/initializer-data
Login into Netbox (http://localhost:8080) and create Config Context named prometheus_role_map with the following JSON structure:
{
"prometheus_exporters": {
"default": [
{
"job": "node-exporter",
"port": 9100
}
],
"etcd": [
{
"job": "node-exporter",
"port": 9100
},
{
"job": "etcd-exporter",
"port": 2379
}
],
"postgresql": [
{
"job": "node-exporter",
"port": 9100
},
{
"job": "postgresql-exporter",
"port": 9187
}
],
"vault": [
{
"job": "vault-exporter",
"scheme": "https",
"metrics_path": "/v1/sys/metrics",
"params": {
"format": [
"prometheus"
]
},
"port": 8200
}
]
}
}
Each role can have multiple jobs (one target per job is generated)
If role is not found, the default entry is used
Usage
The plugin exposes a single API endpoint (no web UI):
GET /api/plugins/prometheus-sd/targets/
Device or Virtual Machine is included only if all of the following are true:
- It has status
active - The custom field
roleis present and non‑empty
Metrics labels
Labels:
job– Prometheus job name defined in the mapping__meta_netbox_name– object name__meta_netbox_type–deviceorvm__meta_netbox_cf_<custom_field>– every custom field prefixed with__meta_netbox_cf_
Project details
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_http_sd-0.1.0.tar.gz.
File metadata
- Download URL: netbox_plugin_prometheus_http_sd-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
145fca781b0fd0795f7b94a9f3cd7f341b1187ed885439674a2bd2047f05348c
|
|
| MD5 |
f1721be95a709327fba2958d4621ca7e
|
|
| BLAKE2b-256 |
6622bc9aa44a0196823eeb94953298cdc789295b6f09089fb1c651a11d2f87e4
|
File details
Details for the file netbox_plugin_prometheus_http_sd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: netbox_plugin_prometheus_http_sd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b88c59223d82d9ca2177f53f9af4dfc7ea8c72f948038ec5e6e700de3ce89c43
|
|
| MD5 |
b31dbf7af1ca2ab3423fdde6783c50bc
|
|
| BLAKE2b-256 |
b10fb4ac1f79991a0c894c8dfdd1cb7b69174514bbe0766995b48cdebd107395
|