Monitoring the output of 'top' command on hourly basis. | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Monitoring the output of 'top' command on hourly basis.

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 08-19-2009
subharai subharai is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 3 March 2010, 3:51 PM EST
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Monitoring the output of 'top' command on hourly basis.

I need to capture the following data on an hourly basis through cronjob scheduling:-

1. load averages
2. Total no. of processes.
3. CPU state
4. Memory
5. Top 3 process details.

All the above information is available through the command 'top'. But here we need to automate the same and save it in a log file for the purpose of monitoring the server performance.

Please find the below data which exactly I need to capture:-


Code:
 
load averages:  0.30,  0.29,  0.24                                          
90 processes:  88 sleeping, 2 on cpu
CPU states: 97.7% idle,  1.7% user,  0.6% kernel,  0.0% iowait,  0.0% swap
Memory: 16G real, 11G free, 3333M swap in use, 13G swap free
   PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
 29490 oms1      47   0   12  172M  140M cpu/0   55:40  0.75% java
  2436 sroy       1  59    0 7208K 6088K cpu/8    0:54  0.52% top
  2482 avijay     1  32    0 7080K 5960K sleep    0:01  0.26% top

Request you to please provide some idea or any automation script how the above activity can be performed.

Thank you all in advance.

---------- Post updated at 11:06 PM ---------- Previous update was at 10:54 PM ----------

Sorry for not mentioning, the requirement is for Solaris 10 environment.
Sponsored Links
    #2  
Old 08-19-2009
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is offline Forum Staff  
Soulman
 
Join Date: Jul 2006
Last Activity: 18 April 2014, 4:06 AM EDT
Location: Berlin, Germany
Posts: 5,327
Thanks: 52
Thanked 223 Times in 217 Posts
i'll recommend SAR for doing this...

System Activity Reporter (sar)
Sponsored Links
    #3  
Old 08-19-2009
seg seg is offline Forum Advisor  
Registered User
 
Join Date: Aug 2003
Last Activity: 22 December 2009, 12:41 AM EST
Posts: 260
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by subharai View Post
1. load averages
2. Total no. of processes.
3. CPU state
4. Memory
5. Top 3 process details.

1: `w|head -1`
2: `ps -e|wc -l`
3&4: `vmstat 1 2|tail -1`
5: `ps -elfy|sort +4n -r|head -3`


EDIT:
Duke is right, `sar` is the best way to do this.
    #4  
Old 08-24-2009
asalman.qazi asalman.qazi is offline
Registered User
 
Join Date: Jul 2009
Last Activity: 7 April 2010, 6:19 AM EDT
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Probably you can write a cron job which updates a log file as

top >> monitor.log

schedule it to run every 5 min or desired frequency.

This must help
Sponsored Links
    #5  
Old 09-02-2009
soliberus soliberus is offline
Registered User
 
Join Date: Oct 2004
Last Activity: 29 November 2011, 11:25 AM EST
Posts: 117
Thanks: 0
Thanked 1 Time in 1 Post

Code:
# Run top every minute for 60 minutes
/usr/local/bin/top -c -s 60 -d 60 >> $TOPLOG

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Command display output on console and simultaneously save the command and its output satimis UNIX for Dummies Questions & Answers 7 01-25-2009 07:27 PM
Shortlived Process Don't Appear in 'top' or 'ps' deckard HP-UX 5 10-14-2008 01:33 PM
catpure output of 'top' in a file new2ss UNIX for Dummies Questions & Answers 1 11-06-2007 04:38 AM
HP-UX and 'top' deckard HP-UX 8 07-21-2005 05:04 PM
Dual CPU's and 'top' hcclnoodles UNIX for Dummies Questions & Answers 3 07-17-2003 01:15 PM



All times are GMT -4. The time now is 05:12 PM.