Created
September 2, 2013 15:18
-
-
Save rahulinux/6413978 to your computer and use it in GitHub Desktop.
check load average of server and return if load more than 6 or passed threshold to the function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CheckLoadadv() { | |
# Set threshold value | |
local Threshold=$1 | |
# if threshold not specify then take deafault 6 | |
(( $Threshold )) || Threshold=6 | |
# get input values from /proc/loadavg file | |
local Current_loadadv="$(cut -d" " -f1 /proc/loadavg )" | |
# take first value from inputdata | |
local Cur_int_loadadv="${Current_loadadv/.*}" | |
if (( $Cur_int_loadadv >= $Threshold )); then | |
return 1 | |
else | |
return 0 | |
fi | |
} | |
CheckLoadadv $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment