http://www.kanap.net/2014/11/vcsa-vcenter-server-appliance-part-3-advanced-customizing/
#!/bin/bash# Please provide email for alert messagesemail='my-email-recipient@mycompany.com'# Please provide percentage threshold for PostgreSQL used disk spacethresh=80# check that we're using PostgreSQL databasedb_type=`cat /etc/odbc.ini | grep DB_TYPE | awk -F= '{print $2}' | tr -d ' '`if [ "$db_type" != "PostgreSQL" ]; then exitfiif [ -z "$email" ]; then if [ ! -f /etc/vmware-vpx/root.email ]; then exit fi email=$(head -n 1 /etc/vmware-vpx/root.email)fi# identify PostgreSQL mount pointmount_point=`cat /etc/vmware-vpx/embedded_db.cfg | grep EMB_DB_STORAGE | awk -F"'" '{print $2}'`# collect disk usage for the mount pointdf_out=`df $mount_point | tail -n 1 | awk '{print strtonum($5)}'`if [ $df_out -gt $thresh ]; then cat << HEREDOC | sendmail -tTo: $emailSubject: Storage Alert for MyvCSA - disk full!From: vCenter Server Appliance disk usage <myvCSA_noreply@mycompany.com>Hello!Threshold of $thresh% for $mount_point is exceeded: $df_out%.Consider extending your disk storage for $mount_point mount. Please refer to http://kb.vmware.com/kb/2056764 how to do that.Regards,my-vCSA's-nameHEREDOCfi