Check value of load balance dynamically


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check value of load balance dynamically
# 1  
Old 06-16-2011
Check value of load balance dynamically

Hi All,

I want to check load balance(or CPU utilzation) on server dynamically based on that value i want to perform some operation .
Means if load balance is <10 then start server .
Am using prstat -a 1
commadn it is listing CPU utilzation/load balancing dynamically ..
How to take this value in variable continueslly an dperform operation??
thanks in Advance

---------- Post updated at 04:17 AM ---------- Previous update was at 02:01 AM ----------

Please help...urgentlyyy...
# 2  
Old 06-16-2011
when ever, you post the question, post as much as possible.

i dont know what is the output format of the command
PHP Code:
prstat -a 1 
post the output here. and which value you need in variable.

then only we can able to help you
# 3  
Old 06-16-2011
bash-3.00$ prstat -a 1
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
25734 dsfad01 3782M 3535M cpu16 0 0 1:03:58 12% siebprocmw/7
20530 s2d0 2904M 2677M cpu19 0 0 1:10:19 12% db2sysc/1
10174 adcxy8b 4160K 3384K cpu18 40 0 0:00:18 6.4% prstat/1
2240 daemon 2864K 1680K sleep 60 -20 169:13:36 1.9% nfsd/7
5301 s2yb 3577M 3386M sleep 59 0 10:16:33 1.5% db2sysc/1
5356 s2yb 3582M 3395M sleep 59 0 4:30:53 1.2% db2sysc/1
10121 root 21M 9824K sleep 59 0 61:47:47 1.0% scopeux/1
5331 root 35M 21M sleep 59 0 32:53:23 0.5% irmulticol/1
2205 dsfad05 659M 486M sleep 59 0 4:41:45 0.5% java/88
10167 root 2008K 912K sleep 59 0 28:03:31 0.4% perf64/1
5330 root 17M 8208K sleep 59 0 26:54:32 0.4% iravcol/1
6316 s2yb 3578M 3387M sleep 59 0 6:27:00 0.3% db2sysc/1
2216 s2c8 2192M 2143M sleep 59 0 0:04:03 0.2% db2sysc/1
29522 dcrmd02 1130M 770M sleep 59 0 12:13:43 0.2% java/115
25763 dsfad01 406M 371M sleep 59 0 0:04:51 0.1% siebproc/3
1047 root 50M 23M sleep 59 -20 11:04:37 0.1% pdosd/42
2238 dsfad05 144M 111M sleep 29 10 1:04:49 0.1% pmserver/36
8216 dtaud02 1047M 774M sleep 59 0 7:56:17 0.1% java/132
8214 root 898M 656M sleep 59 0 9:30:52 0.1% java/112
14135 dtobd01 1448M 556M sleep 59 0 2:29:45 0.1% java/52
29813 davjd02 542M 327M sleep 59 0 2:56:21 0.1% java/88
2966 dsudd02 713M 436M sleep 59 0 3:48:10 0.1% java/88
5201 ddald02 570M 424M sleep 59 0 5:17:58 0.1% java/107
9486 root 387M 250M sleep 59 0 3:34:21 0.0% java/80
5082 root 383M 241M sleep 59 0 3:16:48 0.0% java/81
2203 dsfad05 292M 213M sleep 29 10 0:41:58 0.0% java/53
8215 root 395M 250M sleep 59 0 3:18:19 0.0% java/82
258 root 150M 15M sleep 59 0 3:44:42 0.0% nscd/43
10097 root 483M 298M sleep 59 0 3:05:52 0.0% java/79
4828 s2k8 2117M 2042M sleep 59 0 1:05:20 0.0% db2sysc/1
23488 s2yb 3572M 3491M sleep 59 0 2:14:19 0.0% db2sysc/1
23501 s2yb 3573M 3488M sleep 59 0 0:48:48 0.0% db2sysc/1
3869 ddsed01 2630M 964M sleep 59 0 0:08:37 0.0% java/44
6377 s2c8 2181M 2104M sleep 59 0 1:19:31 0.0% db2sysc/1
5739 s2d0 2888M 2810M sleep 49 0 2:30:41 0.0% db2sysc/1
8819 s2k8 2131M 2079M sleep 59 0 0:23:17 0.0% db2sysc/1
11905 ddsed01 2168M 572M sleep 59 0 0:27:41 0.0% java/40
8644 ddsed01 2171M 614M sleep 59 0 0:19:17 0.0% java/42
13408 dsfad05 169M 123M sleep 29 10 0:02:17 0.0% pmdtm/13
NPROC USERNAME SWAP RSS MEMORY TIME CPU
72 dsfad01 7969M 8400M 13% 3:21:30 13%
157 s2d0 6420M 4330M 6.6% 272:52:57 12%
11 adcxy8b 11M 18M 0.0% 0:00:18 6.4%
77 s2yb 4749M 3786M 5.8% 89:25:46 3.1%
120 root 3241M 3392M 5.2% 213:36:12 2.8%
7 daemon 11M 12M 0.0% 169:14:53 1.9%
11 dsfad05 1622M 1823M 2.8% 8:44:48 0.7%
201 s2c8 6326M 3542M 5.4% 30:03:56 0.3%
7 dcrmd02 2225M 1887M 2.9% 14:40:06 0.2%
8 dtobd01 1697M 1131M 1.7% 3:15:10 0.1%
1 dtaud02 787M 878M 1.3% 7:56:17 0.1%
8 ddsed01 6903M 2139M 3.3% 0:55:35 0.1%
3 davjd02 336M 390M 0.6% 2:56:22 0.1%
24 oraaev0t 940M 1027M 1.6% 1:27:56 0.1%
184 s2k8 5897M 3378M 5.2% 41:04:15 0.1%
Total: 964 processes, 12646 lwps, load averages: 3.07, 2.88, 2.99


