Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virt: add support for new metrics #2168

Merged
merged 1 commit into from Apr 10, 2017

Conversation

pszczerx
Copy link
Contributor

@pszczerx pszczerx commented Feb 9, 2017

Extend virt plugin functionality to support new statistics:

  • Performance monitoring events
  • Domain state & reason
  • Percentage CPU usage
  • CPU pinning (affinity)
  • Disk errors
  • File system information
  • Job statistics

Leverage recently added 'ExtraStats' logic to allow user to enable or disable new metrics.
Plugin decodes domain state and reason enum values to human-readable string format, which will make it easier to interpret notifications.

Known limitation:
Missing CPU utilization metric is expected in some cases. In order to compute %CPU, we require 2 samples of CPU time. However, connection to libvirt is periodically refreshed, by default every 60 seconds. This interval can be changed with RefreshInterval virt plugin configuration option. Whenever connection is refreshed, we lose previous readings of CPU time, which means that we are unable to dispatch %CPU at next dispatch. With default settings - Plugin Interval 10 sec and RefreshInterval 60 sec CPU utilization will be missing every 6th dispatch. We are already working on solution for this issue, fix coming soon.

int domain_state = 0;
int domain_reason = 0;

int status = virDomainGetState(domain, &domain_state, &domain_reason, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe a valid value for the domain_reason is NULL... we should check this before submitting this value
Please see https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetState

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

virDomainGetState API can be called with NULL as a domain_state, if one doesn't wish to retrieve domain reason i.e. virDomainGetState(domain, &domain_state, NULL, 0); .

In this patch domain_state variable is created on the stack, and then its address is passed to libvirt API. The value received from the API is an integer, thus I don't see any valid reason to make extra check.

@rubenk
Copy link
Contributor

rubenk commented Feb 19, 2017

I'll hold off on this for a bit, since there's already work going on to handle these issues in the virt plugin. See the discussions in #2037 and #2048.

@pszczerx
Copy link
Contributor Author

@rubenk, #2037, #2048 and recently merged changes #2175, #2103 do not contain all metrics we are interested in. Anyway, virt plugin code has changed since I opened this PR which means that I'll have to do a rebase.

@rubenk
Copy link
Contributor

rubenk commented Feb 21, 2017

Yes, and there are more changes coming, so to prevent duplicate work please wait a bit, or perhaps you can bundle your efforts with @fromanirh.

@ffromani
Copy link
Contributor

Hi, just to notify that I don't have any more RFEs in the pipeline, we added all the metrics we needed.

@pszczerx
Copy link
Contributor Author

@fromanirh good to know, thanks for the information.

Add support for new libvirt metrics:
- Performance monitoring events
- Domain state & reason
- Percentage CPU usage
- CPU pinning (affinity)
- Disk errors
- File system info
- Job stats

Change-Id: I233fb18653d218c7e906a157743606c6818f9feb
Signed-off-by: Przemyslaw Szczerbik <przemyslawx.szczerbik@intel.com>
@pszczerx
Copy link
Contributor Author

@rubenk, PR has been rebased and slightly reworked (added support for recently added ExtraStats logic, domain state changed from metric to notification). I'm looking forward to hearing your comments.

@rubenk
Copy link
Contributor

rubenk commented Apr 10, 2017

Thanks again @pszczerx!

@rubenk rubenk merged commit 9eb3efd into collectd:master Apr 10, 2017
@maryamtahhan maryamtahhan deleted the feat_libvirt_upstream branch April 18, 2017 13:27
@octo octo added this to the 5.8 milestone Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants