By privatebadre
is there any method that i can get the size left on my Droplet using API
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
I don’t think that this is yet possible via the API directly. There is already a similar idea shared here that you could vote for:
In the meantime, I could suggest a couple of alternatives:
https://www.digitalocean.com/docs/monitoring/quickstart/#create-alert-policies
ssh your_user@your_droplet_ip df -h
The output that you would get would look something like this:
Filesystem Size Used Avail Use% Mounted on
udev 478M 0 478M 0% /dev
tmpfs 99M 920K 98M 1% /run
/dev/vda1 25G 16G 9.0G 63% /
...
If you have multiple droplets you could use a loop to go through all droplets and run the command on each, here’s an example script:
#!/bin/bash
# List of your Droplet IPs separated by space
list_of_droplets="droplet_ip_1 droplet_ip_2 droplet_ip_3"
for droplet in $list_of_droplets ; do
echo "Disk Usage for ${droplet}"
ssh your_user@${droplet} df -h
done
You could add your SSH key to each Droplet and that way you would not have to type your password each time.
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.