BYEONG-GI KIM
2016-Jan-04 00:19 UTC
[libvirt-users] API for retrieving resource metrics from VMs?
Hello. I'm a new getting started to learn the libvirt API. I've tried to find APIs which retrieve resource metrics such as cpu, disk, memory, and network I/O usages, but I could find few related thing; I was intended to use libvirt-Java binding first, it seems I'd be better to use the others like Python binding or C API though. The Java binding API is likely to provide very limited API list comparing with the above APIs so far. So, I'd like to know which APIs can retrieve that resources from VMs. I don't care about the language, but I really want to know whether such APIs even exists or not. As far as I know, cpu, memory, and network I/O seems being provided, but I'm not sure disk usage per VMs can be obtained via libvirt API. Thanks in advance. Best regards bgkim -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20160104/836160c0/attachment.htm>
Michal Privoznik
2016-Jan-04 13:21 UTC
[libvirt-users] API for retrieving resource metrics from VMs?
On 04.01.2016 01:19, BYEONG-GI KIM wrote:> Hello. I'm a new getting started to learn the libvirt API. > > I've tried to find APIs which retrieve resource metrics such as cpu, disk, > memory, and network I/O usages, but I could find few related thing; I was > intended to use libvirt-Java binding first, it seems I'd be better to use > the others like Python binding or C API though. The Java binding API is > likely to provide very limited API list comparing with the above APIs so > far. > > So, I'd like to know which APIs can retrieve that resources from VMs. I > don't care about the language, but I really want to know whether such APIs > even exists or not. > > As far as I know, cpu, memory, and network I/O seems being provided, but > I'm not sure disk usage per VMs can be obtained via libvirt API.I'm not sure what do you mean by 'disk usage'. You mean like 'how many bytes are used/free on a disk'? If so, I'm not sure libvirt can help. I mean it's dependent on guest configuration and you should use 'df' ran from within guest to retrieve that info. It falls out of libvirt's scope. If you, however, mean disk I/O - this can be obtained via virDomainBlockStatsFlags() API. Michal
BYEONG-GI KIM
2016-Jan-04 13:33 UTC
Re: [libvirt-users] API for retrieving resource metrics from VMs?
Thank you for the reply! I used the term "disk usage" as what you mentioned first; the information which can be retrieved via 'df' command on linux system... I'll then have to consider different approach to do what I want. Anyway, thanks again for your great help. Best regards bgkim 2016-01-04 22:21 GMT+09:00 Michal Privoznik <mprivozn@redhat.com>:> On 04.01.2016 01:19, BYEONG-GI KIM wrote: > > Hello. I'm a new getting started to learn the libvirt API. > > > > I've tried to find APIs which retrieve resource metrics such as cpu, > disk, > > memory, and network I/O usages, but I could find few related thing; I was > > intended to use libvirt-Java binding first, it seems I'd be better to use > > the others like Python binding or C API though. The Java binding API is > > likely to provide very limited API list comparing with the above APIs so > > far. > > > > So, I'd like to know which APIs can retrieve that resources from VMs. I > > don't care about the language, but I really want to know whether such > APIs > > even exists or not. > > > > As far as I know, cpu, memory, and network I/O seems being provided, but > > I'm not sure disk usage per VMs can be obtained via libvirt API. > > I'm not sure what do you mean by 'disk usage'. You mean like 'how many > bytes are used/free on a disk'? If so, I'm not sure libvirt can help. I > mean it's dependent on guest configuration and you should use 'df' ran > from within guest to retrieve that info. It falls out of libvirt's scope. > > If you, however, mean disk I/O - this can be obtained via > virDomainBlockStatsFlags() API. > > Michal >