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.
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?

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

/usr/bin/top -b -n1 | head -17 > $log_file
SAR is a utility that may be very useful for you.
For system monitoring, you can use 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/ ----

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

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

$ chmod +x /home/user/

and create cron job
$ crontab -e
*/5 * * * * /home/user/ > /dev/null 2>&1
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: is a tool that collects information and presents in a graphical way.
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.
softblessAuthor Commented:
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.