Class: OvirtSDK4::StatisticsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#list(opts = {}) ⇒ Array<Statistic>
Retrieves a list of statistics.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#statistic_service(id) ⇒ StatisticService
Locates the
statistic
service.
Methods inherited from Service
Instance Method Details
#list(opts = {}) ⇒ Array<Statistic>
Retrieves a list of statistics.
For example, to retrieve the statistics for virtual machine 123
send a
request like this:
GET /ovirt-engine/api/vms/123/statistics
The result will be like this:
<statistics>
<statistic href="/ovirt-engine/api/vms/123/statistics/456" id="456">
<name>memory.installed</name>
<description>Total memory configured</description>
<kind>gauge</kind>
<type>integer</type>
<unit>bytes</unit>
<values>
<value>
<datum>1073741824</datum>
</value>
</values>
<vm href="/ovirt-engine/api/vms/123" id="123"/>
</statistic>
...
</statistics>
Just a single part of the statistics can be retrieved by specifying its id at the end of the URI. That means:
GET /ovirt-engine/api/vms/123/statistics/456
Outputs:
<statistic href="/ovirt-engine/api/vms/123/statistics/456" id="456">
<name>memory.installed</name>
<description>Total memory configured</description>
<kind>gauge</kind>
<type>integer</type>
<unit>bytes</unit>
<values>
<value>
<datum>1073741824</datum>
</value>
</values>
<vm href="/ovirt-engine/api/vms/123" id="123"/>
</statistic>
The order of the returned list of statistics isn’t guaranteed.
20572 20573 20574 |
# File 'lib/ovirtsdk4/services.rb', line 20572 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 |
# File 'lib/ovirtsdk4/services.rb', line 20594 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return statistic_service(path) end return statistic_service(path[0..(index - 1)]).service(path[(index +1)..-1]) end |
#statistic_service(id) ⇒ StatisticService
Locates the statistic
service.
20583 20584 20585 |
# File 'lib/ovirtsdk4/services.rb', line 20583 def statistic_service(id) StatisticService.new(self, id) end |