VMware Cloud Community
raoulst
Contributor
Contributor
Jump to solution

Statistical data via command line

Hi,

is there any way to get specific statistical data from he command line like one can get it in the GUI?

e.g. if I want to get the average "memory granted" from June. 20th 2008 10:00:00 till June 21st 2008 10:00:00.

raoulst

Reply
0 Kudos
1 Solution

Accepted Solutions
kjb007
Immortal
Immortal
Jump to solution

Yes, this works for me. What version of the powershell toolkit are you using? My output is at the below.

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-VIToolkitVersion

VI Toolkit Version

-


VMware VI Toolkit for Windows 1.0 (Beta) build 81531

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-ResourcePool ResPool0 |get-stat

MetricId Timestamp Value Unit

-


-


-


-


cpu.usagemhz.average 4/21/2008 6:00:00 PM 48 MHz

cpu.usagemhz.average 4/21/2008 5:30:00 PM 48 MHz

cpu.usagemhz.average 4/21/2008 5:00:00 PM 54 MHz

cpu.usagemhz.average 4/21/2008 4:30:00 PM 62 MHz

cpu.usagemhz.average 4/21/2008 4:00:00 PM 62 MHz

cpu.usagemhz.average 4/21/2008 3:30:00 PM 79 MHz

cpu.usagemhz.average 4/21/2008 3:00:00 PM 69 MHz

cpu.usagemhz.average 4/21/2008 2:30:00 PM 60 MHz

cpu.usagemhz.average 4/21/2008 2:00:00 PM 66 MHz

cpu.usagemhz.average 4/21/2008 1:30:00 PM 65 MHz

mem.usage.average 4/21/2008 6:00:00 PM 1.94 %

mem.usage.average 4/21/2008 5:30:00 PM 1.54 %

mem.usage.average 4/21/2008 5:00:00 PM 1.55 %

mem.usage.average 4/21/2008 4:30:00 PM 2.46 %

mem.usage.average 4/21/2008 4:00:00 PM 2.53 %

mem.usage.average 4/21/2008 3:30:00 PM 2.53 %

mem.usage.average 4/21/2008 3:00:00 PM 3.43 %

mem.usage.average 4/21/2008 2:30:00 PM 2.87 %

mem.usage.average 4/21/2008 2:00:00 PM 2.56 %

mem.usage.average 4/21/2008 1:30:00 PM 2 %

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-ResourcePool ResPool0 |get-stat -stat mem.granted.average

MetricId Timestamp Value Unit

-


-


-


-


mem.granted.average 4/21/2008 6:00:00 PM 896733 KB

mem.granted.average 4/21/2008 5:30:00 PM 896372 KB

mem.granted.average 4/21/2008 5:00:00 PM 888362 KB

mem.granted.average 4/21/2008 4:30:00 PM 858295 KB

mem.granted.average 4/21/2008 4:00:00 PM 834003 KB

mem.granted.average 4/21/2008 3:30:00 PM 694446 KB

mem.granted.average 4/21/2008 3:00:00 PM 878103 KB

mem.granted.average 4/21/2008 2:30:00 PM 867361 KB

mem.granted.average 4/21/2008 2:00:00 PM 788245 KB

mem.granted.average 4/21/2008 1:30:00 PM 750173 KB

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB

View solution in original post

Reply
0 Kudos
21 Replies
demz
Expert
Expert
Jump to solution

No, the performance graph are stored on the VC DB, not on the Service Console.

If you want to record statistic performance on an ESX, you can record esxtop activity via vm-support -S and replay it later

Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

I should have been more specific. I meant the Windows command line on a Virtual Center server.

Since there is a way to use Power Shell to get Information out of Virtual Center and one could I do SQL statements, I thought, that someone might know how to get the same values you can get via the Virtual Infrastructure Client GUI.

regards, raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Yes, you can get the same type of data that powershell provides using sql, but why not use powershell to get it for you? You can feed powershell the start and finish times that fit the range you want to report on, and you won't have to figure your way through multiple tables. There are stats tables that you can get the data from, if you really want to talk straight to the vc db also.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

Powershell would be fine. I just have no idea how to use it to get statistical data (yet)

raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Enjoy !

Example:

get-vm vmhost_to_stat |get-stat -stat

For mem granted:

get-vm vmhost_to_stat |get-stat -stat mem.granted.average

With date:

get-vm vmhost_to_stat |get-stat -stat mem.granted.average -start ( "4/18/2008") -finish ( "4/20/2008" )

FORUM SOFTWARE STRIKES AGAIN, THE datetime BIT IS ENCLOSED IN SQUARE BRACKETS

-KjB

Message was edited by: kjb007 : Added info

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
raoulst
Contributor
Contributor
Jump to solution

Hi KjB,

thank's a lot! That's very close to what I've been looking for.

What I need is statistical data for ResourcePools.

I tried

Get-ResourcePool Resource-Pool_to_stat | get-stat

but I only get

---

A specified parameter was not correct.

metricId

At line:1 char:31

---

Do you know, if getting ResourcePool statistical data is possible?

raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Yes, this works for me. What version of the powershell toolkit are you using? My output is at the below.

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-VIToolkitVersion

VI Toolkit Version

-


VMware VI Toolkit for Windows 1.0 (Beta) build 81531

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-ResourcePool ResPool0 |get-stat

MetricId Timestamp Value Unit

-


-


-


-


cpu.usagemhz.average 4/21/2008 6:00:00 PM 48 MHz

cpu.usagemhz.average 4/21/2008 5:30:00 PM 48 MHz

cpu.usagemhz.average 4/21/2008 5:00:00 PM 54 MHz

cpu.usagemhz.average 4/21/2008 4:30:00 PM 62 MHz

cpu.usagemhz.average 4/21/2008 4:00:00 PM 62 MHz

cpu.usagemhz.average 4/21/2008 3:30:00 PM 79 MHz

cpu.usagemhz.average 4/21/2008 3:00:00 PM 69 MHz

cpu.usagemhz.average 4/21/2008 2:30:00 PM 60 MHz

cpu.usagemhz.average 4/21/2008 2:00:00 PM 66 MHz

cpu.usagemhz.average 4/21/2008 1:30:00 PM 65 MHz

mem.usage.average 4/21/2008 6:00:00 PM 1.94 %

mem.usage.average 4/21/2008 5:30:00 PM 1.54 %

mem.usage.average 4/21/2008 5:00:00 PM 1.55 %

mem.usage.average 4/21/2008 4:30:00 PM 2.46 %

mem.usage.average 4/21/2008 4:00:00 PM 2.53 %

mem.usage.average 4/21/2008 3:30:00 PM 2.53 %

mem.usage.average 4/21/2008 3:00:00 PM 3.43 %

mem.usage.average 4/21/2008 2:30:00 PM 2.87 %

mem.usage.average 4/21/2008 2:00:00 PM 2.56 %

mem.usage.average 4/21/2008 1:30:00 PM 2 %

PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> Get-ResourcePool ResPool0 |get-stat -stat mem.granted.average

MetricId Timestamp Value Unit

-


-


-


-


mem.granted.average 4/21/2008 6:00:00 PM 896733 KB

mem.granted.average 4/21/2008 5:30:00 PM 896372 KB

mem.granted.average 4/21/2008 5:00:00 PM 888362 KB

mem.granted.average 4/21/2008 4:30:00 PM 858295 KB

mem.granted.average 4/21/2008 4:00:00 PM 834003 KB

mem.granted.average 4/21/2008 3:30:00 PM 694446 KB

mem.granted.average 4/21/2008 3:00:00 PM 878103 KB

mem.granted.average 4/21/2008 2:30:00 PM 867361 KB

mem.granted.average 4/21/2008 2:00:00 PM 788245 KB

mem.granted.average 4/21/2008 1:30:00 PM 750173 KB

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

Now that would be exactly what I was looking for.

Unfortunately, although I have the same toolkit version, I get that error I mentioned above.

Too sad. I also tried to connecto to another VC with the same result. For get-vm and get-host, get-stat works fine.

Any ideas, how to possibly debug that problem?

raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

A few things to try:

Close the toolkit window and open a new one and try the same command again.

Run get-resourcepool, and instead of using the display name, try the command with the id, so "get-resourcepool -id ResourcePool-resgroup-19 |get-stat"

Restart the vc service and try again.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

Thank's again.

Tried all of that and even reinstalled and rebooted, but always with the same result...

raoulst

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Try using the -realtime argument to get-stat, this causes the data to be loaded from ESX rather than from VC.

Not sure why you're getting a crash there, sounds like a bug in the toolkit. Any chance you could file a support request regarding that issue?

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Try connecting to the esx host instead of vc, and see if you are still getting an error. As Carter stated, I would open an SR.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

When I connect to an ESX host and do

Get-ResourcePool myresourcepool | Get-Stat

I get

MetricId Timestamp Value Unit

-


-


-


-


cpu.usagemhz.average 04.07.2008 10:20:00 21 MHz

...

but I only get cpu.usagemhz.average values.

Get-ResourcePool myresourcepool | Get-Stat -stat mem.granted.average

gives me useful values, but I'd really need the memory values for the whole ResourcePool in VC.

I thought, that because the Toolkit is in beta I couldn't open a SR but I'm gonna try that now.

raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Double-check and make sure that the time on vc and esx is in sync. Then, retry the command through vc.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

VC is in synch with its ESX Hosts but the command keeps failing via VC.

raoulst

Reply
0 Kudos
kjb007
Immortal
Immortal
Jump to solution

Then it may be a bug. Please report your findings as suggested by Carter earlier.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

I opened a SR and the only answer I got was:

... unfortunately VMware does not provide support for writing or debugging of programs, for using development tools, or for sample programs.

so it seems, that there is no support for VI-Tools.

raoulst

Reply
0 Kudos
raoulst
Contributor
Contributor
Jump to solution

Just tried using the released version of the tool-kit.

Using it with VC 2.5.2 U2 I get the same error message. When I tried to connect to VC 2.5.0 U2 I couldn't authenticate:

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certificat

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

raoulst

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

Just tried using the released version of the tool-kit.

Using it with VC 2.5.2 U2 I get the same error message. When I tried to connect to VC 2.5.0 U2 I couldn't authenticate:

There were one or more problems with the server certificate:

  • A certification chain processed correctly, but terminated in a root certificat

e which isn't trusted by the trust provider.

  • The certificate's CN name does not match the passed value.

raoulst

That's a warning, not an error, you should be able to proceed after that.

Reply
0 Kudos