Skip to main content

A Netbox plugin to export targets for Prometheus HTTP service discovery

Project description

netbox-plugin-prometheus-http-sd

License: Apache-2.0 CI PyPI

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-http-sd/targets/

Device or Virtual Machine is included only if all of the following are true:

  1. It has status active
  2. The custom field role is present and non‑empty

Metrics labels

Labels:

  • job – Prometheus job name defined in the mapping
  • __meta_netbox_name – object name
  • __meta_netbox_typedevice or vm
  • __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

netbox_plugin_prometheus_http_sd-0.3.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file netbox_plugin_prometheus_http_sd-0.3.2.tar.gz.

File metadata

File hashes

Hashes for netbox_plugin_prometheus_http_sd-0.3.2.tar.gz
Algorithm Hash digest
SHA256 db2f766fa4af6930026d778a5071732ddd4c9877f31b871a65c722ac15df200f
MD5 a5b581d7121dc2e1e98264f858913db3
BLAKE2b-256 355180a9c211a4e00d8725fa410654bed9fa816ebbb953cd5d4ff9e55940fe84

See more details on using hashes here.

File details

Details for the file netbox_plugin_prometheus_http_sd-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_plugin_prometheus_http_sd-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48c8afc5d5dd0189cbce8abf6cd1299c06850b4afbd900757e3f6159261de2d1
MD5 36a1d7a1b8add2fa4c2a89a4712bb504
BLAKE2b-256 83f55100af9aeb8572dd8ef7369f92dc02adcdc5271aa0ea90e3c44911b77596

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page