Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup Jenkins to monitor external job

I read the part of the Jenkins wiki that covers setting up a remote job to be monitored by a Jenkins instance. However, the documentation is confusing as it doesn't tell me what to configure on the Jenkins machine or the remote machine (the one that does the job).

Further, the documentation mentions Java commands that can be fired directly and others that need a servlet container. Do I have to install a servlet container on the remote machine?

Maybe it's all there but for me it's like a mix of two documentations. Can you please clarify:

  • What do I need to do on the remote machine?
  • What do I need to do on the Jenkins machine?

Thank you.

like image 265
user1579478 Avatar asked Aug 06 '12 14:08

user1579478


People also ask

Can Jenkins monitoring external jobs?

In Jenkins, you need to create a job using the "Monitor an external job" option. Give this a name, for example "nightly-backup". On the machine where the external job is running, you need Java installed and some basic Jenkins JAR files, so that the job results can be sent to Jenkins.

Which Jenkins job type should be used to monitor and track progress of a process running outside of Jenkins?

Adds the ability to monitor the result of externally executed jobs. Jenkins is useful for monitoring the non-interactive execution of processes, such as cron jobs, procmail, inetd-launched processes.

Which type of job allows you to record the execution of a process run outside Jenkins?

Build a maven project. Jenkins takes advantage of your POM files and drastically reduces the configuration. This type of job allows you to record the execution of a process run outside Jenkins, even on a remote machine. This is designed so that you can use Jenkins as a dashboard of your existing automation system.


2 Answers

In Jenkins, you need to create a job using the "Monitor an external job" option. Give this a name, for example "nightly-backup".

On the machine where the external job is running, you need Java installed and some basic Jenkins JAR files, so that the job results can be sent to Jenkins.

As the wiki page says, on some versions of Debian or Ubuntu you can do this with:
sudo apt-get install jenkins-external-tool-monitor

Otherwise, you have to copy a bunch of JARs manually — i.e. those listed on the wiki page — to your remote machine.

Once you have the JARs available on your remote machine, you can execute whichever command you like there, so long as you prefix it with some Jenkins information: where to find the Jenkins installation, the main Java JAR, and the job name:

JENKINS_HOME=http://my-jenkins/ java -jar jenkins-core-*.jar nightly-backup ./backup.sh --nightly /home

Where http://my-jenkins/ is the base URL to Jenkins, nightly-backup matches the name of the "Monitor an external job" you created in Jenkins, and ./backup.sh --nightly /home is the command you wish to run.

The output of this ./backup.sh command will show up in Jenkins automatically once it's complete.

like image 131
Christopher Orr Avatar answered Sep 22 '22 12:09

Christopher Orr


It looks like this is now called "jenkins-external-job-monitor", so you'd type:

sudo apt-get install jenkins-external-job-monitor
like image 22
cbare Avatar answered Sep 19 '22 12:09

cbare