Monitor Disk Usage per domain


#1

On the Dreamhost panel you can request every 30 days to view the disk usage of each domain that you are hosting. Is there any way I can monitor the disk usage daily, or at least weekly? I don’t want to wait 30 days to get an update; clients can go crazy uploading stuff in 30 days.


#2

You can view current disk usage by User in the panel:
https://panel.dreamhost.com/index.cgi?tree=status.disk&

My domains are set up so that each domain is owned by a specific user. You can also create a one-line cron job in the panel and have it run daily:
/usr/bin/du -sh example.com

If their website stores data outside of the domain folder, it’d be:
/usr/bin/du -sh example.com example_data

If it’s run as that user, it will show you how many megs (or gigs) their domain folder (and then examle_data folder) is. You get to set the email address for the output. I don’t know if there’s a way to put more than one email address, but I’d try separating them with commas.[hr]
I just tried the above command. For some reason, using the panel for this does a recursive listing. The good news is that the very last line will give you a grand total. My new command I’m attempting is:
/usr/bin/du -sh example.com | tail -1

This will show the last line at the tail end of the listing.

Just got the result back and the tail -1 addition worked.