Sponsored Content
Full Discussion: Determening load average.
Top Forums Shell Programming and Scripting Determening load average. Post 302116308 by sysgate on Thursday 3rd of May 2007 03:51:44 AM
Old 05-03-2007
Yes, do not cross-post please.
This was a hidden catch, just to see if you will get my example verbatim. Why I did that ? If you want to run such script, means you have root priviledges, means someone at your organization trust you, means you're not supposed to be a simple user.
I would also assume that the server you're running has only apache there, hence you want to switch it off when high load is determined. If not, how you can be sure that this is the application that causes the problem ?
In regards to the script - see "man test" for more information. Of course you can compare integer to integer, but bash doesn't have good handling of floating points generated from uptime. Therefore there are few solutions :
using awk in this manner :
Code:
if echo $loadhttpd | awk '{ if ($loadhttpd < '10') {print "10 is bigger then httpload"}}'; then

or using the korn shell, as it has floating point arithmetic since 1993.
I won't write more code, please, try think to about it, and be a real admin, not a user.
Regards and no bad feelings.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

load average

we have an unix system which has load average normally about 20. but while i am running a particular unix batch which performs heavy operations on filesystem and database average load reduces to 15. how can we explain this situation? while running that batch idle cpu time is about %60-65... (0 Replies)
Discussion started by: gfhgfnhhn
0 Replies

2. UNIX for Dummies Questions & Answers

Load Average

Hello all, I have a question about load averages. I've read the man pages for the uptime and w command for two or three different flavors of Unix (Red Hat, Tru64, Solaris). All of them agree that in the output of the 2 aforementioned commands, you are given the load average for the box, but... (3 Replies)
Discussion started by: Heathe_Kyle
3 Replies

3. UNIX for Dummies Questions & Answers

top - Load average

Hello, Here is the output of top command. My understanding here is, the load average 0.03 in last 1 min, 0.02 is in last 5 min, 0.00 is in last 15 min. By seeing this load average, When can we say that, the system load averge is too high? When can we say that, load average is medium/low??... (8 Replies)
Discussion started by: govindts
8 Replies

4. Solaris

load average query.

Hi, i have installed solaris 10 on t-5120 sparc enterprise. I am little surprised to see load average of 2 or around on this OS. when checked with ps command following process is using highest CPU. looks like it is running for long time and does not want to stop, but I do not know... (5 Replies)
Discussion started by: upengan78
5 Replies

5. UNIX for Dummies Questions & Answers

Please Help me in my load average

Hello AlL,.. I want from experts to help me as my load average is increased and i dont know where is the problem !! this is my top result : root@a4s # top top - 11:30:38 up 40 min, 1 user, load average: 3.06, 2.49, 4.66 Mem: 8168788k total, 2889596k used, 5279192k free, 47792k... (3 Replies)
Discussion started by: black-code
3 Replies

6. UNIX for Dummies Questions & Answers

Load Average threshold

What should be the threshold for load average of a quad core processor? What constitutes "good" and "bad" load average values? (2 Replies)
Discussion started by: proactiveaditya
2 Replies

7. UNIX for Advanced & Expert Users

Load average in UNIX

Hi , I am using 48 CPU sunOS server at my work. The application has facility to check the current load average before starting a new process to control the load. Right now it is configured as 48. So it does mean that each CPU can take maximum one proces and no processe is waiting. ... (2 Replies)
Discussion started by: kumaran_5555
2 Replies

8. Solaris

Load Average and Lwps

NPROC USERNAME SWAP RSS MEMORY TIME CPU 320 oracle 23G 22G 69% 582:55:11 85% 47 root 148M 101M 0.3% 99:29:40 0.3% 53 rafmsdb 38M 60M 0.2% 0:46:17 0.1% 1 smmsp 1296K 5440K 0.0% 0:00:08 0.0% 7 daemon ... (2 Replies)
Discussion started by: snjksh
2 Replies

9. UNIX for Dummies Questions & Answers

Help with load average?

how load average is calculated and what exactly is it difference between cpu% and load average (9 Replies)
Discussion started by: robo
9 Replies

10. HP-UX

Load average unit

Hi, On load average graph, unit is 100m, 200m, 300...800m. I don't understand what it means. Thx for helping (3 Replies)
Discussion started by: Michenux
3 Replies
TLOAD(1)							Linux User's Manual							  TLOAD(1)

NAME
tload - graphic representation of system load average SYNOPSIS
tload [-V] [-s scale] [ -d delay ] [tty] DESCRIPTION
tload prints a graph of the current system load average to the specified tty (or the tty of the tload process if none is specified). Options The -s scale option allows a vertical scale to be specified for the display (in characters between graph ticks); thus, a smaller value rep- resents a larger scale, and vice versa. The -d delay sets the delay between graph updates in seconds. FILES
/proc/loadavg load average information SEE ALSO
ps(1), top(1), uptime(1), w(1) BUGS
The -d delay option sets the time argument for an alarm(2); if -d 0 is specified, the alarm is set to 0, which will never send the SIGALRM and update the display. AUTHORS
Branko Lankester, David Engel <david@ods.com>, and Michael K. Johnson <johnsonm@redhat.com>. Please send bug reports to <procps-list@redhat.com> Cohesive Systems 20 Mar 1993 TLOAD(1)
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy