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.
21881 21882 21883 |
# File 'lib/ovirtsdk4/services.rb', line 21881 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 |
# File 'lib/ovirtsdk4/services.rb', line 21903 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.
21892 21893 21894 |
# File 'lib/ovirtsdk4/services.rb', line 21892 def statistic_service(id) StatisticService.new(self, id) end |