How to check server's resource usage?



You can use following script :

======
root@magneto [/var/log]# cat resusage.sh
#!/bin/bash
top -b -c -n 1 >topresult
while read line

do
awk '{if( $9 >= 20 ) print $2 ":" $9 ":" $12 }' $line
done <"topresult"
root@magneto [/var/log]

cron :

* * * * * /bin/bash /var/log/resusage.sh 1>>/var/log/server_resusagewq.log

========================
flush log :

root@magneto [/var/log]# cat flush_server_resusage.sh
#!/bin/bash

rm -f /var/log/server_resusage.log
touch /var/log/server_resusage.log
echo "===================`date`===================" >>/var/log/server_resusage.log
root@magneto [/var/log]#

cron :
0 1 * * * /bin/bash /var/log/flush_server_resusage.sh

=========================
By : singlehop.com



Related Posts:



Responses

0 Respones to "How to check server's resource usage?"

Post a Comment

»Thank you for reading this article
If you have questions or comments, please leave a comment
»You can click on the Subscribe by email to subscribe comments of this post
»You can register directly link pictures, mp3, video on the comment form.
»You may use some HTML tags such
»Please post comments polite and typing accented Vietnamese if possible
»Thank the good faith comment

 

Categories

Recent Comments

Total Pageviews

Return to top of page ©Web Server Tips Tricks 2010 | Develop by Mr.PhanQuan .Powered by Blogger . All rights reserved.