VMware Cloud Community
slooser
Contributor
Contributor
Jump to solution

How to fetch runtime information from vcenter database directly?

Hi,

In my project I am planning to access the VIM_VCDB database directly through a remote sql connection to SQLEXP_VIM instance to fetch all VM related information from vCenter server. While I am getting most of the information from VPX_VM/VPX_ENTITY tables using simple SQL queries, I am not able to understand how to get vmware runtime/performance informations.

For example I want to fetch all the properties value as provided by "VirtualMachineQuickStats" and "VirtualMachineRuntimeInfo" Data object as in vc sdk.

Which table or Store Procedure or View can provide me these value?

Also I want to fetch performance data for CPU/Memory lets say for last one hour.

Is there any way to get them directly from the database by running SQL queries instead of using vc sdk API.

Thanks in Advance,

ssen

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RParker
Immortal
Immortal
Jump to solution

Performance data is not kept in the database.. the history is, but you want realtime.

You have to use the API not the database. Download the API SDK, requires visual studio or C++

View solution in original post

0 Kudos
6 Replies
slooser
Contributor
Contributor
Jump to solution

Hi all...

I am stuck with this for sometime. Any help is highly appreciated.

Thanks very much

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

I don't believe anyone has published the schema for vSphere vCenter 4.0, I know back in the day for vCenter 2.5, there was one floating around the net.

This is definitely not recommended and doubt you'll find much support from VMware. Is there any reason you need to hit the database directly? One wrong SQL query and you can halt your system or create some infinite query, why chance that?

Everything that you could ever want to retrieve is available using the vSphere API and the available SDK's to retrieve this information. The only other thing I could even think of, which isn't even worth it in my mind is to retrieve the actual creation date of a VM, this is something that may not be in the API depending on the amount of historical data you're archiving.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

slooser
Contributor
Contributor
Jump to solution

Hi,

Thanks very much for the reply.

The reason for accessing the database directly is for possible performance imporvement. I already have an equivalent vsphere api implementation to get the informations I mentioned. But setting up a vCenter connection from application to the server and fetching data through API seems to be taking a bit long time.

So I think accessing database directly (bypassing all vcenter api overhead) may give better performance. I believe internally in performance API calls vcenter also access the runtime informations from its database. So just hoping it should be possible for a thirdparty application to do the same possibly.

Thanks

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

If you're developing 3rd party application, I would get a hold of VMware partner channel and perhaps they can provide you with the full schema details. Unless someone here in the community fully documented and explained what every single table means/etc. you probably won't get much more info.

I've written some stuff against the old vCenter 2.5 and most of the tables are pretty trivial to understand and using a tool like dbvisualizer, helped me poke around and figure the relationships. Again, if you know what you're doing and where things are at and query using the most effective SQL statements, go for it, but note that you CAN impact performance on your vCenter as there are jobs that run to roll up stats/etc. so if you're doing anything funky while some of those jobs try to run, you may see some unexpected results.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

RParker
Immortal
Immortal
Jump to solution

Performance data is not kept in the database.. the history is, but you want realtime.

You have to use the API not the database. Download the API SDK, requires visual studio or C++

0 Kudos
slooser
Contributor
Contributor
Jump to solution

Hi, Thanks for the reply.

Well Actually I have to fetch history data also. For example lets say I want to retrive the last one hour CPU usage data in some specified interval 300 secs may be.

In that case do I have any way to get it directly from database?

0 Kudos