DNS Records from Infoblox. How to get total DNS records from Infoblox

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 05:14 AM
Hi Experts,
We are working on discovery DNS records from Infoblox by following the REST API documentation provided by Infoblox. One of the issue we have is finding out total number of DNS records available inside Infoblox. If we can get the total number, we can limit the number of queries we make to Infoblox. Does anyone work on getting DNS records from Infoblox and if so how did you achieve in getting total count?
This is the initial call made to Infoblox to get first 1000 records and from the result we get next page id to make subsequent calls.
1st call: https://{{grid_master}}/wapi/v2.7/record:host?_max_results=1000&_paging=1&_return_as_object=1
Subsequent calls: https://{{grid_master}}/wapi/v2.7/record:host?_max_results=1000&_paging=1&_return_as_object=1&_page_id=" + next_page_id
Without total number of records we are unable to limit the number of calls we make to Infoblox endpoint.
Thanks,
Sandeep
- Labels:
-
Discovery
-
Orchestration (ITOM)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 06:53 AM
I had faced this issue. 12k dns records had to be fetched and could increase also dynamically
So i don't know what to do so did this as i don't know much about infoblox APIs.
while(next_page_id) // checks untill next_page_id is empty
{
for(i=1;i<=2000;i++)
{
call the rest api .created the records.
}
}
This is not a good suggestion but worked. I had this job run on weekends on off business hours .
Maybe you can ask the Infoblox team to add a row/field maybe to get total count on their side.
Then that row can be fetched via API.
I hardly say they will agree on it. Infoblox do support metric dashboard which can show total number of dns record.
Hope its helps.
Mark answer if its helpful
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2022 08:16 AM
Here's something for exporting all the zones in external view
GM="ipam.xxx.com"
FIELDS="fqdn,ns_group"
MAXRESULTS="1000"
WAPI="wapi/v2.10"
OUTPUT="zone_auth.json"
VIEW="External"
read PAGEID RESULT < <(echo $(curl -sk -n -X GET https://$GM/$WAPI/zone_auth?view=$VIEW\&_return_fields=$FIELDS\&_paging=1\&_max_results=$MAXRESULTS\&_return_as_object=1 | jq -r '.next_page_id, .result'))
echo $RESULT | jq . > $OUTPUT
while [ -n "$PAGEID" ]; do
read PAGEID RESULT < <(echo $(curl -sk -n -X GET https://$GM/$WAPI/zone_auth?_page_id=$PAGEID | jq -r '.next_page_id, .result'))
echo $RESULT | jq . >> $OUTPUT
if [ "$PAGEID" == "null" ]; then
PAGEID=""
fi
done