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, 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:
- 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 vialabel_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 (
filterandexclude). - 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:
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=Trueare automatically registered in NetBox's global/metricsendpoint (whenMETRICS_ENABLED=True). - Per-collection & per-metric endpoints: Enabled
MetricCollections (/plugins/more-metrics/collections/<id>/metrics/) andMetrics (/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 netbox ./manage.py test netbox_more_metrics
To build and test against a specific NetBox 4.x version (e.g. v4.2 or v4.5):
NETBOX_VER=v4.5 docker compose build --build-arg NETBOX_VER=v4.5 netbox
NETBOX_VER=v4.5 docker compose run --rm 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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| netbox_more_metrics-0.5.0.tar.gz | 54.0 kB | Without provenance | Details for netbox_more_metrics-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| netbox_more_metrics-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for netbox_more_metrics-0.5.0-py3-none-any.whl |
Total release size: 125.7 kB
Release files / netbox_more_metrics-0.5.0.tar.gz
| Download URL | netbox_more_metrics-0.5.0.tar.gz |
|---|---|
| Size | 54.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cba6c98b552f56c5fed0a2d1322467d62009552b1cf442747304453fad728fb7
|
|
BLAKE2b-256 checksum How to use checksums |
a595c63b70a6e6ff94be069d3902c906f88b45cff089b2637ce271d40e4fc867
|
| 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.0-py3-none-any.whl
| Download URL | netbox_more_metrics-0.5.0-py3-none-any.whl |
|---|---|
| Size | 71.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b27c7d54ce1e510aa99803e71e44c86b4d688c212be55b61610f9d37e6cc7b7d
|
|
BLAKE2b-256 checksum How to use checksums |
3c252c2f0f9185370aaad9fbb5b377d9b7e410744bf13ff2112884710e9fe8a2
|
| 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.0
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.