[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: jenkins-shell-monitor.sh: improve those directory stats

Holger Levsen (@holger) gitlab at salsa.debian.org
Sun Jan 15 23:24:47 GMT 2023



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


Commits:
e5b31286 by Holger Levsen at 2023-01-16T00:11:22+01:00
jenkins-shell-monitor.sh: improve those directory stats

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

- - - - -
2ea61357 by Holger Levsen at 2023-01-16T00:20:50+01:00
jenkins-shell-monitor.sh: only collect disk stats every 23 instead of 15min

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

- - - - -


1 changed file:

- bin/jenkins-shell-monitor.sh


Changes:

=====================================
bin/jenkins-shell-monitor.sh
=====================================
@@ -28,7 +28,7 @@ cleanup_all() {
 # main
 #
 main_loop() {
-	# most data is updated every fifteen minutes
+	# most data is updated every 23 minutes in the outer loop
 	ps fax > $PSFAX
 	LSOF=$(lsof -n | wc -l)
 	SCHROOT_SESSIONS=$(find /var/lib/schroot/session/ -mindepth 1 | wc -l)
@@ -76,13 +76,33 @@ main_loop() {
 				WIDTH=5
 			fi
 			printf  "%-45s %-5s %-${WIDTH}s %s\n" $FILESYSTEM_MOUNTPOINT $FILESYSTEM_SIZE $FILESYSTEM_AVAIL $FILESYSTEM_USAGE
+			# include some directory stats which have been problematic in the past
+			case $FILESYSTEM in
+				"/dev/vda1")
+					DIR_PATH=/srv/reproducible-results/rbuild-debian
+					DU=$(du -sh $DIR_PATH 2>/dev/null | awk '{ print $1 }')
+					if [ -n "$(echo $DU | grep -E '[0-9]{3}G')" ] ; then
+						DIR_USAGE="${YELLOW}$DU${FOREGROUND_COLOR}"
+						WIDTH=16
+					else
+						DIR_USAGE=$DU
+						WIDTH=5
+					fi
+					printf  "%-45s %-5s %-${WIDTH}s %s\n" "  $DIR_PATH" "" "" $DIR_USAGE
+					;;
+				"/var/lib/jenkins/userContent/reproducible")
+					DIR_PATH=/var/lib/jenkins/userContent/reproducible/debian
+					for i in stretch buster bullseye bookworm unstable experimental ; do
+					  DIR_USAGE=$(cd $DIR_PATH ; du -ch dbd*/$i  2>/dev/null | grep total | awk '{ print $1 }')
+					  printf  "%-45s %-5s %-${WIDTH}s %s\n" "  r-b-userContent../dbd*/$i" "" "" $DIR_USAGE
+					done
+					;;
+			esac
 		done
-		# include some directory stats which have been problematic in the past
-		du -sh /srv/reproducible-results/rbuild-debian 2>/dev/null
-		( cd /var/lib/jenkins/userContent/reproducible/debian ; du -sh dbdtxt/stretch/ dbdtxt/buster/ dbdjson/stretch/ dbdjson/buster/ 2>/dev/null )
 	) > $DISKSTATS
 	SOME_AGE="$(date -u)"
 	for i in $SEQ1 ; do
+		# the inner loop is run more often
 		clear
 		LOAD="$(uptime | rev | cut -d ',' -f1-3 | rev | cut -d ':' -f2-|xargs echo)"
 		INTEGER_LOAD=$(echo $LOAD | cut -d '.' -f1)
@@ -143,7 +163,7 @@ main_loop() {
 		cat $DISKSTATS
 		free -h | cut -b1-47
 		echo
-		echo "some information was gathered at $SOME_AGE. (updated every 15min)"
+		echo "some information was gathered at $SOME_AGE. (updated every 23min)"
 		echo "some other information at around $(date -u). (updated every 90sec)"
 		for j in $SEQ2 ; do
 			echo -n "..."
@@ -156,7 +176,7 @@ main_loop() {
 export LANG=C
 trap cleanup_all INT TERM EXIT
 # initialize internal loop variables
-SEQ1=$(seq 1 10)	# outer loop
+SEQ1=$(seq 1 15)	# outer loop
 SEQ2=$(seq 1 20)	# inner loop
 # static colors
 FOREGROUND_COLOR=$(tput sgr0)



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/00400ad4086c651340806126f4ab70e55edea526...2ea61357d08f28698380e7c4714f8fd32684dfff

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/00400ad4086c651340806126f4ab70e55edea526...2ea61357d08f28698380e7c4714f8fd32684dfff
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/20230115/00512cd6/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list