- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2017 08:06 AM
I need a way to seach for a host or alias name (not the FQDN just the name without the domain) across a view.
Example for teddy.foo.com I want to find all host or alias instances that have the name teddy like teddy.com or teddy.bear.com, etc.
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-08-2017 08:18 PM
You could do:
curl -k -u admin:infoblox -X GET https://192.168.0.12/wapi/v2.5/record:host?_return_fields=aliases\&name~=teddy
But, it does not allow to search for aliaes. You would need to crawl all hosts and find it programatically.
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-09-2017 05:37 AM
Crawling hosts could take a lot of time.
Is there a way to search a view for any entity with a specific name or a way to configure some sort of rule in Infoblox to force names to be unique? What we're trying to avoid are instances where a name in one domain points at a different service than the same name in another domain.
Re: Finding instances of a hostname in a view with WAPI
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
05-30-2017 11:57 AM - edited 05-30-2017 12:01 PM
> Crawling hosts could take a lot of time.
To go through all host and find aliases, you coudl do the following (perl). And should be fairly quick:
use REST::Client;
use JSON;
...
$client->GET("wapi/v2.0/record:host?_return_fields=dns_aliases,name"); if ( ($client->responseCode() eq 200) || ($client->responseCode() eq 201) ) { my $json = from_json($client->responseContent()); foreach my $item( @$json ) { print "$item->{name}\n"; my $aliases = $item->{dns_aliases}; if (defined $aliases ) { foreach my $alias( @$aliases ) { print " -> $alias\n"; } } } }
Output:
test4.test.net
-> alias03.test.net
test40.test.net
-> alias01.test.net
-> alias02.test.net
> Is there a way to search a view for any entity with a specific name or a way to configure some sort of rule in
> Infoblox to force names to be unique? What we're trying to avoid are instances where a name in one domain
> points at a different service than the same name in another domain.
Hostnames are unique by for a domain, if 'Enable for DNS = true'. But Hostnames can not be globally unique.
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-07-2017 08:22 AM
Thanks for the help. I tried the suggestion and get the error 'AdmConProtoError: Result set too large (> 1000)'
We're currently using QIP and I can run
qip-search -o <organization> -n <hostname>
and
qip-search -o <organization> -t "Resource Record" -n <hostname>
Then search the responses for a host name match all in seconds.
Could I replicate that functionality in Infoblox?
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-07-2017 10:32 PM
The script will already search the whole database. Infoblox does not have a concept of Orgs, as QIP.
You just need to allow to return more results using _max_results:
$client->GET("wapi/v2.0/record:host?_return_fields=dns_aliases,name&_max_results=20000");
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-2017 05:47 AM
I see.
Is thre a way to limit the search results to a specfic host hostname or alias hostname?
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-2017 06:10 AM
Add
name=<string> //straight search
or name~=<string> // Regex
$client->GET("wapi/v2.0/record:host?_return_fields=dns_aliases,name&name=host01.test.net");
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-08-2017 06:58 AM
So I should be able to tell if a hostname is in use by a host by:
$client->GET("wapi/v2.0/record:host?_return_fields=dns_aliases,name&_max_results=1&name~=^<hostname>\\.");
How would I do the same thing to determine if a hostname is in use by an alias?
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-18-2017 11:09 AM
I think you would need to do that programmatically with a script.
Re: Finding instances of a hostname in a view with WAPI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-19-2017 12:57 PM
OK. I bumped up the _max_results value to 10000000 and get back 1091405 hosts.
The runtime in our stage environment is 1083 seconds so not exactly quick.