diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2020-01-22 03:16:06 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2020-01-22 03:16:06 +0100 |
commit | 1e8153c2af051ce48d5aa08d3dbdc0d0970ea532 (patch) | |
tree | 7bb1441a87521aa8c3c5524f95fa645850a6826e /roles/ands_monitor/templates/scripts/check_server_status.sh.j2 | |
parent | e0b1b53f21095707af87a095934e971d788a90c7 (diff) | |
download | ands-1e8153c2af051ce48d5aa08d3dbdc0d0970ea532.tar.gz ands-1e8153c2af051ce48d5aa08d3dbdc0d0970ea532.tar.bz2 ands-1e8153c2af051ce48d5aa08d3dbdc0d0970ea532.tar.xz ands-1e8153c2af051ce48d5aa08d3dbdc0d0970ea532.zip |
Document another problem with lost IPs and exhausting of SDN IP range
Diffstat (limited to 'roles/ands_monitor/templates/scripts/check_server_status.sh.j2')
-rwxr-xr-x | roles/ands_monitor/templates/scripts/check_server_status.sh.j2 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/roles/ands_monitor/templates/scripts/check_server_status.sh.j2 b/roles/ands_monitor/templates/scripts/check_server_status.sh.j2 index c2849f4..e49ec97 100755 --- a/roles/ands_monitor/templates/scripts/check_server_status.sh.j2 +++ b/roles/ands_monitor/templates/scripts/check_server_status.sh.j2 @@ -4,6 +4,8 @@ fs=`df -lm / | grep -vi Filesystem | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' - datafs=`df -lm /mnt/ands | grep -vi Filesystem | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4` mem=`free -g | grep "Mem" | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 7` cpu=`uptime | sed -e "s/[[:space:]]/\n/g" -e s/,/./g | tail -n 1` +max_cpu=$(cat /proc/cpuinfo | grep processor | tail -n 1 | cut -d ':' -f 2) +cpu_usage=$(echo "100 * $cpu / ( $max_cpu + 1)" | bc) #" if [ $fs -le 8192 ]; then echo "Only $(($fs / 1024)) GB left in the root file system" @@ -17,8 +19,8 @@ if [ $mem -le 16 ]; then echo "The system is starving on memory, $mem GB left free" fi -if [ `echo "$cpu < 20" | bc` -eq 0 ]; then - echo "The system is starving on cpu, $cpu is load average for the last 15 min" +if [ `echo "$cpu_usage < 80" | bc` -eq 0 ]; then + echo "The system is starving on cpu, $cpu ($cpu_usage%) is load average for the last 15 min" fi vol=$(/opt/MegaRAID/storcli/storcli64 /c0/v0 show | grep -P "^0/0" | grep "Optl" | wc -l) |