Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Batch script like system monitor for Centos

Posted on 2011-04-25
7
Medium Priority
?
439 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.
0
Comment
Question by:softbless
7 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35464273
SAR is a utility that may be very useful for you.

http://www.howtoforge.com/sysstat_monitoring_centos
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35464308
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
 
LVL 81

Expert Comment

by:arnold
ID: 35464557
cacti.net is a tool that collects information and presents in a graphical way.
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 

Author Comment

by:softbless
ID: 35465430
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
 
LVL 38

Accepted Solution

by:
wesly_chen earned 2000 total points
ID: 35465744
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
 
LVL 38

Expert Comment

by:wesly_chen
ID: 35465751
0
 

Author Closing Comment

by:softbless
ID: 35735091
thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question