Sponsored Content
Full Discussion: CPU utilisation in AIX
Top Forums Shell Programming and Scripting CPU utilisation in AIX Post 302801943 by Chubler_XL on Thursday 2nd of May 2013 05:29:35 PM
Old 05-02-2013
You could try running something like this every 5 mins with cron:

Code:
#!/bin/ksh
#
# Run via cron every 5 minutes
# send email if IDLE below LIMIT for more than CMAX times
#
INTERESTED=AIXsupport@your.company.com
HOST=$(hostname -s | tr '[a-z]' '[A-Z]')
IDLE=$(sar 5 6 | awk '$1~"Average"{printf "%.0d", $8}')
LIMIT=30
CMAX=4

CHKFILE=/tmp/cpu_check.txt

CPUCNT=0
[ -f $CHKFILE ] && read CPUCNT < $CHKFILE 

if [ $IDLE -lt $LIMIT ]
then
  let CPUCNT+=1
  [ $CPUCNT -eq $CMAX ] && echo "CPU usage has been above $((100 - LIMIT))% for longer than $((5*CMAX))mins" | mail -s "$HOST, Sustained high CPU usage: $((100 - IDLE))%" $INTERESTED
else
  [ $CPUCNT -ge $CMAX ] && echo "CPU usage has now returned to less than  $((100 - LIMIT))%" | mail -s "$HOST, CPU usage normalised: $((100 - IDLE))%" $INTERESTED
  CPUCNT=0
fi

echo "$CPUCNT" > $CHKFILE

You many have to tweak the below line to get correct idle CPU on AIX:

Code:
sar 5 6 | awk '$1~"Average"{printf "%.0d", $8}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need to know CPU utilisation

We have a Sun Sparc System which has multiple CPUs (4 Nos.). I need a command/program that can be used to monitor the % utilization per CPU. (2 Replies)
Discussion started by: saood
2 Replies

2. Linux

High Mem & Cpu Utilisation

Hi All, Kindly help me in optimizing the server as it displays a great amount of CPU & MEM being utilised when the mysql process executes. Below are the stats --- -------------------------------------------------------------------------- # top 15:51:57 up 23:22, 5 users, load average:... (1 Reply)
Discussion started by: gautamatul82
1 Replies

3. UNIX for Dummies Questions & Answers

Script for CPU and Memory Utilisation

Hi, I want to check the CPU and Memory Utilisation in the whole machine (not for a single process). Can someone send me a ready made script which captures all information in a log every 5min?? Thanks, Ajith (0 Replies)
Discussion started by: Ajith Praveen
0 Replies

4. Shell Programming and Scripting

Start a new process when memory/cpu utilisation falls

Hi all, I am a newbie to whole shell scripting thing. I deal with computational studies and a lot of softwares which run on linux. At times, I have to schedule my jobs after some process has started. In these case, I have to use at command to schedule my job. However, I would like to know if... (0 Replies)
Discussion started by: johnsmithgr8
0 Replies

5. AIX

%wait nmon CPU-UTILISATION

Hi, I collect statistics with nmon. I'm very suprised about % wait of processor. Number Of Processors: 4 Processor Clock Speed: 4204 MHz Do U have an idea about % wait ? │ 0----------25-----------50----------75----------100 ... (1 Reply)
Discussion started by: tagger
1 Replies

6. AIX

CPU and memory utilisation by one process

Hi, We need to monitor one process over time to see at which exact point it starts to consume to much memory and CPU (to correlate this with some other events). I am a newbie in AIX, so please could you tell me which command will give a snapshot of the current state of a process so that I... (1 Reply)
Discussion started by: yallow
1 Replies

7. UNIX for Dummies Questions & Answers

CPU Utilisation Report on Solaris 10

Hi all, I'm using Solaris 10 and have an occasional problem where a process that runs near to midnight each day, takes anywhere between 30 seconds and over two minutes to complete. I suspect that the CPU is highly utilised during the times where it takes a long time to complete, but I need a way... (3 Replies)
Discussion started by: wthomas
3 Replies

8. UNIX for Dummies Questions & Answers

Finding cpu utilisation

Hi , I need to find the average percentage of CPU utilisised by a particular process through a shell script. Suppose if a process is running for 6 hours i need to get average CPU utilised by it. Could you please assist me. Thanks, (0 Replies)
Discussion started by: praviper
0 Replies

9. Solaris

CPU Utilisation for Past 1 day

Hi, Can anyone tell me how to get the CPU utilisation for past 1 day in Solaris. Below is the version i m using SunOS ss1qeb 5.10 Generic_138889-03 i86pc i386 i86pc thanks in advance (2 Replies)
Discussion started by: ali560045
2 Replies

10. AIX

Overall cpu Utilisation

Hi, I need a command to check overall cpu utilisation TIA (3 Replies)
Discussion started by: sumanthupar
3 Replies
NBPERF(1)						    BSD General Commands Manual 						 NBPERF(1)

NAME
nbperf -- compute a perfect hash function SYNOPSIS
nbperf [-ps] [-a algorithm] [-c utilisation] [-h hash] [-i iterations] [-m map-file] [-n name] [-o output] [input] DESCRIPTION
nbperf reads a number of keys one per line from standard input or input. It computes a minimal perfect hash function and writes it to stdout or output. The default algorithm is "chm". The -m argument instructs nbperf to write the resulting key mapping to map-file. Each line gives the result of the hash function for the corresponding input key. The parameter utilisation determines the space efficiency. Supported arguments for -a: chm This results in an order preserving minimal perfect hash function. The utilisation must be at least 2, the default. The number of iterations needed grows if the utilisation is very near to 2. chm3 Similar to chm. The resulting hash function needs three instead of two table lookups when compared to chm. The utilisation must be at least 1.24, the default. This makes the output for chm3 noticable smaller than the output for chm. bpz This results in a non-order preserving minimal perfect hash function. Output size is approximately 2.79 bit per key for the default value of utilisation, 1.24. This is also the smallest supported value. Supported arguments for -h: mi_vector_hash Platform-independent version of Jenkins parallel hash. See mi_vector_hash(3). The number of iterations can be limited with -i. nbperf outputs a function matching uint32_t hash(const void * restrict, size_t) to stdout. The function expects the key length as second argument, for strings not including the terminating NUL. It is the responsibility of the call- er to pass in only valid keys or compare the resulting index to the key. The function name can be changed using -n name. If the -s flag is specified, it will be static. After each failing iteration, a dot is written to stderr. nbperf checks for duplicate keys on the first iteration that passed basic hash distribution tests. In that case, an error message is printed and the program terminates. If the -p flag is specified, the hash function is seeded in a stable way. This may take longer than the normal random seed, but ensures that the output is the same for repeated invocations as long as the input is constant. EXIT STATUS
The nbperf utility exits 0 on success, and >0 if an error occurs. SEE ALSO
mi_vector_hash(3) AUTHORS
Jorg Sonnenberger BSD
September 25, 2012 BSD
All times are GMT -4. The time now is 12:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy