grafana / unused

CLI tool, Prometheus exporter, and Go module to list your unused disks in all cloud providers
Apache License 2.0
51 stars 1 forks source link

feat(display): Output the size and type of disk #44

Closed Pokom closed 1 year ago

Pokom commented 1 year ago

Currently working through a problem where I need to understand the size and type of disks to help prioritize which ones to clean up. The command will now output the type and size(in GB).

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

Pokom commented 1 year ago

One thing I'd add are standard disk types (SSD and HD for now, I suppose), and then have each provider map their internal representation to one of the standard ones in DiskType. Thoughts?

I like the idea of having standard disks then mapping the CSP disks back. Only nit is that I need to dig deeper at the differences between AWS/AKS. GCP is pretty easy in the sense that it's either SSH/HD, but I think AWS has many more types

inkel commented 1 year ago

Yup. A quick search shows that there are 7 EBS volume types, and the DescribeVolumes docs shows the values returned.

In the case of Azure they don't seem to have any particular identifier for their managed disks, only the full text description.

Pokom commented 1 year ago

Azure:

const (
    // PremiumLRS Premium SSD locally redundant storage. Best for production and performance sensitive
    // workloads.
    PremiumLRS DiskStorageAccountTypes = "Premium_LRS"
    // StandardLRS Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent
    // access.
    StandardLRS DiskStorageAccountTypes = "Standard_LRS"
    // StandardSSDLRS Standard SSD locally redundant storage. Best for web servers, lightly used enterprise
    // applications and dev/test.
    StandardSSDLRS DiskStorageAccountTypes = "StandardSSD_LRS"
    // UltraSSDLRS Ultra SSD locally redundant storage. Best for IO-intensive workloads such as SAP HANA, top
    // tier databases (for example, SQL, Oracle), and other transaction-heavy workloads.
    UltraSSDLRS DiskStorageAccountTypes = "UltraSSD_LRS"
)

AWS:

// Enum values for VolumeType
const (
    VolumeTypeStandard VolumeType = "standard"
    VolumeTypeIo1      VolumeType = "io1"
    VolumeTypeIo2      VolumeType = "io2"
    VolumeTypeGp2      VolumeType = "gp2"
    VolumeTypeSc1      VolumeType = "sc1"
    VolumeTypeSt1      VolumeType = "st1"
    VolumeTypeGp3      VolumeType = "gp3"
)

GCP:

Returns a hyperlink to the hard drive type :clown_face:

Pokom commented 1 year ago

Can't find anything in AWS, but here's the output for Azure now:

unused -azure.sub $(az account subscription list | jq -r '. | map(.subscriptionId) | join(" ")')
PROVIDER  DISK                                                                      AGE     UNUSED  TYPE    SIZE_GB
Azure     pvc-...                                  155d    n/a     hdd     2
Azure     pvc-...                                 257d    n/a     hdd     100
Azure     pvc-...                                  155d    n/a     hdd     2
Azure     pvc-...                                  75d     n/a     hdd     100
...
Pokom commented 1 year ago

Oh forgot all about the Interactive UI! Let me play around with a bit and I'll let you know