RudiC thank you for all of your input.
Here is the completed set of codes. Note that I have included both AIX and Linux versions. I also have screen and email output sections combined for space saving. Let me know if you have any ideas on making this more usable. Currently, in our enterprise, it is extremely difficult to incorporate cron tasks, since we use another vendor for those type tasks, which disables cron functionality. SO I just copy/paste when I need to use any part of it.
So here it is.
#!/bin/ksh
# AIX Version 1.0 by Stryker Cain.
# With assistance from Sujith Achutan
# Jeyagopal Dharmalingham Daniel Thornton and Jamie Banas
## Comment out the top df portion to only get a csv report emailed to you. ##
## Comment out the bottom df portion to only get a script output ##
## Leave as is to get both screen output and emailed csv report ##
## Future parameters will be to add input of email address ##
cd /tmp
HOST1=$(hostname)
df -Pg | awk 'BEGIN{
print "\t SPACE OF IMPORTANT FILE SYSTEMS on '$HOST1'\t\n----------------------------------------------------------------------\nFILE-SYSTEM\t TOTAL-SPACE\t USED-SPACE\t FREE-SPACE\t %USED\n"}
function disp(v1,v2,v3,v4,v5){
printf "%-10s\t %-10s\t %-10s\t %-10s\t %-6s \n",v1,v2,v3,v4,v5
}
NR>2&&(($3>($2*.80)&&disp($6,$2,$3,$4,$5))||($3>($2*.40)&&$3<($2*.80)&&disp($6,$2,$3,$4,$5))||($3<($2*.40)&&disp($6,$2,$3,$4,$5)))
END{print "----------------------------------------------------------------------\n "}'
df -Pg | awk 'BEGIN{
print "FILE_SYSTEM,TOTAL_GB,USED_GB,FREE_GB,PERCENT_USED"}
function disp(v1,v2,v3,v4,v5){
printf "%-1s,%-1s,%-1s,%-1s,%-1s\n",v1,v2,v3,v4,v5
}
NR>2&&(($3>($2*.80)&&disp($6,$2,$3,$4,$5))||($3>($2*.40)&&$3<($2*.80)&&disp($6,$2,$3,$4,$5))||($3<($2*.40)&&disp($6,$2,$3,$4,$5)))
END{print "'$HOST1'-\n"}' > $HOST1-df_All.csv
uuencode $HOST1-df_All.csv $HOST1-df_All.csv | /bin/mailx -s "$HOST1 diskusage script by Stryker Cain" "email address"
rm -rf $HOST1-df_All.csv
#!/bin/ksh
# Linux Version 1.0 by Stryker Cain.
# With assistance from Sujith Achutan
# Jeyagopal Dharmalingham, Daniel Thornton and Jamie Banas
## uuencode must be installed for this script (bottom half) to work. ##
## If not you have to comment out the uuencode part and change ##
## the mailx to the cat mail command ##
## Comment out the top df portion to only get a csv report emailed to you. ##
## Comment out the bottom df portion to only get a script output ##
## Leave as is to get both screen output and emailed csv report ##
## Future parameters will be to add input of email address ##
cd /tmp
HOST1=$HOSTNAME
df -Ph | awk 'BEGIN{
print "\t SPACE OF IMPORTANT FILE SYSTEMS on '$HOST1'\t\n----------------------------------------------------------------------\n FILE-SYSTEM\t TOTAL-SPACE\t USED-SPACE\t FREE-SPACE\t %USED\n"}
function disp(v1,v2,v3,v4,v5){
printf "%-10s\t %-10s\t %-10s\t %-10s\t %-6s \n",v1,v2,v3,v4,v5
}
NR>2&&(($3>($2*.80)&&disp($6,$2,$3,$4,$5))||($3>($2*.40)&&$3<($2*.80)&&disp($6,$2,$3,$4,$5))||($3<($2*.40)&&disp($6,$2,$3,$4,$5)))
END{print "----------------------------------------------------------------------\n "}'
HOST1=$HOSTNAME
df -Ph | awk 'BEGIN{
print "FILE_SYSTEM,TOTAL_GB,USED_GB,FREE_GB,PERCENT_USED"}
function disp(v1,v2,v3,v4,v5){
printf "%-1s,%-1s,%-1s,%-1s,%-1s\n",v1,v2,v3,v4,v5
}
NR>2&&(($3>($2*.80)&&disp($6,$2,$3,$4,$5))||($3>($2*.40)&&$3<($2*.80)&&disp($6,$2,$3,$4,$5))||($3<($2*.40)&&disp($6,$2,$3,$4,$5)))
END{print "'$HOST1'-\n"}' > $HOST1-df_All.csv
uuencode $HOST1-df_All.csv $HOST1-df_All.csv | /bin/mailx -s "$HOST1 UNIX diskusage script by Stryker Cain" "email address"
# cat $HOST1-df_All.csv | /bin/mail -s "$HOST1 UNIX diskusage script by Stryker Cain" "email address"
rm -rf $HOST1-df_All.csv