summaryrefslogtreecommitdiffstats
path: root/archive
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-08-25 03:49:35 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-08-25 03:49:35 +0200
commitc8c277200169dfadf88dd176e5c056967550e059 (patch)
treeec1a519ef550c2206c7863503627388e343778a3 /archive
parent5e6c83d51d0f52ecb464f137ad68f0bd1a83f5e4 (diff)
downloadconky-c8c277200169dfadf88dd176e5c056967550e059.tar.gz
conky-c8c277200169dfadf88dd176e5c056967550e059.tar.bz2
conky-c8c277200169dfadf88dd176e5c056967550e059.tar.xz
conky-c8c277200169dfadf88dd176e5c056967550e059.zip
Add remote services
Diffstat (limited to 'archive')
-rwxr-xr-xarchive/scriptlib/check_server_status.sh18
-rwxr-xr-xarchive/scriptlib/check_server_traffic.sh7
-rw-r--r--archive/scriptlib/cron/traffic.cron1
-rwxr-xr-xarchive/scriptlib/osx/check_server_status.sh50
4 files changed, 76 insertions, 0 deletions
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
diff --git a/archive/scriptlib/check_server_traffic.sh b/archive/scriptlib/check_server_traffic.sh
new file mode 100755
index 0000000..a9f0abf
--- /dev/null
+++ b/archive/scriptlib/check_server_traffic.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+all_in=`iptables -L traffic_in -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+all_out=`iptables -L traffic_out -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+all_forward=`iptables -L traffic_forward -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+
+echo "$all_in $all_out $all_forward"
diff --git a/archive/scriptlib/cron/traffic.cron b/archive/scriptlib/cron/traffic.cron
new file mode 100644
index 0000000..0325d0a
--- /dev/null
+++ b/archive/scriptlib/cron/traffic.cron
@@ -0,0 +1 @@
+0 0 * * 1 root /sbin/iptables -Z traffic_in; /sbin/iptables -Z traffic_out; /sbin/iptables -Z traffic_forward
diff --git a/archive/scriptlib/osx/check_server_status.sh b/archive/scriptlib/osx/check_server_status.sh
new file mode 100755
index 0000000..ec7c0f2
--- /dev/null
+++ b/archive/scriptlib/osx/check_server_status.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+root=`df -m | grep /dev/disk3s2 | sed -E 's/[[:space:]]+/ /g' | cut -d ' ' -f 4`
+fs=`df -m | grep /dev/disk2 | sed -E 's/[[:space:]]+/ /g' | cut -d ' ' -f 4`
+cpu=`uptime | sed -E "s/[[:space:]]+/ /g" | tr ' ' '\n' | tail -n 1`
+mem=`top -l 1 | grep PhysMem | sed -E "s/[[:space:]]+/ /g"`
+
+cache=`echo $mem | cut -f 6 -d ' '`
+free=`echo $mem | cut -f 10 -d ' '`
+
+len=`echo $cache | wc -c`
+len=`expr $len - 1`
+units=`echo $cache | cut -c $len`
+len=`expr $len - 1`
+size=`echo $cache | cut -c -$len`
+
+if [ $units == "G" ]; then
+ size=`expr $size '*' 1024`
+elif [ $units != "M" ]; then
+ size=0
+fi
+
+len=`echo $free | wc -c`
+len=`expr $len - 1`
+units=`echo $free | cut -c $len`
+len=`expr $len - 1`
+fsize=`echo $free | cut -c -$len`
+if [ $units == "G" ]; then
+ size=`expr $fsize '*' 1024 + $size`
+elif [ $units == "M" ]; then
+ size=`expr $fsize + $size`
+fi
+
+mem=$size
+
+if [ $root -le 8192 ]; then
+ echo "Only $(($root / 1024)) GB left in the root file system"
+fi
+
+if [ $fs -le 102400 ]; then
+ echo "Only $(($fs / 1024)) GB left in the PDV file system"
+fi
+
+if [ $mem -le 512 ]; then
+ echo "The system is starving on memory, $mem MB left free"
+fi
+
+if [ `echo "$cpu < 7.80" | bc` -eq 0 ]; then
+ echo "The system is starving on cpu, $cpu is load average for the last 15 min"
+fi