Add a way of determining prefix percent utilization to the API #7175

Closed
opened 2025-12-29 20:20:10 +01:00 by adam · 2 comments
Owner

Originally created by @ajm5774 on GitHub (Oct 27, 2022).

NetBox version

v3.3.6

Feature type

New functionality

Proposed functionality

Add way of determining prefix percent utilization to the API. The percent utilization is shown through the UI but it not accessible through the API. Currently there is no easy way of determining the percent utilization because we are lacking:

  1. The prefix capacity. This can be estimated with 2**(32-netmask_length) - 2 but this rarely aligns with the values that are shown through the UI.
  2. A way of getting the total number of available or unavailable IPs for a prefix. The UI has an endpoint for seeing the IPs associated with a prefix, but not the API. The Closest thing is to use an endpoint like the following https://demo.netbox.dev/api/ipam/ip-addresses/?parent=172.16.0.0/16 but this rarely aligns with what is shown through the UI. As for the number of available IPs see this ticket.

My proposal to accomplish this ask:

  1. Add prefix capacity to the prefix API object (https://demo.netbox.dev/api/ipam/prefixes/75/)
  2. Address issue 10777

It may also be beneficial to have an endpoint for listing IPs associated with a prefix for other use cases (something like https://demo.netbox.dev/api/ipam/prefixes/75/ip-addresses), so along with being able to list all available IPs we could at least calculate the prefix capacity on our own.

Use case

We do alerting on prefixes that have a utilization over a certain percent so that we know when we are getting low on IP addresses. We use percent utilization because the number of available IPs we want to alert on is different depending on the size of the prefix and the rate at which IPs are assigned is generally proportional to the size of the prefix.

Company: Datto, a Kaseya Company

Database changes

No response

External dependencies

No response

Originally created by @ajm5774 on GitHub (Oct 27, 2022). ### NetBox version v3.3.6 ### Feature type New functionality ### Proposed functionality Add way of determining prefix percent utilization to the API. The percent utilization is shown through the UI but it not accessible through the API. Currently there is no easy way of determining the percent utilization because we are lacking: 1. The prefix capacity. This can be estimated with 2**(32-netmask_length) - 2 but this rarely aligns with the values that are shown through the UI. 2. A way of getting the total number of available or unavailable IPs for a prefix. The UI has an endpoint for seeing the IPs associated with a prefix, but not the API. The Closest thing is to use an endpoint like the following https://demo.netbox.dev/api/ipam/ip-addresses/?parent=172.16.0.0/16 but this rarely aligns with what is shown through the UI. As for the number of available IPs see [this ticket](https://github.com/netbox-community/netbox/issues/10777). My proposal to accomplish this ask: 1. Add prefix capacity to the prefix API object (https://demo.netbox.dev/api/ipam/prefixes/75/) 2. Address [issue 10777](https://github.com/netbox-community/netbox/issues/10777) It may also be beneficial to have an endpoint for listing IPs associated with a prefix for other use cases (something like https://demo.netbox.dev/api/ipam/prefixes/75/ip-addresses), so along with being able to list all available IPs we could at least calculate the prefix capacity on our own. ### Use case We do alerting on prefixes that have a utilization over a certain percent so that we know when we are getting low on IP addresses. We use percent utilization because the number of available IPs we want to alert on is different depending on the size of the prefix and the rate at which IPs are assigned is generally proportional to the size of the prefix. Company: Datto, a Kaseya Company ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: duplicate labels 2025-12-29 20:20:10 +01:00
adam closed this issue 2025-12-29 20:20:11 +01:00
Author
Owner

@PieterL75 commented on GitHub (Nov 14, 2022):

See #6606 and #7292 and #9649

@PieterL75 commented on GitHub (Nov 14, 2022): See #6606 and #7292 and #9649
Author
Owner

@jeremystretch commented on GitHub (Jan 5, 2023):

Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #9649 for further discussion.

@jeremystretch commented on GitHub (Jan 5, 2023): Thank you for submitting this issue, however it appears that this topic has already been raised. Please see issue #9649 for further discussion.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7175