Skip to main content

netbox-more-metrics

Create custom metrics and export information from NetBox into your timeseries database.

Compatibility

NetBox Version Plugin Version
3.4 <= 3.7 0.1.X, 0.2.X
4.0 <= 4.5 0.3.X, 0.4.X
4.0 <= 4.7 0.5.X

Installing

For adding to a NetBox Docker setup see the general instructions for using netbox-docker with plugins.

Install

pip install netbox-more-metrics

or by adding to your local_requirements.txt or plugin_requirements.txt (netbox-docker):

netbox-more-metrics

Development Install

If you would like to install a version not yet published to pypi.

pip install git+https://github.com/TheDJVG/netbox-more-metrics

or by adding to your local_requirements.txt or plugin_requirements.txt (netbox-docker):

git+https://github.com/TheDJVG/netbox-more-metrics

NetBox Configuration

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py, or if you use netbox-docker, your /configuration/plugins.py file :

PLUGINS = [
    'netbox_more_metrics'
]

If you want to export the configured metrics without authentication set the plugin config export_metrics_without_auth to True. By default, normal NetBox view permissions apply.

PLUGINS_CONFIG = {
    'netbox_more_metrics' : {
        'export_metrics_without_auth': True
    }
}

Features

Custom metrics

For example, you could track the amount of active devices over time by rack and site: Example metric

  • Export Gauge, Counter, and Info Prometheus metrics from NetBox models (DCIM, IPAM, Circuits, Virtualization, Tenancy, etc.).
  • Group data by one or more model fields (metric_labels), including relational fields (site__slug, rack__name) and custom fields (custom_field_data__my_field), and rename exported labels cleanly via label_renames.
  • Export either aggregated object counts (count) or built-in utilization percentages:
    • dcim.Rack: Space utilization (get_utilization) and power utilization (get_power_utilization)
    • ipam.Prefix: IP utilization (get_utilization)
    • ipam.Aggregate: Prefix utilization (get_utilization)
  • Filter and exclude source querysets with Django ORM JSON dictionaries (filter and exclude).
  • Full NetBox 4.x integration including UI & REST API FilterSets, global search indexing, tags, custom fields, changelogs, and journals.

Filter & security validation

Every filter, exclude rule, and label path is validated on save and when collectors initialize: Example invalid filter

Sensitive authentication/credential models (such as users and auth) and ReDoS-prone regex lookups are automatically blocked from metric queries and relation traversals.

Heavy lifting is done by the database

As much as possible is aggregated directly in PostgreSQL to take advantage of model indexes and database optimizations. NULL database values are exported as the string "null".

Endpoints

  • Global endpoint: Collections with include_in_default=True are automatically registered in NetBox's global /metrics endpoint (when METRICS_ENABLED=True).
  • Per-collection & per-metric endpoints: Enabled MetricCollections (/plugins/more-metrics/collections/<id>/metrics/) and Metrics (/plugins/more-metrics/metrics/<id>/metrics/) can be scraped individually.

Development & Testing

Start the local NetBox development environment with Docker Compose:

make start

Run the automated test suite inside the NetBox container:

docker compose run --rm -e DEBUG=False netbox ./manage.py test netbox_more_metrics

To build and test against a specific NetBox 4.x version (e.g. v4.2 or v4.7):

NETBOX_VER=v4.7 docker compose build --build-arg NETBOX_VER=v4.7 netbox
NETBOX_VER=v4.7 docker compose run --rm -e DEBUG=False netbox ./manage.py test netbox_more_metrics

See docs/netbox_upgrade_strategy.md for details on CI matrix testing and maintaining compatibility with future NetBox releases.

Future ideas

  • Additional built-in utilization/capacity metrics (e.g. individual power feed capacity).

More ideas welcome!

Metadata

Release files for netbox-more-metrics 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netbox-more-metrics 0.5.1
File Size Uploaded Provenance Actions
netbox_more_metrics-0.5.1.tar.gz 54.5 kB Without provenance Details for netbox_more_metrics-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for netbox-more-metrics 0.5.1
File Interpreter ABI Platform Actions
netbox_more_metrics-0.5.1-py3-none-any.whl Python 3 none any Details for netbox_more_metrics-0.5.1-py3-none-any.whl

Total release size: 126.5 kB

Release files / netbox_more_metrics-0.5.1.tar.gz

Download URL netbox_more_metrics-0.5.1.tar.gz
Size 54.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3d7ecd9b0ccdfc36be24add1ab522e35223312caff0e93f5edba7a3eb2603e5d
BLAKE2b-256 checksum
How to use checksums
46e3957881c280e1149a34a40c194931f7cfc469e9627821722c7747f33d47d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / netbox_more_metrics-0.5.1-py3-none-any.whl

Download URL netbox_more_metrics-0.5.1-py3-none-any.whl
Size 72.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81cbbce15bf10a3711ed6a0bb04502c7c7b8c3974e101b4dfbc866797ea31a41
BLAKE2b-256 checksum
How to use checksums
c81ef33d0d15ce8096b1b28b4c91d6a568aec105bfd6f331de40dbf8531fac19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for netbox-more-metrics 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page