Calculating Swap percentage utilization


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Calculating Swap percentage utilization
# 1  
Old 05-30-2011
Calculating Swap percentage utilization

Hello All,

I am trying to create a script that will give me the processes that consume swap in %.

i am using the below line to get it done.

Code:
virtual=`echo "$virtual/$swp*100"|bc -l|sed -e "s/\(\.[0-9][0-9][0-9]\).*/\1/g"`

but getting the following output after running it.

.039
.110

I want the output like below.

0.039
0.110
2.233
0.112

So that using cut i will compare the threshhold of swap.

Kindly help in this.

Regards

Ankit
# 2  
Old 05-30-2011
You could make use of printf
Code:
$ printf "%0.3f\n" ".039"
0.039
$

# 3  
Old 05-30-2011
y dont you try 'sar -W'
# 4  
Old 05-30-2011
But i m looking for processes.

Regards
Ankit
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Working out percentage of memory utilization

Hi there I am middle of writing a script to allow me to see the % of the memory which is being used. When I submit my script I don't get any errors but I just get a blank output. Any pointers? available=`free -m | grep available` if then ... (7 Replies)
Discussion started by: simpsa27
7 Replies

2. Red Hat

Incorrect Percentage for Memory Utilization.

I am running the command /usr/bin/free -b | awk '/Mem:|cache:/ {print $2,$3}' | sed 'N;s/\n/ /' | awk '{print ($4*100)/$1}' to find out Memory utilization, it is showing 205%, please suggest me what changes are required, below is output of free -b command. $ free -b total ... (2 Replies)
Discussion started by: manoj.solaris
2 Replies

3. Red Hat

CPU Utilization and Memory Utilization of Services and Applications

Hi, i am new to linux/RHEL 6.0 and i have two questions. 1) How to get the CPU utilization and Memory Utilization of all Services running currently? 2) How to get the CPU utilization and Memory Utilization of all Applications running currently? Please help me to find the script. ... (2 Replies)
Discussion started by: nossam
2 Replies

4. UNIX for Dummies Questions & Answers

Memory & Swap utilization

Hi All, We have a sparc server for which we always recieve memory utilization alerts. (97.01% available memory used by the partition (/MEMORY/MEMORY/MEMUsedMemPerc)). But when we check the server using prstat and vmstat the meory utilization is normal and swap space utilization is also normal.... (1 Reply)
Discussion started by: Rockyc3400
1 Replies

5. Solaris

Solaris 10 : how to find swap utilization ?

hi, I want to find swap utilization on a solaris 10 box. can someone please help. Thanks, Priyank (4 Replies)
Discussion started by: arorap
4 Replies

6. HP-UX

add new column by calculating percentage used

hi.. DS_ID | PRIMARYDISKID | SPUID | GB_USED | GB_SIZE -------+---------------+-------+---------------+------------ 1 | 1027 | 1107 | 82.5849609375 | 356.203125 2 | 1048 | 1107 | 77.1767578125 | 356.203125 this is file having GB_USED , GB_SIZE two... (4 Replies)
Discussion started by: netdbaind
4 Replies

7. Shell Programming and Scripting

Calculating the epoch time from standard time using awk and calculating the duration

Hi All, I have the following time stamp data in 2 columns Date TimeStamp(also with milliseconds) 05/23/2012 08:30:11.250 05/23/2012 08:30:15.500 05/23/2012 08:31.15.500 . . etc From this data I need the following output. 0.00( row1-row1 in seconds) 04.25( row2-row1 in... (5 Replies)
Discussion started by: ks_reddy
5 Replies

8. UNIX for Advanced & Expert Users

Memory Utilization swap and page scan

Hi, on AIX 6 , how to see : Memory Utilization Memory Page Scan Rate Swap Utilization Thank you. (2 Replies)
Discussion started by: big123456
2 Replies

9. Shell Programming and Scripting

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 # swap -s total: 1378936k bytes allocated + 1236880k reserved = 2615816k used, 2725104k available (2 Replies)
Discussion started by: jaapar
2 Replies

10. HP-UX

Checking server swap utilization

Hey guys which is accurate in checking the servers swap utilization is it swapinfo or memdetail?:confused: (1 Reply)
Discussion started by: sbn
1 Replies
Login or Register to Ask a Question