Maintain history of daily object counts #4997

Closed
opened 2025-12-29 19:23:01 +01:00 by adam · 5 comments
Owner

Originally created by @jeremystretch on GitHub (Jun 14, 2021).

NetBox version

v2.11.6

Feature type

New functionality

Proposed functionality

Start recording the total count of each type of object in NetBox daily, and make these metrics available within the UI.

Use case

With #6590 implemented for the upcoming v3.0 release, we can easily record a daily count of all objects, to be displayed as a graph within the UI. For example, a graph showing the 90-day running history for sites, devices, prefixes, etc. on the main view could be very useful. We might also provide a more generalized view where users could select the object types in which they're interested and view a longer period.

Database changes

This will likely require a new model to store the daily counts. I imagine something simple, such as:

class ObjectsCount(models.Model):
    date = models.DateField(unique=True)
    counts = models.JSONField()

counts would be a JSON field mapping each model name (e.g. dcim.site) to an integer. Only one instance may be created per day. (An existing instance may be updated with new counts through the day if needed.)

External dependencies

No response

Originally created by @jeremystretch on GitHub (Jun 14, 2021). ### NetBox version v2.11.6 ### Feature type New functionality ### Proposed functionality Start recording the total count of each type of object in NetBox daily, and make these metrics available within the UI. ### Use case With #6590 implemented for the upcoming v3.0 release, we can easily record a daily count of all objects, to be displayed as a graph within the UI. For example, a graph showing the 90-day running history for sites, devices, prefixes, etc. on the main view could be very useful. We might also provide a more generalized view where users could select the object types in which they're interested and view a longer period. ### Database changes This will likely require a new model to store the daily counts. I imagine something simple, such as: ``` class ObjectsCount(models.Model): date = models.DateField(unique=True) counts = models.JSONField() ``` `counts` would be a JSON field mapping each model name (e.g. `dcim.site`) to an integer. Only one instance may be created per day. (An existing instance may be updated with new counts through the day if needed.) ### External dependencies _No response_
adam added the type: featurepending closurestatus: under review labels 2025-12-29 19:23:01 +01:00
adam closed this issue 2025-12-29 19:23:01 +01:00
Author
Owner

@ziggekatten commented on GitHub (Jun 14, 2021):

In my view, this is outside the scope for netbox.

We achive this today already using apache Superset, giving us a daily/weekly/monthly metric based on created date, wich is a brilliant open source solution for all kind of reporting/analytics

Focus on core features, like support for SDN would in my view be more important.

There are tons of reports/dashboards that one would like, but using an external tool to do so would be my suggestion

@ziggekatten commented on GitHub (Jun 14, 2021): In my view, this is outside the scope for netbox. We achive this today already using apache Superset, giving us a daily/weekly/monthly metric based on created date, wich is a brilliant open source solution for all kind of reporting/analytics Focus on core features, like support for SDN would in my view be more important. There are tons of reports/dashboards that one would like, but using an external tool to do so would be my suggestion
Author
Owner

@tyler-8 commented on GitHub (Jun 16, 2021):

I agree with @ziggekatten actually. This kind of functionality is useful for sure, but I'm not looking to my SoT to generate, track, and display historical metric reports. Today I'm using this great plugin https://github.com/networktocode/ntc-netbox-plugin-metrics-ext to get exactly this kind of data.

If anything, I think building that plugin's functionality in to NetBox would be a better direction and would use the existing tooling for exposing the metrics. The advantage to that route is its generating metrics in a common and open metrics format that can be consumed by any number of existing tools (prometheus itself, telegraf, etc) and stored outside of NetBox in a platform designed for precisely these kinds of metrics.

@tyler-8 commented on GitHub (Jun 16, 2021): I agree with @ziggekatten actually. This kind of functionality is useful for sure, but I'm not looking to my SoT to generate, track, and display historical metric reports. Today I'm using this great plugin https://github.com/networktocode/ntc-netbox-plugin-metrics-ext to get exactly this kind of data. If anything, I think building that plugin's functionality in to NetBox would be a better direction and would use the existing tooling for exposing the metrics. The advantage to that route is its generating metrics in a common and open metrics format that can be consumed by any number of existing tools (prometheus itself, telegraf, etc) and stored outside of NetBox in a platform designed for precisely these kinds of metrics.
Author
Owner

@jeremystretch commented on GitHub (Jun 16, 2021):

Maybe I wasn't clear in my intent. The goal here is to provide some lightweight historical metrics on basic object counts in NetBox e.g. to replace the sparse object counts on the main view. This is intended as a convenience rather than full-featured reporting. Certainly there are other ways of achieving that (including NetBox's built-in support for Prometheus metrics). However, IMO it's not acceptable to require users to install and configure an entirely separate tool simply to view some quick stats about their NetBox installation.

@jeremystretch commented on GitHub (Jun 16, 2021): Maybe I wasn't clear in my intent. The goal here is to provide some lightweight historical metrics on basic object counts in NetBox e.g. to replace the sparse object counts on the main view. This is intended as a convenience rather than full-featured reporting. Certainly there are other ways of achieving that (including NetBox's built-in support for [Prometheus metrics](https://netbox.readthedocs.io/en/stable/additional-features/prometheus-metrics/)). However, IMO it's not acceptable to require users to install and configure an entirely separate tool simply to view some quick stats about their NetBox installation.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 21, 2021):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 21, 2021): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@jeremystretch commented on GitHub (Sep 8, 2021):

Gonna bail on this idea as it doesn't seem popular, and likely isn't worth the effort.

@jeremystretch commented on GitHub (Sep 8, 2021): Gonna bail on this idea as it doesn't seem popular, and likely isn't worth the effort.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4997