diff options
Diffstat (limited to 'etc/munin/plugins/jenkins_jobs')
-rwxr-xr-x | etc/munin/plugins/jenkins_jobs | 12 |
1 files changed, 11 insertions, 1 deletions
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 |