Monitor Xen(XCP 1.6) using XAPI via XMLRPC. Double(or float) value responsed from Xen host is always 0?

StackOverflow https://stackoverflow.com/questions/17208974

  •  01-06-2022
  •  | 
  •  

Frage

I'm developing an simple performance monitor for Xen(I use XCP 1.6). I use PHP to execute XMLRPC request. Most responses from Xen host are OK. However, when I request host_cpu.get_utilisation, the double value is always 0 in the response. The responsed double values for PIF_metrics.get_io_read_kbs and PIF_metrics.get_io_write_kbs are also 0 no matter how much traffic in network. Other type like int and string are just normal and XenCenter can monitor host and get right result. What should I do?
Here's the PHP code:

// get CPU utilisation
$cpu_utilisation = 0.0;
for($i=0; $i<count($host_CPUs); $i++)
{
$rpcClient->query("host_cpu.get_utilisation", $session, $host_CPUs[$i]);
$u = $rpcClient->getResponse();
$cpu_utilisation += (float)($u["Value"]*100);
print_r($u);
}
$cpu_utilisation = $cpu_utilisation/count($host_CPUs);
echo "CPU %: ";
print_r($cpu_utilisation);

here's the response xml:

<methodResponse>
<params>
<param>
<value>
<struct>
    <member><name>Status</name><value>Success</value></member>
    <member><name>Value</name><value><double>0</double></value></member>
</struct>
</value>
</param>
</params>
</methodResponse>
War es hilfreich?

Lösung

I solved it. host.query_data_source works fine!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top