Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1059783

Summary: [RFE] Export usage statistics through the REST API
Product: [Retired] oVirt Reporter: Petr Beňas <pbenas>
Component: ovirt-engine-apiAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: bugs <bugs>
Severity: low Docs Contact:
Priority: low    
Version: 3.3CC: acathrow, bazulay, bdagan, gklein, iheim, oramraz, pstehlik, Rhev-m-bugs, s.kieske, talayan, yeylon
Target Milestone: ---Keywords: FutureFeature
Target Release: 3.4.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-07 10:52:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Beňas 2014-01-30 16:11:13 UTC
Description of problem:
Currently the data about usage of hosts and VM resources like CPU, ram, network usage are available through the rhevm-reports package based on the Jasper-reports reporting library. I see it's purpose in two areas - it makes accessible the usage data and it also creates HTML and PDF reports with charts.

The rhevm-reports also provides REST API, actually two, but none of them exports all the functionality available through the webUI and the first API is definitelly not nice to use. Also, the API can be only used for requesting a reports in various format (PDF, CSV, XLS, ...), but not for accessing the usage data itself. Afaik the jasper reports use a database containing data it takes from engine's database, which means the data should be known to the engine. 

The rhevm's API is a much nicer and better designed then the jasper-report's one. It would be really nice to have the usage data accessible through the rhevm's rest api. It would cover the half of rhevm-report's justification of existence. With the data available through the API, various plotting tools could be used for creating the charts in various output formats (Google Charts, python-matplotlib, GNUplot, ...). It would require quite a lot of work to create plotting application capable of replacing all the functionality of jasper-reports, but I can still imagine it as worth it. The user experience with Jasper reports is bad, both in WebUI as well as with it's API.

Comment 1 Juan Hernández 2014-01-30 19:21:18 UTC
Moved to oVirt product, and targeted to 3.5.0 so that we consider it for inclusion when reviewing 3.5 features.

Comment 2 Juan Hernández 2014-04-07 10:52:32 UTC
The usage information is already available in the statistics subresources. For example, for a host:

GET /api/hosts/{host:id}/statistics

<statistics>
  <statistic href="..." id="...">
    <name>memory.total</name>
    <description>Total memory</description>
    <values type="INTEGER">
      <value>
        <datum>1969225728</datum>
      </value>
   </values>
   <type>GAUGE</type>
   <unit>BYTES</unit>
   <host href="..." id="..."/>
  </statistic>
  <statistic href="..." id="...">
    <name>memory.used</name>
    <description>Used memory</description>
    <values type="INTEGER">
      <value>
        <datum>334768373</datum>
      </value>
    </values>
    <type>GAUGE</type>
    <unit>BYTES</unit>
    <host href="..." id="..."/>
  </statistic>
  ...
</statistics>

And for a virtual machine:

GET /api/vms/{vm:id}/statistics

<statistics>
  <statistic href="..." id="...">
    <name>memory.installed</name>
    <description>Total memory configured</description>
    <values type="INTEGER">
      <value>
        <datum>1073741824</datum>
      </value>
    </values>
    <type>GAUGE</type>
    <unit>BYTES</unit>
    <vm href="..." id="..."/>
  </statistic>
  <statistic href="..." id="...">
    <name>memory.used</name>
    <description>Memory used (agent)</description>
    <values type="INTEGER">
      <value>
        <datum>0</datum>
      </value>
    </values>
    <type>GAUGE</type>
    <unit>BYTES</unit>
    <vm href="..." id="..."/>
  </statistic>
  ...
<statistics>

This information is also available in the Python and Java SDKs. I'm closing the bug, please reopen if there are specific statistics that aren't provided.