VMware Cloud Community
anth0nyncc
Contributor
Contributor

Query Virtual Center Database

Hi there,

I would like to recreate a very simple .NET web page that simply replicates the view of Virtual Machines on our Virtual infrastructure Client, but I am not sure of how to get all the data from SQLServer.

The only part I am having trouble with at the moment is how to show the status (Green, Amber and Red dots in below image) of each VM.

I have been looking in the VirtualCenter Database for this and I am not really sure what where to start. I have checked the events and alarms tables, but I am just not sure how to proceed.

I have looked at the SDK, but would prefer to write some simple SQL to query the actual VI Database.

Thanks in advance for any help/direction

Tony

Reply
0 Kudos
3 Replies
depping
Leadership
Leadership

check these pdf's, they might contain some useful info.

http://www.vmware.com/pdf/vc_dbviews_2x.pdf

http://vmprofessional.com/material/VcER_Diagram.pdf

Duncan

My virtualisation blog:

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

Reply
0 Kudos
RParker
Immortal
Immortal

For starters, the Database is the result, not the source. It's there to "capture" the data, but the VI client is a .NET app that talks directly to the VC. So if you have the SDK you need to interface with .NET not SQL database. If you notice when you shutdown the VC server it takes a few minutes for this information to update in the VC, that's because the VC is polling the ESX servers for this info, and it's dynamic, it's not sitting in the database.

The database tracks things like notes, the memory configuration, disk size, snapshots (which is all contained in the vmx file).

The Database is really just there for the machine's to keep track of which resource pool / ESX host they are in. So really ALL this info is found from within VC, and you are going to be much better off getting it via .NET API calls rather than reverse engineering / data mining from the SQL database. It's going to be cleaner and faster, because the DB updates after the fact... so there will be a second or two lag. Plus if you keep trying to get the data from the SQL statements you have to keep asking for this info many times a second..that's extremely inefficient.

Reply
0 Kudos
anth0nyncc
Contributor
Contributor

Thanks for your replies.

If the information is several seconds out of date using the database I really don't mind as this is for a small web page. Does anyone know if the information is available? The views do not seem to yeild the relevant information and I wonder whether it is something to do with checking the alarm events or something?

If I must use the API then so be it, but could someone point me in the right direction to get a SIMPLE hello world type app up and running in C#? Maybe really simple like listing VMs or something.

All the examples I can see seem to be too over the top to get moving. There is nothing just to make sure you can connect!

Reply
0 Kudos