How do I get the percent_used metric for compute disk, filtered by the disk ID?

My aim is to collect the amount of free/used space inside each of the provisioned disk for a compute instance. I am using the go client library for this, specifically google-cloud-go.
I understand there are no direct means to collect this data by using the compute client. I have resorted to using the Monitoring client, along with the Ops Agent for this. I am collecting the metric agent.googleapis.com/disk/percent_used for each instance.

The metric that I collect, gives me data points grouped by each instance. But I need these separately for each of the compute disks I have attached with a specific compute instance.

I am trying to understand if there is a better way to collect the used/free storage space in the compute disks. If not, please tell me if there is a way I can filter the above time series data for each compute disk(unique disk ID)

1 Like

Hello @gulegulzaradnan ,Welcome on Google Cloud Community.

I’m not sure if I understood your query correctly, but did you’ve maybe tried to group them by device name? See, each disk can have unique device name. You can use filters when you’ve configuring your metric query to filter data based on such name. You can reduce monitoring scope for only one instance and take disks from that instance only.

But please, correct me if my assumption is wrong :grinning_face_with_smiling_eyes:


cheers,
DamianS
LinkedIn medium.com Cloudskillsboost