Batch script like system monitor for Centos

Hello experts,

I need a script for utilization log of my server, those are: CPU usage, Memory, PID, Time on Centos.
You can see system monitor on Centos or Task Manager on Windows.
But I need this log every 5 minute created.

Thanks advanced.
softblessAsked:
Who is Participating?
 
wesly_chenConnect With a Mentor Commented:
man top
it has more details for those information. i.e.
PR  --  Priority
NI  --  Nice value
VIRT  --  Virtual Image (kb)
SHR  --  Shared Mem size (kb)
S  --  Process Status

man page of top has more details (I can not copy and paste the manpage here)

> How to see only 10 process?
#!/bin/sh

log_file=/tmp/utilization.log.`date +%Y%m%d_%H%M`

/usr/bin/top -b -n1 | head -17 > $log_file
0
 
farzanjCommented:
SAR is a utility that may be very useful for you.

http://www.howtoforge.com/sysstat_monitoring_centos
0
 
wesly_chenCommented:
For system monitoring, you can use Nagios
http://wiki.centos.org/HowTos/Nagios

It can log CPU usage , load, memory, process via NRPE.
And you can configure the threshold to alert sys admin.

Or you just want a script to login the system utilization, then here is the simpe one
--------- /home/user/utilization.sh ----
#!/bin/sh

log_file=/tmp/utilization.log.`date +%Y%m%d_%H%M`

/usr/bin/top -b -n1 > $log_file
--------------

Then
$ chmod +x /home/user/utilization.sh

and create cron job
$ crontab -e
--------------
*/5 * * * * /home/user/utilization.sh > /dev/null 2>&1
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
arnoldCommented:
cacti.net is a tool that collects information and presents in a graphical way.
0
 
softblessAuthor Commented:
Hi wesly_chen,

How to see only 10 process? So in log, there are 10 process every 5 minutes.
Btw, I don'y know about this PR  NI  VIRT  RES  SHR S. Can you explain me?

Thank you very much.
0
 
wesly_chenCommented:
0
 
softblessAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.