设置詹金斯以监控外部工作 [英] Setup Jenkins to monitor external job

查看:102
本文介绍了设置詹金斯以监控外部工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了 Jenkins Wiki 中有关设置远程作业的部分.由Jenkins实例监视.但是,该文档令人困惑,因为它没有告诉我在Jenkins机器或远程机器(完成任务的机器)上要配置什么.

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).

此外,文档还提到了可以直接触发的Java命令以及其他需要servlet容器的命令.我必须在远程计算机上安装一个servlet容器吗?

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:

  • 我需要在远程计算机上做什么?
  • 我需要在Jenkins机器上做什么?

谢谢.

推荐答案

在Jenkins中,您需要使用监视外部作业"选项来创建作业.给它起个名字,例如"nightly-backup".

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

在运行外部作业的计算机上,您需要安装Java和一些基本的Jenkins JAR文件,以便可以将作业结果发送到Jenkins.

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.

正如Wiki页面所说,在某些版本的Debian或Ubuntu上,您可以使用以下方法进行操作:
sudo apt-get install jenkins-external-tool-monitor

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

否则,您必须手动复制一堆JAR—即Wiki页面上列出的那些—到您的远程计算机.

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

一旦远程计算机上有可用的JAR,您就可以在其中执行任何喜欢的命令,只要在其前面加上一些Jenkins信息即可:在哪里可以找到Jenkins安装,主Java JAR和作业名称. :

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

http://my-jenkins/是Jenkins的基本URL,nightly-backup与您在Jenkins中创建的监视外部作业"的名称匹配,而./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.

完成后,此./backup.sh命令的输出将自动显示在Jenkins中.

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

这篇关于设置詹金斯以监控外部工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