Hi All,
Hope all are doing good!! Am glad that i have utilized some ideas and written a code to make the disk space result comes better and it was successfully running in the production. The next update from my manager was to make this code to come in a table format with color added.
1) The below code will generate a report for the files which have crossed above 70% and i will FTP the same to the main server ( totally 17 server report files will be FTP'd to the main server.
df -g | awk 'NR>1&&($4+0)>70' > report151.txt
if [ -s report151.txt ]
then
cat report151.txt
else
echo "No file systems found above 70% utilization on the server `hostname`">>report151.txt
2) The main server will send the mail by collating all the report.txt files
#!/bin/sh
echo>blank_line
echo "The list of File systems that reached threshold were given below" > mailbody.txt
echo "---------------------------------------------------------------------------------">>mailbody.txt
cat report151.txt blank_line report115.txt blank_line report141.txt blank_line report161.txt>>mailbody.txt
cat mailbody.txt|mailx -s "Disk space Report-$(date +'%A %B %d, %Y')" -r "DSReport@wellpoint.com" hari1189@gmail.com
Now i need these report.txt's to come in the mailbody as table format with the below colors
70% - 80% - AMBER or YELLOW
80% - 100% - RED
Can some one help me out with the above script by modifying the encoding part of that mailbody. Thanks in advance. Hope i will find a better solution from my friends over here.
Thanks
Hari