Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration

Reply
Highlighted
Accepted Solution

WAPI pull number of used IPs in DHCP range

Techie
Posts: 10
4222     0
Is there a way to get the number of used IPs in a DHCP range using the WAPI? I know you can do this in PAPI with Infoblox:Smiley Very HappyHCP:Smiley Frustratedtatistics and I can grab similar information at the Shared Networks level.

TIA
Highlighted

Re: WAPI pull number of used IPs in DHCP range

Techie
Posts: 10
4223     0

 I can see that the SNMP data presents Network "ibDHCPSubnetPercentUsed" from the DHCP server but still nothing at the DHCP range level?

 

Exert:

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.136.0" = INTEGER: 11

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.138.0" = INTEGER: 19

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.139.0" = INTEGER: 20

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.140.0" = INTEGER: 7

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.141.0" = INTEGER: 0

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.142.0" = INTEGER: 47

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.144.0" = INTEGER: 13

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.145.0" = INTEGER: 13

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.146.0" = INTEGER: 2

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.147.0" = INTEGER: 2

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.148.0" = INTEGER: 2

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.149.0" = INTEGER: 2

IB-DHCPONE-MIB::ibDHCPSubnetPercentUsed."10.218.150.0" = INTEGER: 2

Highlighted

Re: WAPI pull number of used IPs in DHCP range

[ Edited ]
Moderator
Moderator
Posts: 87
4223     0

This should give you what you need. You can run it on any DHCP object. There are a number of other available _return_fields that may be of value to you as well.

 

curl -k1 -u admin:infoblox -X GET https://10.60.27./wapi/v2.5/dhcp:statistics -d _return_fields=dhcp_utilization,total_hosts,dynamic_hosts,static_hosts -d statistics_object="range/ZG5zLmRoY3BfcmFuZ2UkMS4xLjEuMTAvMS4xLjEuOTkvLy8wLw:1.1.1.10/1.1.1.99/default"
{
    "_ref": "dhcp:statistics/ZG5zLmRoY3BfcmFuZ2UkMS4xLjEuMTAvMS4xLjEuOTkvLy8wLw", 
    "dhcp_utilization": 0, 
    "dynamic_hosts": 0, 
    "static_hosts": 0, 
    "total_hosts": 90
}

 

Highlighted

Re: WAPI pull number of used IPs in DHCP range

Techie
Posts: 10
4223     0

Thanks for the reply but I get back:

 

{ "Error": "AdmConProtoError: Unknown object type (dhcp:statistics)",

  "code": "Client.Ibap.Proto",

  "text": "Unknown object type (dhcp:statistics)"

}

 

I am running 6.12.21 with wapi v1.7.5

 

I think I may have figured out a workaround by parsing the leases object output:

 

curl -kl -u nameSmiley Tonguewd -X GET 'https://ib/wapi/v1.7.5/lease?address%3E=10.3.1.11&address%3C=10.3.3.25&_return_fields%2B=binding_state'

 

 

 

Highlighted

Re: WAPI pull number of used IPs in DHCP range

Moderator
Moderator
Posts: 87
4223     0

Ah, yes. DHCP:statistics was added in 8.0 (WAPI v2.5).

Showing results for 
Search instead for 
Do you mean 

Recommended for You