VMware Cloud Community
KimSchneider
Contributor
Contributor
Jump to solution

monitoring virtual servers via API

Hi,

I'm trying to monitor some easy stuff using the vmware API.

By using the samples' RealTime project I can get some values regarding the cpu, but I don't know what to do with these values.

If I pick number two of the options ("CPU usage in percent during interval") I get a value of 2663. Divided by 20 (qSpec.intervalId= 20) this is way more than the cpu usage of the vSphere Client shows.

Can anyone tell me, what to do with this value?

Maybe I just didn't find the right documentation, but at the moment the vmware API is a huge "?" to me.

Is there any easy example or tutorial about how to use the API to monitor hardware information of each virtual server?

Thanks

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

The color is actually returned back as a state from the API, so you can take the string and color coat whatever report/etc. you want. Again, you'll want to further familiarize yourself by looking at the API reference to see what is being returned and you should also take a look at browsing the MOB which gives you a view into all the objects within vCenter or ESX(i) via web browser. All this is found in the getting started docs, so read up! Smiley Happy

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

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 Comuunity

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

View solution in original post

0 Kudos
6 Replies
KimSchneider
Contributor
Contributor
Jump to solution

Alright, just found out that I've got to devide the result by 100 ompf

But anyways, I still don't know how the get information about discs and ram.

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Please take a look at this thread reply:

Here's a script that extracts some of the hardware information from the hosts:

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

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 Comuunity

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

KimSchneider
Contributor
Contributor
Jump to solution

Alright, thank you. I'm starting to become acquainted with the API

How about the status GREEN, does it change to yellow automatically or do I have to define an alert or somethin first?

0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

The color is actually returned back as a state from the API, so you can take the string and color coat whatever report/etc. you want. Again, you'll want to further familiarize yourself by looking at the API reference to see what is being returned and you should also take a look at browsing the MOB which gives you a view into all the objects within vCenter or ESX(i) via web browser. All this is found in the getting started docs, so read up! Smiley Happy

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

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 Comuunity

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

0 Kudos
KimSchneider
Contributor
Contributor
Jump to solution

Alright, thanks a lot for your help.

I've started reading the getting started docs and used the mob, too. But I'm not that familiar with vsphere or esx at all, 'cause I'm "just" the programmer Smiley Happy

But figured out a couple of things by taking a look at the C# samples.

0 Kudos
KimSchneider
Contributor
Contributor
Jump to solution

After working with the performance counters, I've got some issues.

I'm requesting the ram performance counter (nr 16) which returns the usage of the vm or host in percent. I do this every minute.

Sometimes I don't get a value, just the exception"Data for selected counter is not available." This happens up to 5 times in a row.

Doesn't seem to be a load problem, 'cause it started at night and ram usage is always about 10 %

Does anyone know why this happens?

0 Kudos