trident icon indicating copy to clipboard operation
trident copied to clipboard

limitVolumeSize prometheus metric

Open ArtemKaba opened this issue 4 years ago • 6 comments

Describe the solution you'd like We need trident_backend_limit_volume_size_bytes metric to control trident backend utilization and over provisioning. Is it possible?

Describe alternatives you've considered It is no alternatives.

ArtemKaba avatar Oct 08 '21 02:10 ArtemKaba

Hello @ArtemKaba

Can you explain how you want this metric to work?

balaramesh avatar Oct 08 '21 15:10 balaramesh

@ArtemKaba bumping this up

balaramesh avatar Oct 11 '21 14:10 balaramesh

@balaramesh Hi! Thank you for quick reply.

We usually limit trident backend (ontap-nas-economy driver) in each k8s cluster by limitVolumeSize parameter. So we can control how many storage space our customers can consume and resize on-demand. But we need to ability to monitor this quota for each backend and compare with already used (or allocated) resources.

ArtemKaba avatar Oct 11 '21 15:10 ArtemKaba

@ArtemKaba limitVolumeSize is used to set the maximum size of a volume that can be created by Trident for a given backend. It sounds like you are looking to observe the amount of space consumed per backend. Is that what you are looking for?

If so, you can obtain that using trident_volume_allocated_bytes. This returns the amount of allocated storage per backend. An example Promethueus query would be:

trident_volume_allocated_bytes{backend_uuid="586b1cd5-8cf8-428d-a76c-2872713612c1"}

balaramesh avatar Oct 22 '21 14:10 balaramesh

@ArtemKaba does this meet your requirement?

balaramesh avatar Oct 25 '21 15:10 balaramesh

@balaramesh Hi,

thanks for your reply. let's imagine we have one trident backend and one storageclass using trident provisioner per k8s cluster. Backend limited by limitVolumeSize parameter. So we can calculate NetApp storage usage for this k8s cluster by

avg by(persistentvolumeclaim, namespace)(kubelet_volume_stats_used_bytes) *
on (persistentvolumeclaim, namespace) group_left
avg by(persistentvolumeclaim, namespace)(kube_persistentvolumeclaim_info{storageclass="netapp-nfs"})

But it is difficult to say there is a lot or a little free space left for a given backend. For this purpose we need to have limitVolumeSize as a prometheus metric. In that case we could calculate the percentage of backend usage:

sum(avg by(persistentvolumeclaim, namespace)(kubelet_volume_stats_used_bytes) *
on (persistentvolumeclaim, namespace) group_left
avg by(persistentvolumeclaim, namespace)(kube_persistentvolumeclaim_info{storageclass="netapp-nfs"})) /
trident_backend_limit_volume_size_bytes

ArtemKaba avatar Oct 26 '21 03:10 ArtemKaba