diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2021-10-01 00:44:13 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2021-10-01 00:44:13 +0200 |
commit | d41e8980981898b3f26b0f0c257143c5d9cd07ec (patch) | |
tree | 8510e5f84306926163929957310eb5b4105c01b5 | |
parent | 536bd24438799a15686415b054f57676b053702d (diff) | |
download | monitoring_custom-d41e8980981898b3f26b0f0c257143c5d9cd07ec.tar.gz |
check_jenkins_job cleanup
-rwxr-xr-x | plugins/check_jenkins_job | 13 |
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 |