EcoStruxure IT forum
A support forum for Data Center Operation, Data Center Expert, and EcoStruxure IT product users to share knowledge on installation, configuration, and general product use.
Posted: 2022-08-09 01:06 AM
Hi:
I need to get the name of the servers that are on a particular rack.
I got from a colleague this get request:
<ip>/api/v8.1/assets/search?q=Rack%20C2" But it only returns partial results. When I put the server name in the same request it returns the results correctly.
Any help will be greatly appreciated, Thank you
Jerry
Posted: 2022-08-10 05:12 AM
Hello Jerry
Are you trying to search for the results like in your example or do you know the specific rack id and you're trying to list the servers in that specific rack.
If searching, you can add a type qualifier to your search to list only devices of type server. In my below example I searched by a specific rack name "Rack-1" and asked for only devices of type server be returned in the output.
https://<ITA-Server>/api/v8.1/assets/search?q=Rack-1&type=server
If you use the search api call to return the actual rack id. You can use get asset by id to get a list of the assets contained in the rack using this syntax which includes the "children" parameter. In this example my rack UUID is 3672a2ce-a174-4d90-88fe-790631242cf9
https://<ITA-Server>/api/v8.1/assets/3672a2ce-a174-4d90-88fe-790631242cf9?include=children
The above command returns all devices in the rack, so its not limited to servers, but you can parse that output
Regards
Greg Sterling
Posted: 2022-08-14 03:36 AM
Thanks,
Unfortunately, it didn't work for me.
I just looped through the hosts in the end in order to find which racks they are located. Not the most efficient but it can do.
Best regards,
Jerry
Posted: 2022-08-14 03:39 AM
Thanks for your reply.,
I don't have the rights in the DC to do that.
In the end, I just loop through the hosts and got the racks that way.
Best regards,
Jerry
Create your free account or log in to subscribe to the forum - and gain access to more than 10,000+ support articles along with insights from experts and peers.