We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Batch script like system monitor for Centos

softbless
softbless asked
on
Medium Priority
450 Views
Last Modified: 2012-08-13
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.
Comment
Watch Question

CERTIFIED EXPERT

Commented:
SAR is a utility that may be very useful for you.

http://www.howtoforge.com/sysstat_monitoring_centos
Top Expert 2011

Commented:
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
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
cacti.net is a tool that collects information and presents in a graphical way.

Author

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.
Top Expert 2011
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Top Expert 2011

Commented:

Author

Commented:
thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.