Add an "uptime" measurement.
It would be great to be able to determine the uptime of a machine in a given period of time.
Currently, an "instance" measurement is available. It doesn't exactly address this issue, since it does not give information about the uptime/downtime of a VM. It is more of an "instance existence time".
Possible solution:
-------------------
Nova sends notifications when a vm is started/
Currently, a user may compute the uptime of a VM during a [t1;t2] period of time using something like this pseudo-code:
active = None
latest_
total_uptime = 0.0 # In seconds.
for sample in samples:
state = sample[
if state in ['active']:
if not active:
elif state in ['stopped', 'suspendend']:
if active:
else:
raise ValueError(state) # This state is not handled yet.
if active:
total += t2 - samples[
Note that here, the time spent between t1 and sample[
This could probably be nicely implemented in Ceilometer. The downtime could be computed the same way if necessary.
Another way of solving this issue would be to add a more generic meter (such as 'durations'), that would return the time spent in each state:
{
total: 42,
active: 30,
building: 4,
scheduling: 2,
stopped: 4,
suspended: 2
}
The computation of each state duration could be done as previsouly described.
Technical details
-------
* Add q.metadata_field, to be able to run queries that use a filter one a resource_
* The stats should return a "duration with resource_
* Caching the results.
It seems hard to keep the current value, since it depends on the time interval given in each query. We should probably not worry too much about caching right away. Anyway, this would only be a problem when querying statistics over a very large amount of time, and with a lot of notifications to process.
* Other use cases
For how long has a VM been using a given kernel ?
q.metadata_
In order to do this, we would need Nova to send us a notification when a
new kernel is installed.
For how long has a VM been using N cpus ?
q.metadata_
In order to do this, we would need Nova to send us a notification when the
number of vcpus changes
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Obsolete
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
- gordon chung
Related branches
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Statistics: group results by a value
Addressed by: https:/
Implement 'reset_on' for mongodb
see https:/