CUP and Memory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CUP and Memory
# 1  
Old 03-05-2008
MySQL CUP and Memory

Hi All Unix experts,

I want to calculate CUP Utilization and Memory Utilization on solairs boxes.
Please help me to write a script for this, since i am doing this manualy for more than 30 servers daily.

My daily task is

# top
last pid: 28627; load avg: 8.50, 8.12, 8.16; up 100+18:32:56 11:46:38
2033 processes: 2022 sleeping, 1 zombie, 1 stopped, 9 on cpu
CPU states: 45.1% idle, 26.2% user, 27.6% kernel, 1.2% iowait, 0.0% swap
Memory: 32G phys mem, 875M free mem, 16G swap, 16G free swap

CPU Utilization = (100 - ideal value)%

and for memory is

Momory = (Physical memory - Free Momory) / Physical Memory

Please friends i would like to know how we can make it script for this..

I will rally very greatful if u help me on this......!

Thanks in advance
# 2  
Old 03-05-2008
Advice me plz

Could any one help me on this
# 3  
Old 03-05-2008
CUP or CPU ?
Momory or Memory ?
Solairs or Solaris ?

Please check your message ... Smilie
# 4  
Old 03-05-2008
Cpu

you are very well know what i am coming to say..! then y can't help me..?
# 5  
Old 03-05-2008
I'm guessing that he's trying to point out that you are in breach of a couple of rules of the forum (https://www.unix.com/unix-dummies-que...om-forums.html) - in particular 4

The overall cpu information in top is hard to capture properly as it's generated only while top is running interactively.
You can get the memory info out though as follows:
Code:
#!/bin/sh
line=`top | grep 'Memory: '`
phys=`echo $line | awk '{ print $2 }' | sed 's/G/ \* 1048576/' | sed 's/M/ \* 1024/' | bc`
free=`echo $line | awk '{ print $4 }' | sed 's/G/ \* 1048576/' | sed 's/M/ \* 1024/' | bc`
echo "scale=3
($phys - $free) / $phys * 100" | bc

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Football / Soccer World Cup 2018 draw.

What is on Your Mind? 2018 FIFA World Cup - Wikipedia I'm hoping that England are drawn into positions B2, D3, G3 or G4 so that all their games will be outside usual UK office hours and people will not desert the office with mystery illnesses to watch the games. Expecting failure, so I... (1 Reply)
Discussion started by: rbatte1
1 Replies

2. Shell Programming and Scripting

Tput cup, print on current line?

Heyas I'm thinking about a new approach for my core display, basicly as it should make aligments easier. Issue i'm currently facing, is tput cup capable of printing on the current line? My best achievements were: :) tui $ tput cup - 60;echo " ------ testing" ------ testing... (5 Replies)
Discussion started by: sea
5 Replies

3. What is on Your Mind?

Place your bits - ICC World Cup Twenty20 (Cricket)

Who will win ICC World Cup Twenty20 These are the last four teams. Sri Lanka Pakistan Australia West Indies There is an open event in the Event Prediction Forum. The event closes on 6th October 2012. ICC World Cup Twenty20 (0 Replies)
Discussion started by: ni2
0 Replies

4. What is on Your Mind?

Place your bets! - Ryder Cup 2012 (Golf)

Who will win the 2012 Ryder Cup. Europe vs USA There is an open event in the Event Prediction Forum. The event closes on 27th Sep 2012. 2012 Ryder Cup - Wikipedia, the free encyclopedia (0 Replies)
Discussion started by: ni2
0 Replies

5. Hardware

CUP CHIP and CPU ID

Hi All, What is the difference between CPU CHIP and CUP ID on SUN/ Oracle M5000 servers.. Thanks in advance (1 Reply)
Discussion started by: kumarmani
1 Replies

6. What is on Your Mind?

Which team will win the 2010 World Cup final?

Spain or the Netherlands? (12 Replies)
Discussion started by: Neo
12 Replies

7. What is on Your Mind?

Which team do you think will win the World Cup 2010?

Well, I'm going to free myself a bit from Unix-ish stuff. :D Which is your favorite team? Are you supporting your local team? IMO, I think Italy and Spain have great chances. Both teams have a great formation and players; Recently I was watching some of their matches and their gameplay is... (0 Replies)
Discussion started by: verdepollo
0 Replies

8. SCO

how can I get the system information such as cup,memory,ports etc?

In the sco unix ,how can i get the system information ? such as cpu,memory,interrupter,io ports etc look forword to quick replay (2 Replies)
Discussion started by: fresh
2 Replies
Login or Register to Ask a Question