Start a Conversation

Unsolved

This post is more than 5 years old

3089

October 12th, 2017 12:00

ViPR SRM REST API Query - VMware Information

I'm working with the northbound REST API for ViPR SRM 4.1u1.  We have SRM integrated into our VMware environment, so in the ViPR SRM web interface I am able to see all of our ESX hypervisor hosts as well as our VM's.

I am trying to write a query for the REST API that will start by returning all configuration information for a particular ESX host.

Suppose I want to query the properties values for a VMware ESX host named server01:

curl -H "Authorization: Basic " " http://server.foo.com:58080/APG-REST/metrics/properties/values?fields=device,name,product,nbcpu,datastor_filter&filter=devtype%3D%27Hypervisor%27%26name%3D%27server01%25%27%26name%3D%27PropertiesOnly%27"|python -m json.tool

this query returns:

{

    "values": []

}

I do see server01 in my SRM web UI.

Is it possible to get this data out of the API in the first place, or is my query simply incorrect?

Thanks.

141 Posts

October 13th, 2017 05:00

Hi mlcooper7,

Try removing the double quotes around the url so that the query look like this:


curl -H "Authorization: Basic " http://server.foo.com:58080/APG-REST/metrics/properties/values?fields=device,name,product,nbcpu,datastor_filter&filter=devtype%3D%27Hypervisor%27%26name%3D%27server01%25%27%26name%3D%27PropertiesOnly%27 |python -m json.tool

regards,

Isaka

3 Posts

October 16th, 2017 11:00

Isaka 

Thanks for the information on the quotes, it did help.

 

I have a query, below, that gets me information filtered on a physical VMware host name, and this query does return properly formatted JSON, but I actually have to have the quotes in place or else the filter does not work at all and the query returns FAR too much information unrelated to my filter.

 

curl -s -H "Authorization: Basic " " http:// :58080/APG-REST/metrics/properties/values?fields=device,name,ip,hypervsr,status,model,_filter&filter=device%3D%27server.foo.com%27"|python -m json.tool

 

server.foo.com in the query above is a physical VMware host.  We do have our VMware environment integrated into ViPR SRM, but I am unable to have a query return anything about any VM.

 

If I use the same query as above, which works fine for physical hosts, and input a device name of a VM, the data I get back is this, which is no data at all:

{

    "values": []

}

 

I do see my VM's in the web UI of ViPR SRM.  Is VM level information available via this API?  Is there something wrong with my query for getting VM level information?

 

Thank you!

141 Posts

October 17th, 2017 06:00

Hi mlcooper7,

Remove the model property from the query, the API doesnt restrict any data...however it fails to retrieve data if one of the requested properties doesnt exist.

I will submit an enhancement request to engineering to see if we can return a clear error instead of

{

    "values": []

}

regards,

Isaka

No Events found!

Top