Here is a monitoring script that I would like for you to evaluate and give your opinion
if you think I should not run this script because in itself it takes up to much cpu resources please give your advice !
while true
do
uptime
echo "****THE TOP 10 PROCESSES THAT HAVE THE MOST RECENT CPU USAGE****"
ps -ef|head -n 1;ps -ef|egrep -v "C|0:00|\ 0\ "|sort +3b -4 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 PROCESSES THAT HAVE ACCUMULATED THE MOST CPU TIME****"
ps -ef|head -n 1;ps -e|egrep -v "TIME|0:"|sort +2b -3 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 PROCESSES THAT HAVE THE MOST CPU USAGE****"
ps gu|head -n 1;ps gu|egrep -v "CPU|kproc"|sort +2b -3 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 ALLOCATED CPU TIME TO A PROCESS SINCE STARTED****"
ps au|head -n 10
sleep 5
clear
lpstatlocal
lpstat -a000
lpstat -a001
lpstat -a002
lpstat -a003
sleep 5
clear
done
exit
if you think I should not run this script because in itself it takes up to much cpu resources please give your advice !
while true
do
uptime
echo "****THE TOP 10 PROCESSES THAT HAVE THE MOST RECENT CPU USAGE****"
ps -ef|head -n 1;ps -ef|egrep -v "C|0:00|\ 0\ "|sort +3b -4 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 PROCESSES THAT HAVE ACCUMULATED THE MOST CPU TIME****"
ps -ef|head -n 1;ps -e|egrep -v "TIME|0:"|sort +2b -3 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 PROCESSES THAT HAVE THE MOST CPU USAGE****"
ps gu|head -n 1;ps gu|egrep -v "CPU|kproc"|sort +2b -3 -n -r|head -n 10
sleep 5
clear
echo "****THE TOP 10 ALLOCATED CPU TIME TO A PROCESS SINCE STARTED****"
ps au|head -n 10
sleep 5
clear
lpstatlocal
lpstat -a000
lpstat -a001
lpstat -a002
lpstat -a003
sleep 5
clear
done
exit