calculate swap space usage in Solaris and converts it in Percentage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calculate swap space usage in Solaris and converts it in Percentage
# 1  
Old 11-06-2010
calculate swap space usage in Solaris and converts it in Percentage

Hi Folks,

I am looking for a way to write a script to calculate swap usage in Solaris so that the current usage will be shown in Percentage value. Thanks!!

Based on 'swap -s' command

Code:
# swap -s
total: 1378936k bytes allocated + 1236880k reserved = 2615816k used, 2725104k available

# 2  
Old 11-06-2010
swap -l ok?
Code:
 swap -l | tail -1 | awk '{ printf("%.2f\n", 100 * ($5/$4))}'

# 3  
Old 11-06-2010
Hi Jim,

Thanks for the effort, but the output looks wrong when I executed in my Solaris box.

Code:
swap -l | tail -1 | awk '{ printf("%.2f\n", 100 * ($5/$4))}'
100.00


This is output for swap -s

Code:
swap -s
total: 140936k bytes allocated + 9448k reserved = 150384k used, 43186440k available


Cheers!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calculate Percentage

Hello, Ive got a bunch of numbers here e.g: 6065 6094 6348 6297 6161 6377 6338 6290 How do I find out if there is a difference between 10% or more between one of these numbers ? I am trying to do this in Bash.. but no luck so far.. Does anyone have an Idea ?? Thanx, - Pascal... (9 Replies)
Discussion started by: denbekker
9 Replies

2. Solaris

Swap space in Solaris box

Hello Team, By the way of introduction, I am new member in this forum and proud too :) Here is my questions: In one of our Solaris Sparc v9 box, we are facing issues related to swap space. Our custom applications are using swap space even though physical memory is available. From some... (3 Replies)
Discussion started by: piyush_28
3 Replies

3. Solaris

Solaris 10 SWAP SPACE

We have a SPARC system which is running on Solaris-9 and Physical memory size is 16GB.We have allocated 32GB SWAP space(2 times of physical memory).But when we use df -h command it shows following output and SWAP space size shows more than our allocated space # df -h Filesystem size used... (2 Replies)
Discussion started by: cyberdemon
2 Replies

4. Solaris

Releasing the swap space Solaris

Hi Guys ! I have found this problem many times that the swap space (/tmp space more precisely )of my Server becomes full specially when i run a complete back up of the server . once the /tmp space is full I am not able to run simple commands as i get error like : fork no space on... (4 Replies)
Discussion started by: Paarth
4 Replies

5. Solaris

Releasing the swap space Solaris

Hi Guys ! I have found this problem many times that the swap space (/tmp space more precisely )of my Server becomes full specially when i run a complete back up of the server . once the /tmp space is full I am not able to run simple commands as i get error like : fork no space on... (6 Replies)
Discussion started by: Paarth
6 Replies

6. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

7. UNIX for Advanced & Expert Users

allocating swap space on solaris 9

Hi, I have a solaris 9-sparc box, which after bouncing is giving swap space related error messages(that swap space is not enough). could it be possible that there was some command issued or setting made before bouncing, which was lost after bouncing? please let me know how i can add swap space... (1 Reply)
Discussion started by: 0ktalmagik
1 Replies

8. Shell Programming and Scripting

swap space and cpu usage for an application

Hi, How do i get the swap space used and cpu usage for a particular application ? thanks una (2 Replies)
Discussion started by: una
2 Replies

9. UNIX for Dummies Questions & Answers

creating swap space under Solaris 2.6

I just finished installing Solaris 2.6 and several applications just to realize that I made a bonehead mistake during the install. When setting up the filesystems, I entered /tmp and no swap! Is it possible to permanantly declare the entire /tmp partition as swap? I am guessing an entry in the... (4 Replies)
Discussion started by: 98_1LE
4 Replies
Login or Register to Ask a Question