#!/bin/sh
> /tmp/report.csv
printf "\n" >> /tmp/report.csv
date_sar=`date | awk '{print $3}'`
echo "`hostname` = `date` " >> /tmp/report.csv
echo "============================" >> /tmp/report.csv
echo "CPU Average utilization" >> /tmp/report.csv
echo "------------------------" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
sar -u -f /var/log/sa/sa0$date_sar | grep -i "Average\|%idle" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
echo "Load Average : " >> /tmp/report.csv
echo "---------------" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
sar -q -f /var/log/sa/sa0$date_sar | grep -i "Average\|ldavg-15" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
echo "MEM Utilization " >> /tmp/report.csv
echo "---------------" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
free -g | grep -i "mem\|total" >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
echo "Memory utilization per process " >> /tmp/report.csv
echo "==============================" >> /tmp/report.csv
ps axo %mem,pid,euser,cmd | sort -r | head -n 10 | awk '{print $1" "$2" "$3" "$4}' >> /tmp/report.csv
printf "\n" >> /tmp/report.csv
echo "==========================================================================" >> /tmp/report.csv
No comments:
Post a Comment