2015-08-19 43 views
0

我需要獲得給定VM的平均每日統計數據。 VM在VMware vSphere 5.1上運行。我使用PHP並通過SOAP調用方法。vSphere API的「QueryPerf」方法返回奇怪的結果

我的代碼如下所示:間隔和內存使用率佔總配置或可用內存的百分比期間CPU使用率百分比

$result = $this 
     ->soapClient 
     ->QueryPerf(array(
      '_this' => $this->serviceContent->perfManager, 
      'querySpec' => array(
       'entity'  => $object, 
       'startTime'  => $startTime->format('c'), 
       'intervalId' => 86400, 
      ), 
     )); 

返回的結果看起來很奇怪。

CPU結果:

stdClass::__set_state(array(
    'groupInfo' => 
    stdClass::__set_state(array(
     'label' => 'CPU', 
     'summary' => 'CPU', 
     'key' => 'cpu', 
    )), 
    'nameInfo' => 
    stdClass::__set_state(array(
     'label' => 'Usage', 
     'summary' => 'CPU usage as a percentage during the interval', 
     'key' => 'usage', 
    )), 
    'rollupType' => 'average', 
    'statsType' => 'rate', 
    'unitInfo' => 
    stdClass::__set_state(array(
     'label' => 'Percent', 
     'summary' => 'Percentage', 
     'key' => 'percent', 
    )), 
    'instance' => '', 
    'value' => 349, 
)), 

單位爲百分之但該值是349

存儲器結果:

stdClass::__set_state(array(
    'groupInfo' => 
    stdClass::__set_state(array(
     'label' => 'Memory', 
     'summary' => 'Memory', 
     'key' => 'mem', 
    )), 
    'nameInfo' => 
    stdClass::__set_state(array(
     'label' => 'Usage', 
     'summary' => 'Memory usage as percentage of total configured or available memory', 
     'key' => 'usage', 
    )), 
    'rollupType' => 'average', 
    'statsType' => 'absolute', 
    'unitInfo' => 
    stdClass::__set_state(array(
     'label' => 'Percent', 
     'summary' => 'Percentage', 
     'key' => 'percent', 
    )), 
    'instance' => '', 
    'value' => 1193, 
)), 

單位是還百分之但該值是。

其他值具有相同的問題。

問題: 我在做什麼錯了? 如何獲得有效的結果?

注:這些結果稍有格式化,但在客戶端沒有執行任何計算或其他值修改。

回答

2

look at the docs。您應該將百分比值除以100,以獲得實際的百分比值。