VMware {code} Community
netix_evg
Contributor
Contributor

VI Perl : Creating performance interval using CreatePerfInterval method not working ??

Hi,

I have been trying to create performance interval for VMware VirtualCenter 2.5.0 with samplingPeriod = 40 sec. Following is the perl code snippet :

{{{

#!/usr/bin/perl -w

  1. create performance interval for host or vm

use strict;

use warnings;

use VMware::VIM25Runtime;

use VMware::VILib;

  1. performance manager view

my $perfmgr_view;

  1. read/validate options

Opts::parse();

Opts::validate();

  1. connect to the server

Util::connect();

$perfmgr_view = Vim::get_view(mo_ref => Vim::get_service_content()->perfManager);

my $interval = PerfInterval->new(name => 'Past Day',

enabled => 'true',

samplingPeriod => 40,

length => 7200);

  1. get performance data

$perfmgr_view->CreatePerfInterval(interval => $interval);

Util::disconnect();

}}}

but this program giving following error :

{{{

Unexpected arguments: interval at /usr/lib/perl5/5.8.8/VMware/VIM25Stub.pm line 31390

VimService::build_arg_string('ARRAY(0x152c2630)', 'HASH(0x152c25b0)') called at /usr/lib/perl5/5.8.8/VMware/VIM25Stub.pm line 32588

VimService::CreatePerfInterval('VimService=HASH(0x142f7050)', '_this', 'ManagedObjectReference=HASH(0x127c1080)', 'interval', 'PerfInterval=HASH(0x15619a60)') called at /usr/lib/perl5/5.8.8/VMware/VICommon.pm line 1011

ViewBase::invoke('PerformanceManager=HASH(0x14e78c60)', 'CreatePerfInterval', 'interval', 'PerfInterval=HASH(0x15619a60)') called at /usr/lib/perl5/5.8.8/VMware/VIM25Runtime.pm line 1409

PerformanceManagerOperations::CreatePerfInterval('PerformanceManager=HASH(0x14e78c60)', 'interval', 'PerfInterval=HASH(0x15619a60)') called at createPerf.pl line 38

}}}

am I missing something ... like parameter to PerfInterval->new ???

Do we need to provide key value to PerfInterval->new ??? If yes then what ??

0 Kudos
4 Replies
dsubram
Enthusiast
Enthusiast

Use UpdatePerfInterval API instead of CreatePerfInterval.

0 Kudos
admin
Immortal
Immortal

Please see the following link for seeing the methods. createPerfInterval api call has been deprecated since VI API 2.5 and thus you would not be able to use it for any language. Instead as suggested by dsubram, use updateperfinterval.

0 Kudos
netix_evg
Contributor
Contributor

i am able to update interval sampling period to 60sec, 120 sec, 180 sec using java sdk ...not tried with perl and c-gsoap .....but this is associated with historial data .... is it possible to use custom interval say 10sec for collecting realtime data i.e as we use refresh rate as a interval for collecting real time data.

0 Kudos
dsubram
Enthusiast
Enthusiast

Minimum refresh interval where we can get NEW or UPDATED set of data is 20 seconds. We can use UpdatePerfInterval with 10 seconds but this interface provides same values for two consecutive intervals.

Try to create Interval with 0 seconds or 1 seconds and then I think you can get a real time data. This is confirmed by one of vmware folks. But I didn't verified it.