Following script to check the load on the server could be referred:-
This script will create a file called chkload wherein all the details will be saved in a time and date
format. Any irregularities could be checked.
———————————————————————
### Script is created to check the load on server ###
echo >> chkload
echo ” Load `date +” on “%d-%m-%y” at “%H-%M` ” >> chkload
echo “—— Load detail from top ——–” >> chkload
#####added to display the top result
/usr/bin/top -n 1 -b >> chkload
uptime >> chkload
echo “—— End of top ——–” >> chkload
echo >> chkload
echo “—— Memory Free ——–” >> chkload
free -m >> chkload
echo >> chkload
echo “—— CPU Detail ——–” >> chkload
sar | head -n 3 >> chkload
sar | tail -n 5 >> chkload
echo >> chkload
echo “———– Few important Process Detail ————” >> chkload
echo >> chkload
ps aux | egrep -v “STIME|$LOGNAME” | head -n 6 >> chkload
echo >> chkload
echo “—————————————————————————————” >> chkload
echo “—————————————————————————————” >> chkload