[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] djm: log in UTC and add a (still very simple) djm-logparser to generate statistics
Holger Levsen (@holger)
gitlab at salsa.debian.org
Mon Apr 3 20:26:39 BST 2023
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
2a08b456 by Holger Levsen at 2023-04-03T21:26:29+02:00
djm: log in UTC and add a (still very simple) djm-logparser to generate statistics
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
2 changed files:
- bin/djm
- + bin/djm-logparser
Changes:
=====================================
bin/djm
=====================================
@@ -104,10 +104,12 @@ elif $CONFIRM ; then
echo
fi
-for NODE in $TARGET ; do
- SHORTNODE=$(echo $NODE | cut -d '.' -f1)
- echo $(date), $SHORTNODE, $ACTION, $REASON
-done
+if $DRY_MODE || $CONFIRM ; then
+ for NODE in $TARGET ; do
+ SHORTNODE=$(echo $NODE | cut -d '.' -f1)
+ echo "$(date -u '+%Y-%m-%d %H:%M UTC'), $SHORTNODE, $ACTION, $REASON"
+ done
+fi
if $DRY_MODE ; then
echo
@@ -136,10 +138,10 @@ get_arch_color() {
esac
}
-LOGDATE=$(date)
+LOGDATE="$(date -u '+%Y-%m-%d %H:%M UTC')"
for NODE in $TARGET ; do
SHORTNODE=$(echo $NODE | cut -d '.' -f1)
- echo $(date), $SHORTNODE, $ACTION, $REASON
+ echo "$(date -u '+%Y-%m-%d %H:%M UTC'), $SHORTNODE, $ACTION, $REASON"
get_arch_color $NODE
#
# action
=====================================
bin/djm-logparser
=====================================
@@ -0,0 +1,37 @@
+#!/bin/bash
+# vim: set noexpandtab:
+
+#
+# djm - documented jenkins maintenance logparser
+#
+# Copyright 2023 Holger Levsen <holger at layer-acht.org>
+# released under the GPLv2
+#
+
+set -e
+set -o pipefail # see eg http://petereisentraut.blogspot.com/2010/11/pipefail.html
+
+#
+# define environment and parse parameters
+#
+
+LOGFILE=~/.djm.log
+LOGMONTH="$(date -u '+%Y-%m')"
+
+#
+# main
+#
+
+TOTAL=$(grep -c $LOGMONTH $LOGFILE)
+HOURS=$(cut -b 1-13 $LOGFILE | sort -u | wc -l)
+HOSTS=$(cut -d ',' -f2 $LOGFILE | sort -u | wc -l)
+# number of reboots per month
+# number of job debugging sessions per month
+# ...
+
+echo "Still very simple statistics for djm logs at $LOGFILE in $LOGMONTH"
+echo
+echo "Amount of djm actions done: $TOTAL"
+echo "Amount of hours with djm usage: $HOURS"
+echo "Amount of hosts maintained: $HOSTS"
+
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/2a08b4568cdb3f4cd0e2ac85ff5ce705b0f3fe1c
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/2a08b4568cdb3f4cd0e2ac85ff5ce705b0f3fe1c
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/20230403/1b38ad6f/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list