summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2012-12-01 14:48:39 +0100
committerHolger Levsen <holger@layer-acht.org>2012-12-01 15:41:36 +0100
commitf95a0ca45e12303fda54686fd77badfc4e2d0bd7 (patch)
tree87e392d802616663216fe9760182c9dbe50bb3c7
parentf935c1f1060d97bb8a7e2263c9471568bfaf6194 (diff)
downloadjenkins.debian.net-f95a0ca45e12303fda54686fd77badfc4e2d0bd7.tar.xz
save state in statefiles and update them every 30min
-rw-r--r--etc/cron.d/jenkins-munin-plugin8
-rwxr-xr-xetc/munin/plugins/jenkins_builds12
-rwxr-xr-xetc/munin/plugins/jenkins_builds_results14
-rwxr-xr-xetc/munin/plugins/jenkins_jobs12
4 files changed, 42 insertions, 4 deletions
diff --git a/etc/cron.d/jenkins-munin-plugin b/etc/cron.d/jenkins-munin-plugin
new file mode 100644
index 00000000..80d5fe6e
--- /dev/null
+++ b/etc/cron.d/jenkins-munin-plugin
@@ -0,0 +1,8 @@
+#
+# cron-jobs for jenkins munin plugins
+#
+
+MAILTO=root
+
+5,35 * * * * root cd /etc/munin/plugins/ ; for plugin in jenkins* ; do /usr/sbin/munin-run $plugin update ; done
+
diff --git a/etc/munin/plugins/jenkins_builds b/etc/munin/plugins/jenkins_builds
index dc2825c9..00d1342b 100755
--- a/etc/munin/plugins/jenkins_builds
+++ b/etc/munin/plugins/jenkins_builds
@@ -29,6 +29,16 @@ if [ "$1" = "autoconf" ]; then
exit 0
fi
+STATEFILE=$MUNIN_PLUGSTATE/$(basename $0)
+if [ -f $STATEFILE ] && [ "$1" = "" ] ; then
+ cat $STATEFILE
+ exit 0
+fi
+
+if [ "$1" = "update" ] ; then
+ rm -f $STATEFILE
+fi
+
JOB_PREFIXES=$(ls -1 /var/lib/jenkins/jobs/|cut -d "_" -f1|sort -f -u)
if [ "$1" = "config" ]; then
@@ -49,5 +59,5 @@ fi
for PREFIX in $JOB_PREFIXES ; do
NR=$(find /var/lib/jenkins/jobs/$PREFIX*/builds/ -type d -mtime -1 -name "*_*"| wc -l)
- echo "jenkins_builds_$PREFIX.value $NR"
+ echo "jenkins_builds_$PREFIX.value $NR" | tee -a $STATEFILE
done
diff --git a/etc/munin/plugins/jenkins_builds_results b/etc/munin/plugins/jenkins_builds_results
index ab36f1b2..d38eb678 100755
--- a/etc/munin/plugins/jenkins_builds_results
+++ b/etc/munin/plugins/jenkins_builds_results
@@ -29,10 +29,20 @@ if [ "$1" = "autoconf" ]; then
exit 0
fi
+STATEFILE=$MUNIN_PLUGSTATE/$(basename $0)
+if [ -f $STATEFILE ] && [ "$1" = "" ] ; then
+ cat $STATEFILE
+ exit 0
+fi
+
+if [ "$1" = "update" ] ; then
+ rm -f $STATEFILE
+fi
+
JOB_PREFIXES=$(ls -1 /var/lib/jenkins/jobs/|cut -d "_" -f1|sort -f -u)
if [ "$1" = "config" ]; then
- echo 'graph_title Jenkins Build results'
+ echo 'graph_title Jenkins Builds results'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_scale no'
echo 'graph_total total'
@@ -59,6 +69,6 @@ for PREFIX in $JOB_PREFIXES ; do
else
NR=$(echo -e "$PREFIX_RESULTS" | grep -i -c $STATE)
fi
- echo "jenkins_builds_results_${PREFIX}_${STATE}.value $NR"
+ echo "jenkins_builds_results_${PREFIX}_${STATE}.value $NR" | tee -a $STATEFILE
done
done
diff --git a/etc/munin/plugins/jenkins_jobs b/etc/munin/plugins/jenkins_jobs
index 46122e74..ee5e24aa 100755
--- a/etc/munin/plugins/jenkins_jobs
+++ b/etc/munin/plugins/jenkins_jobs
@@ -29,6 +29,16 @@ if [ "$1" = "autoconf" ]; then
exit 0
fi
+STATEFILE=$MUNIN_PLUGSTATE/$(basename $0)
+if [ -f $STATEFILE ] && [ "$1" = "" ] ; then
+ cat $STATEFILE
+ exit 0
+fi
+
+if [ "$1" = "update" ] ; then
+ rm -f $STATEFILE
+fi
+
JOB_PREFIXES=$(ls -1 /var/lib/jenkins/jobs/|cut -d "_" -f1|sort -f -u)
if [ "$1" = "config" ]; then
@@ -49,5 +59,5 @@ fi
for PREFIX in $JOB_PREFIXES ; do
NR=$(find /var/lib/jenkins/jobs/ -maxdepth 1 -name "$PREFIX*" -type d | wc -l)
- echo "jenkins_jobs_$PREFIX.value $NR"
+ echo "jenkins_jobs_$PREFIX.value $NR" | tee -a $STATEFILE
done