[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible trbo monitor: also monitor 'systemctl status'

Holger Levsen gitlab at salsa.debian.org
Thu Sep 10 11:30:23 BST 2020



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
6fb89cbc by Holger Levsen at 2020-09-10T12:30:07+02:00
reproducible trbo monitor: also monitor 'systemctl status'

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/jenkins-shell-monitor.sh


Changes:

=====================================
bin/jenkins-shell-monitor.sh
=====================================
@@ -17,6 +17,7 @@
 PSFAX=$(mktemp --tmpdir=$TMPDIR jenkins-shell-monitor-XXXXXXX)
 cleanup_all() {
 	trap - INT TERM EXIT
+	echo
 	rm -vf $PSFAX
 	echo "Terminated, good-bye."
 	exit 0
@@ -64,6 +65,19 @@ main_loop() {
 		if [ "$NODES_OFFLINE" != "$NODES_GIT_OFFLINE" ] ; then
 			NODES_OFFLINE="\033[93m$NODES_OFFLINE\033[0m"
 		fi
+		SYSTEMCTLSTATUS=$(systemctl status|head -4|tail -3)
+		SYS_STATE=$(echo "$SYSTEMCTLSTATUS" | grep State | cut -d ':' -f2- | xargs echo)
+		if [ "$SYS_STATE" != "running" ] ; then
+			SYS_STATE="\033[93m$SYS_STATE\033[0m"
+		fi
+		SYS_JOBS=$(echo "$SYSTEMCTLSTATUS" | grep Jobs | cut -d ':' -f2- | xargs echo)
+		if [ "$SYS_JOBS" != "0 queued" ] ; then
+			SYS_JOBS="\033[93m$SYS_JOBS\033[0m"
+		fi
+		SYS_FAILED=$(echo "$SYSTEMCTLSTATUS" | grep Failed | cut -d ':' -f2- | xargs echo)
+		if [ "$SYS_FAILED" != "0 units" ] ; then
+			SYS_FAILED="\033[93m$SYS_FAILED\033[0m"
+		fi
 		echo "=== jenkins/trbo shell monitor ==="
 		echo
 		echo "relevant lines from ~jenkins/offline_nodes:"
@@ -78,6 +92,9 @@ main_loop() {
 		echo
 		echo    "uptime:                                       $(uptime -p | cut -d ' ' -f2-)"
 		echo -e "load averages:                                $LOAD"
+		echo -e "systemctl status summary:                     $SYS_STATE"
+		echo -e "systemctl jobs:                               $SYS_JOBS"
+		echo -e "systemctl failed:                             $SYS_FAILED"
 		echo    "logged in user sessions:                      $(uptime | rev |cut -d ',' -f1-4 | rev | cut -d ',' -f1 | sed "s#users##" | xargs echo)"
 		echo    "logged in users:                              $(w -h | awk '{print $1}' | sort -u | xargs echo)"
 		echo    "number of open files:                         $LSOF"
@@ -101,6 +118,7 @@ main_loop() {
 }
 
 # internal main
+export LANG=C
 trap cleanup_all INT TERM EXIT
 # initialize internal loop variables
 SEQ1=$(seq 1 10)	# outer loop



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/6fb89cbcb89fb7fda16774554700578b36ae5f39

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/6fb89cbcb89fb7fda16774554700578b36ae5f39
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20200910/4c0d08db/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list