Add load league and fix watcher. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 695bdbf9ec862eef4f8f6d36203b426082da3db4
(DIR) parent b891901f456753f5d9118adf77bb1307c9940fc9
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Mon, 1 Aug 2022 20:44:47 +0200
Add load league and fix watcher.
Diffstat:
A modules/load-league/load-watcher.sh | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/modules/load-league/load-watcher.sh b/modules/load-league/load-watcher.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+channels="#bitreich-en"
+
+export PATH="/home/annna/bin:$PATH"
+
+load1="$(LANG=C uptime \
+ | sed 's,.*load average: \(.*\)$,\1,' \
+ | tr -d " " \
+ | cut -d"," -f 1 \
+ | cut -d"." -f 1)"
+load5="$(LANG=C uptime \
+ | sed 's,.*load average: \(.*\)$,\1,' \
+ | tr -d " " \
+ | cut -d"," -f 2 \
+ | cut -d"." -f 1)"
+load15="$(LANG=C uptime \
+ | sed 's,.*load average: \(.*\)$,\1,' \
+ | tr -d " " \
+ | cut -d"," -f 3 \
+ | cut -d"." -f 1)"
+cpucores="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
+
+if [ $load15 -gt $cpucores ];
+then
+ annna-say -c "${channels}" "Bitreich.org load is high! The #gentoo-fans are cheering! gopher://bitreich.org/I/memecache/gentoo-fans.png"
+fi
+