diff options
author | Holger Levsen <holger@layer-acht.org> | 2012-11-12 18:35:56 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2012-11-12 18:35:56 +0100 |
commit | ef4598ae11e98eaa8524e4b32573133b848951f7 (patch) | |
tree | 5b29590767cfcb8ce4f26eb80e9eb6dd91982404 /etc/munin | |
parent | d9aabd29a5a534b82039521fc6aa58f17d17f21f (diff) | |
download | jenkins.debian.net-ef4598ae11e98eaa8524e4b32573133b848951f7.tar.xz |
improve performance
Diffstat (limited to 'etc/munin')
-rwxr-xr-x | etc/munin/plugins/jenkins_builds_results | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/etc/munin/plugins/jenkins_builds_results b/etc/munin/plugins/jenkins_builds_results index 82b8ff73..ab36f1b2 100755 --- a/etc/munin/plugins/jenkins_builds_results +++ b/etc/munin/plugins/jenkins_builds_results @@ -40,7 +40,7 @@ if [ "$1" = "config" ]; then echo 'graph_category jenkins' draw=AREA for PREFIX in $JOB_PREFIXES ; do - for STATE in success unstable failed ; do + for STATE in success unstable failure ; do echo "jenkins_builds_results_${PREFIX}_${STATE}.label ${PREFIX} ${STATE}" echo "jenkins_builds_results_${PREFIX}_${STATE}.draw $draw" if [ "$draw" = "AREA" ] ; then draw=STACK ; fi @@ -50,9 +50,15 @@ if [ "$1" = "config" ]; then fi for PREFIX in $JOB_PREFIXES ; do - for STATE in success unstable failed ; do + PREFIX_RESULTS=$(for i in /var/lib/jenkins/jobs/${PREFIX}*/builds/*_*/log ; do tail -1 $i 2>/dev/null; echo " \n"; done ) + for STATE in success unstable failure ; do NR=0 - NR=$( (for i in /var/lib/jenkins/jobs/${PREFIX}*/builds/*_*/log ; do tail -1 $i 2>/dev/null; done ) | grep -i -c $STATE) - echo "jenkins_builds_results_${PREFIX}_${STATE}.value $NR" + if [ "$STATE" = "failure" ] ; then + # count aborted as failed + NR=$(echo -e "$PREFIX_RESULTS" | egrep -i -c "($STATE|aborted)") + else + NR=$(echo -e "$PREFIX_RESULTS" | grep -i -c $STATE) + fi + echo "jenkins_builds_results_${PREFIX}_${STATE}.value $NR" done done |