Tuesday 2 July 2019

Jenkins: Monitor a job


In my previous post, I explained how to configure a job, that prints ‘Hello World’ message in console.

In this post, you are going to learn,
a.   How to monitor a job
b.   How to see the status of the job in console
c.    Job Failure status

How to monitor a job?
Follow below step-by-step procedure and configure new job ‘ECHO_MESSAGES’.

Open Jenkins.


Click on New Item.


Give the item name as ‘ECHO_MESSAGES’ and select ‘Freestyle project’ and click on OK button.

Go to Build section. Click on ‘Add build step’ drop down and select ‘Execute Windows batch command’ (If you are running on Linux, then select ‘Execute shell’ option.).
It opens command text area.




Enter below commands into Command text area.


New job ‘ECHO_MESSAGES’ is created.


How to see the status of the job in console?
Run the job, by clicking on ‘Build Now’ button.



Job is scheduled.


You can see the status of job under ‘Build History’ section. Every job has unique id associated with it. For example, here #1 is the job id. Jenkins follows #{JOB_IDENTIFIER} convention.

Click on the job id #1.
Click on ‘Console Output’ section.


As you see the console output, you can notify below information.
a.   Login id of the user who triggered the build
b.   Output of the executed commands
c.    Build execution status

Job Failure status
Lets edit the configuration and update the commands like below.

echo "Hello World 1"
echo "Hello World 2"
echo "Hello World 3"
echo "Hello World 4"
echo "Hello World 5"
exit 1

I just added ‘exit 1’ statement.

Save the configuration. Trigger the build now.


As you see the Build History, 2nd build is failed

Click on the job build id #2 -> Go to Console Output.

Since I exited the Jenkins job with status code 1, job status ‘FAILURE’ is shown here.


Previous                                                 Next                                                 Home

No comments:

Post a Comment