LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-04-2009, 11:41 AM   #1
linuxaddict7
LQ Newbie
 
Registered: May 2008
Posts: 17

Rep: Reputation: 0
Smile Monitor a Process


Hello, I am looking for utility or ideas on how to monitor a process. If the process consumes, say 98% of CPU, I wanted to restart a service or run a script which will do some maintenance.

thanks in advance.

~LA
 
Old 09-04-2009, 11:43 AM   #2
Zarniwoop79
Member
 
Registered: Jul 2009
Location: Göteborg, Sweden
Distribution: Ubuntu
Posts: 37

Rep: Reputation: 3
Have you tried top? It shows memory usage, cpu usage etc, and lists the "heaviest" processes including the cpu usage.

If you just run it with "top" it keeps running and updates every 3 (?) seconds, but if you want to output the result to e.g. a file you can do

"top -b -n1", then it just updates the information once, and this can of course also be redirected to a file or a script.
 
Old 09-04-2009, 01:19 PM   #3
RaelOM
Member
 
Registered: Dec 2004
Posts: 110

Rep: Reputation: 16
Look into nagios. It has alert threashold and you can trigger actions on alerts. Not too difficult to setup if your an experienced UNIX Admin.

Otherwise, I would just write a script that would monitor the cpu utilization of the process.
 
Old 09-04-2009, 01:22 PM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

If the obligation of having to edit text files to configure Nagios then have a look at GroundWork OpenSource, it's based on Nagios 3.0 and has a very easy web interface to configure it.

Kind regards,

Eric
 
Old 09-08-2009, 09:40 AM   #5
linuxaddict7
LQ Newbie
 
Registered: May 2008
Posts: 17

Original Poster
Rep: Reputation: 0
I dont have Nagios infrastrature, but I would like to do it via cron. One of the main reason is, when its done thru agent/server, the cpu is at 99%, the agent may time out.

I looked at the top output, I can get a better output with ps, but my problem is I need monitor for pid for atleast say 3 minutes to restart the service.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to monitor process UltraSoul Linux - Software 1 11-20-2008 03:29 AM
Process monitor $@ya Programming 5 09-15-2005 11:57 AM
monitor process iclinux Programming 3 01-16-2005 02:00 PM
process monitor iclinux Programming 6 01-14-2005 09:35 PM
How do I monitor a process? mad_ady Linux - General 5 11-07-2003 09:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration