aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-10-01 00:44:13 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-10-01 00:44:13 +0200
commitd41e8980981898b3f26b0f0c257143c5d9cd07ec (patch)
tree8510e5f84306926163929957310eb5b4105c01b5 /plugins
parent536bd24438799a15686415b054f57676b053702d (diff)
downloadmonitoring_custom-d41e8980981898b3f26b0f0c257143c5d9cd07ec.tar.gz
check_jenkins_job cleanup
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/check_jenkins_job13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/check_jenkins_job b/plugins/check_jenkins_job
index ab40f87..5f075bd 100755
--- a/plugins/check_jenkins_job
+++ b/plugins/check_jenkins_job
@@ -15,15 +15,18 @@ USER=$4
shift 5
-CURL_OUT=$( curl -s --basic -u "$USER:$PASS" $@ $JENKINS_URL/view/$VIEW/job/$JOB/lastBuild/api/json )
+CURL_OUT=$( curl -s --basic -u "$USER:$PASS" "$@" "$JENKINS_URL/view/$VIEW/job/$JOB/lastBuild/api/json" )
-RESULT=$( jq -r .result <<< $CURL_OUT )
-ID=$( jq -r .displayName <<< $CURL_OUT )
+RESULT=$( jq -r .result <<< "$CURL_OUT" )
+RUNNING=$( jq -r .building <<< "$CURL_OUT" )
+ID=$( jq -r .displayName <<< "$CURL_OUT" )
if [ "$RESULT" = "SUCCESS" ]; then
- echo JOB OK: $JOB $ID succeeded
+ echo "JOB OK: $JOB $ID succeeded"
exit 0
+elif [ "$RUNNING" = "true" ]; then
+ echo "JOB OK: $JOB $ID is running"
fi
-echo JOB CRITICAL: $JOB $ID failed
+echo "JOB CRITICAL: $JOB $ID failed"
exit 2