Required cpu , memory, df output in mail for multiple servers

I have prepared script which will collect cpu, memory and df out out for multiple server and send in one mail, but my script only run in one server, and when I send to mail, it shows in text format. it should be show actual format.
if any one can help , that would be very grateful.

script ---------------

#!/bin/sh
echo "############################################################## $(hostname) ##########################################"
echo "#Memory Status ------------>>"
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }'
echo "#CPU Uses ------------>>"
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'

echo "#Disk Uses ------------>>"
df -Ph | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5,$1 }' | while read output;
do
  echo $output
  used=$(echo $output | awk '{print $1}' | sed s/%//g)
  partition=$(echo $output | awk '{print $2}')
  if [ $used -ge 60 ]; then
 #echo "The partition \"$partition\" on $(hostname) has used $used% at $(date)" | mail -s "Disk Space Alert: $used% Used On $(hostname)" mail@email.com
  echo "The partition \"$partition\" Please check, Its reached 80% --------->>>>>  $used% "
  fi
done

Output....................

#Memory Status ------------>>
Memory Usage: 000/00000MB (13.57%)
#CPU Uses ------------>>
CPU Load: 0.01
#Disk Uses ------------>>
10% /dev/mapper/rootvg-rootlv
10% /dev/mapper/rootvg-usrlv
10% /dev/mapper/rootvg-optlv
10% /dev/mapper/rootvg-varlv
10% /dev/mapper/rootvg-tmplv
10% /dev/sdy1
10% /dev/mapper/rootvg-homelv
10% /dev/sdz1
10% /dev/mapper/rootvg-data
10% /dev/mapper/rootvg-var_loglv

When you send via email, you must specify the MIME type.

1 Like