From c8c277200169dfadf88dd176e5c056967550e059 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 25 Aug 2019 03:49:35 +0200 Subject: Add remote services --- archive/scriptlib/check_server_status.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 archive/scriptlib/check_server_status.sh (limited to 'archive/scriptlib/check_server_status.sh') diff --git a/archive/scriptlib/check_server_status.sh b/archive/scriptlib/check_server_status.sh new file mode 100755 index 0000000..791ad12 --- /dev/null +++ b/archive/scriptlib/check_server_status.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +fs=`df -m | grep /dev/sda2 | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4` +mem=`free -m | grep "buffers/cache" | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4` +cpu=`uptime | sed -e "s/[[:space:]]/\n/g" | tail -n 1` + +if [ $fs -le 8192 ]; then + echo "Only $(($fs / 1024)) GB left in the file system" +fi + +if [ $mem -le 128 ]; then + echo "The system is starving on memory, $mem MB left free" +fi + +#Multiply by number of CPU cores +if [ `echo "$cpu < 0.98" | bc` -eq 0 ]; then + echo "The system is starving on cpu, $cpu is load average for the last 15 min" +fi -- cgit v1.2.3