Receive an email when hard drive of a user is full

At the moment I check the hard drive usage of my users on a daily basis.

This is manual work, my question is if I can receive an email when the hard drive of a user is full.

Argos will take care of that. Learn more about monitoring here :arrow_upper_right:

Monit will send out a notification as filesystem reaches limits set in /etc/monit.d/filesystem.conf and /etc/monit.d/filesystem-home.conf.

You’ve got a couple ways of tackling this.

First, if for email, quotas are reported to the mail client. For example, this is what’s reported in Thunderbird.

This value is also reported in the status bar if it exceeds 75%. Outlook also supports listing this.

Second, you can use repquota -gua | grep '\+' to report all quotas that are over. I’ve added a new API command, user:resolve-uid(int $uid) that’ll be available next release; you can hop on edge to evaluate it.

yum install -y jq
repquota -gua | grep '^#' | grep '\+' | cut -f1 -d" " | tr -d '#' | while read VUID ; do 
  # site is position 1, username position 2
  declare -a TUPLE=$(cpcmd -ojson user:resolve-uid $VUID | jq -r '"(" + .[0] + " " + (.[1] | @sh) + ")"')
  # no username resolved
  [[ -z ${TUPLE[1]} ]] && continue
done

Typically quota concerns are in regards to email, in which case mail can report quota percentages to the UI.

For the record. I mean the total storage of a hosting account and not for an email account.

Does the above script with repquota help with that?