Sponsored Content
Top Forums Shell Programming and Scripting Bash script affect load average Post 302817597 by capilla on Thursday 6th of June 2013 05:30:24 AM
Old 06-06-2013
Bash script affect load average

Hello
I have created next scritpt to do the next: chekp if host is alive. When the host down, launch telnet other equip to do checks.
When execute the script the load average of the machines increase. For example:
Before launch script
Code:
top - 11:14:56 up 14 days, 18:06,  3 users,  load average: 2.66, 2.52, 2.26
Tasks: 251 total,   2 running, 234 sleeping,   0 stopped,  15 zombie
Cpu(s):  7.0%us, 10.3%sy, 25.7%ni, 56.9%id,  0.0%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:   3097180k total,  2782136k used,   315044k free,   182920k buffers
Swap:  3903480k total,      624k used,  3902856k free,  2064220k cached

After 10 min launch the script
Code:
top - 11:24:09 up 14 days, 18:15,  3 users,  load average: 3.88, 3.48, 2.85
Tasks: 250 total,   2 running, 230 sleeping,   0 stopped,  18 zombie
Cpu(s): 20.5%us, 25.3%sy,  0.2%ni, 53.8%id,  0.0%wa,  0.1%hi,  0.2%si,  0.0%st
Mem:   3097180k total,  2797204k used,   299976k free,   183912k buffers
Swap:  3903480k total,      624k used,  3902856k free,  2067728k cached

After 3 hours the load average can be 17 or more.
What is the problem with the script? It's the | ? the sleps??
The script:
Code:
#!/bin/bash
HOSTS="198.19.1.174"
COUNT=1
COUNT2=1
COUNT3=0
USER="****"
PASS="****"
#touch result$COUNT3.txt
function bucle(){
while [  $COUNT2 -lt 10 ];
do
  count=$(ping -c $COUNT $HOSTS | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
  if [ $count -eq 0 ]; then
    # 100% failed
    echo "Host : $myHost is down (ping failed) at $(date)"
( echo open 198.19.1.174
sleep 2;
echo ${USER}
sleep 2;
echo ${PASS}
sleep 2;
echo "sh clock"
sleep 2;
echo "ping vrf OOB 198.19.1.175"
sleep 2;
echo "ping vrf OOB 198.19.1.176"
sleep 2;
echo "sh ip arp vrf OOB vlan 1307 | i 198.19.1.175"
sleep 2;
echo "sh ip arp vrf OOB vlan 1307 | i 198.19.1.176"
sleep 2;
echo "sh mac-address-table interface gigabitEthernet 7/29"
sleep 2;
echo "sh mac-address-table interface gigabitEthernet 7/33"
sleep 2;
echo "sh clock"
sleep 2;) |telnet
( echo open 198.18.1.174
sleep 3;
echo ${USER}
sleep 3;
echo ${PASS}
echo "ping vrf OOB 198.19.1.175 source vlan 1207"
sleep 10;
echo "ping vrf OOB 198.19.1.176 source vlan 1207"
sleep 10;) |telnet
COUNT3=COUNT3+1
#echo $COUNT3
fi
done
}

bucle

Thanks!!!!!
 

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. Shell Programming and Scripting

Determening load average.

Hi, I'm new to shell scripting. I need to make a script to add on to my cronjobs. The script must get the value of load average from my server and if its greater than 10 it should stop my apache service. I cant find a way to get the value of load average in integer type to do the check. Any... (4 Replies)
Discussion started by: jibsonline
4 Replies

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

30 Load average with fping script

Hi! I've make a script that gets a list of 200 Ip's and calls another script once per ip in a infinite loop with a pause of 10 seconds. So It calls over 200 times every 10 seconds the second script (that makes a fping). But this cause a load average of 30. I've been reading about this and I... (4 Replies)
Discussion started by: charlscross
4 Replies

8. 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

9. 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

10. Shell Programming and Scripting

Script to load daily average I/O stats from a .ksh file into Oracle db

Hi can anyone help me with a script to load output of the .ksh file into an Oracle database. I have attached sample output of the information that i need to load to the database (2 Replies)
Discussion started by: LucyYani
2 Replies
hostinfo(8)						    BSD System Manager's Manual 					       hostinfo(8)

NAME
hostinfo -- host information SYNOPSIS
hostinfo DESCRIPTION
The hostinfo command displays information about the host system on which the command is executing. The output includes a kernel version description, processor configuration data, available physical memory, and various scheduling statistics. OPTIONS
There are no options. DISPLAY
Mach kernel version: The version string compiled into the kernel executing on the host system. Processor Configuration: The maximum possible processors for which the kernel is configured, followed by the number of physical and logical processors avail- able. Note: on Intel architectures, physical processors are referred to as cores, and logical processors are referred to as hardware threads; there may be multiple logical processors per core and multiple cores per processor package. This command does not report the number of processor packages. Processor type: The host's processor type and subtype. Processor active: A list of active processors on the host system. Active processors are members of a processor set and are ready to dispatch threads. On a single processor system, the active processor, is processor 0. Primary memory available: The amount of physical memory that is configured for use on the host system. Default processor set: Displays the number of tasks currently assigned to the host processor set, the number of threads currently assigned to the host proces- sor set, and the number of processors included in the host processor set. Load average: Measures the average number of threads in the run queue. Mach factor: A variant of the load average which measures the processing resources available to a new thread. Mach factor is based on the number of CPUs divided by (1 + the number of runnablethreads) or the number of CPUs minus the number of runnable threads when the number of runnable threads is less than the number of CPUs. The closer the Mach factor value is to zero, the higher the load. On an idle system with a fixed number of active processors, the mach factor will be equal to the number of CPUs. SEE ALSO
sysctl(8) Mac OS X October 30, 2003 Mac OS X
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy