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
ruptime(1)						      General Commands Manual							ruptime(1)

NAME
ruptime - Displays the status of each host on a network SYNOPSIS
ruptime [-ar] [-l | -t | -u] ruptime [-ar] [-l | -t | -u] [machinename] The ruptime command displays the status of each host on a local network that is running the rwhod daemon. If machinename is specified, only the status of that machine is displayed. OPTIONS
Includes all users. Without this option, users whose sessions are idle an hour or more are not included. Sorts the list by the load aver- age over 5-, 10-, and 15-minute intervals prior to a server's transmission. The load averages are multiplied by 10 to represent the value in decimal format. Reverses the sort order. Sorts the list by the length of uptime. Sorts the list by the number of users. DESCRIPTION
The status lines are sorted by hostname unless the -l, -t, or -u option is indicated. The status information is provided in packets broad- cast once every 3 minutes by each network host running rwhod. Any activity (such as the power to a host being turned on or off) that takes place between broadcasts is not reflected until the next broadcast. Hosts for which no status information is received for 11 minutes are reported as down. EXAMPLES
To get a status report on the hosts on the local network, enter: $ ruptime Information similar to the following is displayed: host1 up 5:15, 4 users, load 0.09, 0.04, 0.04 host2 up 7:45, 3 users, load 0.08, 0.07, 0.04 host3 up 2:28, 0 users, load 0.01, 0.02, 0.03 host4 up 3+01:44, 1 user, load 0.01, 0.02, 0.03 host7 up 7:43, 1 user, load 0.06, 0.12, 0.11 (Output may be formatted differently on your system.) To get a status report sorted by load average, enter: $ ruptime -l Information similar to the following is displayed: host2 up 7:45, 3 users, load 0.08, 0.07, 0.04 host1 up 5:18, 4 users, load 0.07, 0.07, 0.04 host7 up 7:43, 1 user, load 0.06, 0.12, 0.11 host3 up 2:28, 0 users, load 0.01, 0.02, 0.03 host4 up 3+01:44, 1 user, load 0.01, 0.02, 0.03 (Output may be formatted differently on your system.) FILES
Indicates data files received from remote rwhod daemons. SEE ALSO
Commands: rwho(1), rwhod(8) ruptime(1)
All times are GMT -4. The time now is 07:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy