windows_exporter
windows_exporter copied to clipboard
Add disk usage to container metrics
I do have a use-case where I want to monitor the disk usage of containers.
Is there any possibility to get this added?
As far as I know, the Win32_LogicalDisk class is capable of providing such information. Nonetheless I am not sure if the hcsshim provides access to it or if there are any syscalls available inside vmcompute.dll which is used by container.go and hcsshim. Also the GetDiskFreeSpaceExW syscall is part of kernel32.dll and may be not suitable, to be integrated in wmi_exporter or hcsshim.
I developed a workaround executing powershell Get-PSDrive C | Select-Object Used,Free as command inside each container and parse the result. But, I am searching for a more clean an reliable solution.
Hi @semaph0r, If you check the Win32_LogicalDisk class from the host via Powershell, are they listed there? If so, it should work out of the box. I don't have any systems running Windows containers yet, so I don't have a testbed I'm afraid.
In case the WMI system does not expose these, I think your best shot would be to use the textfile collector. Either continuing with the approach you have with powershell, or creating some utility to fetch it. It does not seem the hcsshim directly exposes anything about disk usage in the statistics interface we use, but it does expose the vhd paths (the virtual disks backing the container storage), which could be one possibility.
Good points! I need some time to verify your options
Hi @carlpett ,
I issued the above mentioned command inside my docker environment:
docker run mcr.microsoft.com/windows/servercore:1809 powershell "gwmi Win32_LogicalDisk"
This will respond as expected with:
DeviceID : C:
DriveType : 3
ProviderName :
FreeSpace : 21182816256
Size : 21339549696
VolumeName :
How can I integrate this query into the collector?
Hi, Sorry if I was not clear - what I meant was if the containers disks show up if you run that query on the hosting machine itself (that is, not inside docker). The hope would be that it would list all disks mounted by all running containers there.
@carlpett @sachinmsft hcshim's Statistics expose StorageStats about disk read/write. https://github.com/microsoft/hcsshim/blob/master/test/vendor/github.com/Microsoft/hcsshim/internal/hcs/schema1/schema1.go#L188 can we expose disk read/write metric from the StorageStats?
https://github.com/prometheus-community/windows_exporter/pull/943 I create a pr to collect storage metrics for windows-exporter. @carlpett @semaph0r
#943 I create a pr to collect storage metrics for windows-exporter. @carlpett @semaph0r
@carlpett @sachinmsft This pr is already merged. windows_exporter will expose storage metrics for windows container(example metrics see #943) after v0.18.1. I thinks those metrics meet your needs. If so, this issue can be closed.
/close
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.