The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Monitoring Script manoj.solaris SUN Solaris 4 07-27-2007 08:27 AM
Process Monitoring Script Help rdc69 Shell Programming and Scripting 0 08-30-2006 06:55 PM
monitoring script gfhgfnhhn UNIX for Advanced & Expert Users 1 07-14-2006 12:10 PM
Job monitoring script Love High Level Programming 1 06-13-2006 09:56 AM
monitoring script legato UNIX for Dummies Questions & Answers 3 03-21-2005 07:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-24-2005
alpha_manic alpha_manic is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 5
CPU monitoring script

I looking for a very basic, script that monitors the load on the cpu and writes it to a text file.


Can anyone help please?
  #2 (permalink)  
Old 08-24-2005
Sergiu-IT's Avatar
Sergiu-IT Sergiu-IT is offline
Registered User
  
 

Join Date: Mar 2005
Location: Transilvania
Posts: 133
Post

Quote:
Originally Posted by alpha_manic
I looking for a very basic, script that monitors the load on the cpu and writes it to a text file.
Can anyone help please?
Code:
$ top -d2 | awk '/CPU states/'
CPU states:  7.8% user,  0.0% nice,  1.2% system,  1.2% interrupt, 89.8% idle
$
This shows you the load of the CPU. If you want to redirect the output to some file and use it in some shell script you can do it like this:

Code:
# !/bin/sh
top -d2 | awk '/CPU states/' >> file.log
After you changed the file permissions to have "execute" rights, add it to /etc/crontab to run it every minute/hour/day...
  #3 (permalink)  
Old 08-24-2005
alpha_manic alpha_manic is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 5
top -d2 | awk '/CPU states/'

This code, put the xterm into halt mode. I can't see the output????
  #4 (permalink)  
Old 08-24-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Try using this:

Code:
#!/usr/bin/ksh
uptime >> some_log_file
The rest of the things are just as posted by Sergiu. You can schedule it in cron or whatever..
  #5 (permalink)  
Old 08-25-2005
izy100 izy100 is offline
Registered User
  
 

Join Date: Nov 2002
Location: Singapore
Posts: 128
use something tried and proven.
Do a search in google "System Activity reporter".
All unix has this... You gota turn it on.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:38 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0