Im trying to poll the uptime of the guest to add to an output page I'm generating..
I thought I had this working previously ( code was moth balled for a bit ) 🙂
From an arry of vm-views I'm trying to grab the uptime like this ..
foreach( sort {$a->summary->config->name cmp $b->summary->config->name} @$vm_view) {my $vmstate = $_->runtime->powerState->val;my $vmuptime = 0;if( $vmstate eq "poweredOn" ) {$vmuptime = $_->summary->quickStats->uptimeSeconds;}......
When I run this I get the following output
Can't locate object method "uptimeSeconds" via package "VirtualMachineQuickStats" at ...
I thought this worked before .. has something changed or is this just plain wrong.
-- kevin
OK seems this could be the same issue as this one
OK so now .. how to make vcenter / vsphere track this .. ?? Is there something I can add to the vcenter server to track the uptime and or any other "red starred" items ??
The uptimeSeconds is a new property in the vSphere 4.1 API as noted per the documentation - http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.vm.Summary.QuickStats.ht...
I would double check the version of the ESX(i) and/or vCenter host you're connectingn to, I suspect you're probably connected to a 4.0 host which this property is not valid for.
Nope .. on latest 4.1.0, 345043
You might have answered this in another thread... See my previous.
Which would then change the nature of my question to "How can I force Vsphere/Vcenter to make this data available 'the red star items' "
Check that you're also running vSphere SDK for Perl 4.1 and not 4.0
no joy :smileyconfused:
Perl-SDK-4.1.0-254719 Still the same
Can't locate object method "uptimeSeconds" via package "VirtualMachineQuickStats" at ...
Does anyone know .. Is this something that you can turn on/off at the vcenter server stats level?
One more recollection I just had...
In my original development of this script I did have this working.. BUT I was polling against a 4.0 vCenter Server.
What gives..
I've opened a query w/ vmware.. "Good luck" yea I know..
I would double check your environment that both your vCenter & ESX(i) are running vSphere 4.1, since that error generally means it's unable to map the property you're looking for in the current SDK and generally means you're somehow miss-matching the versions. Remember that as new properties are exposed with a newer version of vSphere, they are not exposed using old versions of the SDK, you have to use the newer version. This property is one I've extracted before and I know it was new with 4.1, so recommendation is to validate both your ESX(i) and vCenter prior to extract this particular value or others that are only available in vSphere 4.1, that way you don't hit this problem.
VMware will most likely tell you the same thing but you're more than welcome to follow up with them