It changes after one second
# 4  
Old 06-16-2011
Code:
 
prstat -Lc 1 1

run the below command, and see, whether it keep updates or not

Code:
prstat 1 1

if it shows for 1 second and comes out, then

Code:
 
prstat 1 1 | awk '{print $1,$9}'

which value you want exactly to store into variable ?

---------- Post updated at 02:12 PM ---------- Previous update was at 02:10 PM ----------

you want to capture the load averages: 3.07, 2.88, 2.99 ???????
# 5  
Old 06-16-2011
when i ran prstat -Lc 1 1
i got following o/p

bash-3.00$ prstat -Lc 1 1
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
5301 s2yb 3577M 3386M sleep 59 0 10:27:53 1.4% db2sysc/1
6316 s2yb 3578M 3387M sleep 59 0 6:37:57 1.2% db2sysc/1
10121 root 21M 9824K sleep 60 0 62:02:21 0.9% scopeux/1
6230 s2d0 2900M 2673M sleep 59 0 3:46:00 0.6% db2sysc/1
2240 daemon 2864K 1680K sleep 60 -20 1:36:37 0.4% nfsd/9287
5331 root 35M 21M sleep 59 0 33:01:25 0.4% irmulticol/1
2240 daemon 2864K 1680K sleep 60 -20 2:23:33 0.4% nfsd/9285
2205 dsfad05 659M 486M sleep 59 0 2:23:00 0.4% java/10
2240 daemon 2864K 1680K sleep 60 -20 2:30:44 0.4% nfsd/9284
2240 daemon 2864K 1680K sleep 60 -20 1:26:52 0.4% nfsd/9288
10167 root 2008K 912K sleep 59 0 28:10:17 0.4% perf64/1
5330 root 17M 8208K sleep 59 0 27:00:49 0.4% iravcol/1
2240 daemon 2864K 1680K sleep 60 -20 2:22:38 0.4% nfsd/9286
5356 s2yb 3582M 3395M sleep 59 0 4:41:55 0.3% db2sysc/1
23693 s2c8 2213M 2164M sleep 59 0 0:06:18 0.2% db2sysc/1
Total: 964 processes, 12670 lwps, load averages: 1.76, 2.03, 2.05

Load aveage is not column ..i want to cpature only 1.76 bold one..thanks

---------- Post updated at 04:58 AM ---------- Previous update was at 04:54 AM ----------

or else one thing i can do sort with username and CPU%?
take result CPU% in variable
Thanks
# 6  
Old 06-16-2011
Code:
prstat -Lc 1 1 | nawk ' /^Total/ {print substr($8,1,length($8)-1)}'

# 7  
Old 06-16-2011
you are genius ...will please explain it
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script fro file check and load the trail file

Hi, Im going to use shell script for load the data into DB. First i need to read the trail file(csv file has two columns with comma separated ) like file name trail1024(last 4 digitsMMDD). In this trail file 27 entries will have like below,I need to read first csv file name and get the 4... (1 Reply)
Discussion started by: krajasekhar.v
1 Replies

2. Shell Programming and Scripting

Check load and action

Hey everyone can you check this script logic ? it has to restart webservice if found server load is higher than X, also i have put it in crontab to run every one minute #!/bin/bash loadavg=$(uptime | awk -F "." '{ print $1 }' | awk -F ":" '{ print $5 }') if ; then pkill -9 httpd service... (7 Replies)
Discussion started by: nimafire
7 Replies

3. Shell Programming and Scripting

Balance the load of files across queues using shell script

Hi, I need to balance the load to be processed by the system using shell script. The scenario is like below: Suppose there are some files in a directory: -rw-rw-r-- 1 usr usrgrp 456432306 Oct 23 07:53 abc_queue_q1 -rw-rw-r-- 1 usr usrgrp 4123934 Oct 23 07:53... (1 Reply)
Discussion started by: vsachan
1 Replies

4. UNIX for Advanced & Expert Users

Autosys: Check the jil load time

Hi All, I wanted to know what time the box jobs were loaded into a particular Autosys Instance. Is there a autosys command to find out the above? (The timestamp at which a box was loaded) I had loaded my JIL script without outputting it to the log file. (4 Replies)
Discussion started by: grep_me
4 Replies

5. UNIX for Dummies Questions & Answers

mv load balance files

Ok so I have files that are going to land on /apps/, but I need to load balance them so I need to load balance them to four different folders. The three file extensions I get are .mpe .mpd and mpf which will land here... /apps/ I can't move them until the mpf is there it triggers the next... (8 Replies)
Discussion started by: xgringo
8 Replies

6. Linux

Load balance

Hello anybody know how use Load balance in linux? Summer (2 Replies)
Discussion started by: summerpeh
2 Replies

7. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

8. Shell Programming and Scripting

How to read a dynamically changing file and load into Oracle?

I have a tab delimited file which has 27 character fields. The file needs to be loaded into an Oracle table. But the challenge is that everytime the file comes it may or may not have values in all 27 fields. Column Definition of the 27 fields: TYPE: Char (1) NAME: Char (30) CUSTOM_VAL: Char... (8 Replies)
Discussion started by: madhunk
8 Replies

9. UNIX for Dummies Questions & Answers

load Balance

Guys im trying to create a script that will load ballance 3 devices. Unix is still very alien to me having only been in this position for 3 months now. Not to mention the fact that i've been thrown in the deep end. Anyway so far i've managed to make a script that looks at all 4 devices and make a... (1 Reply)
Discussion started by: yorkyboy
1 Replies
Login or Register to Ask a Question