Hi Friends,
The same we did for BDF in HPUX, we can use df -khl in Linux. this can save and send through mail.
echo "**************" > /tmp/resource.csv
echo "Resource Utilization and Uptime" >> /tmp/resource.csv
echo "**************" >> /tmp/resource.csv
echo "Total Space allocated in GB" >> /tmp/resource.csv
df -khlT | awk '{if(NF==1){l=$0;getline;sub(" *"," ");print l$0}else print}' |awk '{print $3/1048576 }' | awk '{sum += $1} END {print sum}' >> /tmp/resource.csv
echo "Total Space Used in GB" >> /tmp/resource.csv
df -khlT | awk '{if(NF==1){l=$0;getline;sub(" *"," ");print l$0}else print}' |awk '{print $4/1048576 }' | awk '{sum += $1} END {print sum}' >> /tmp/resource.csv
echo "uptime report " >> /tmp/resource.csv
uptime >> /tmp/resource.csv
later you can use this .csv file as a o/p using mailx/mutt or sendmail
Love Sharing
Amit Chopra
The same we did for BDF in HPUX, we can use df -khl in Linux. this can save and send through mail.
echo "**************" > /tmp/resource.csv
echo "Resource Utilization and Uptime" >> /tmp/resource.csv
echo "**************" >> /tmp/resource.csv
echo "Total Space allocated in GB" >> /tmp/resource.csv
df -khlT | awk '{if(NF==1){l=$0;getline;sub(" *"," ");print l$0}else print}' |awk '{print $3/1048576 }' | awk '{sum += $1} END {print sum}' >> /tmp/resource.csv
echo "Total Space Used in GB" >> /tmp/resource.csv
df -khlT | awk '{if(NF==1){l=$0;getline;sub(" *"," ");print l$0}else print}' |awk '{print $4/1048576 }' | awk '{sum += $1} END {print sum}' >> /tmp/resource.csv
echo "uptime report " >> /tmp/resource.csv
uptime >> /tmp/resource.csv
later you can use this .csv file as a o/p using mailx/mutt or sendmail
Love Sharing
Amit Chopra
No comments:
Post a Comment