简体   繁体   English

如何让Jenkins发送电子邮件进行外部测试

[英]How to make Jenkins send email for an external test

I'm not entirely sure where to start. 我不确定从哪里开始。 Someone told me I could have Jenkins monitor one of our web services and that if it detects the service is down, to have Jenkins send an email alerting us. 有人告诉我,我可以让Jenkins监视我们的一项Web服务,并且如果它检测到该服务已关闭,请让Jenkins发送一封电子邮件提醒我们。

I created a "Monitor an external job" job in Jenkins. 我在詹金斯创建了一个“监视外部工作”作业。 I setup the remote server to send the output of the monitoring script to this job name in Jenkins. 我设置了远程服务器,以将监视脚本的输出发送到Jenkins中的此作业名称。 We can see the results on the screen when it runs. 当它运行时,我们可以在屏幕上看到结果。 The problem is, "Monitor external job" doesn't have the nice options that Freestyle job has, meaning, it doesn't let me select Email notification or what not for me to setup to send an email if the service is down. 问题是,“监视外部作业”没有Freestyle作业所具有的不错的选项,这意味着,它不允许我选择“电子邮件通知”,或者如果服务中断,则不允许我选择发送电子邮件。

Can anyone point me in the right direction? 谁能指出我正确的方向? How do I get Jenkins to check the output of a remote job and send an email if it fails? 如何让Jenkins检查远程作业的输出并在失败时发送电子邮件? Am I even going about this the right way? 我什至会以正确的方式这样做吗? Is creating a "Monitor an external job" the correct way to solve this problem? 创建“监视外部作业”是否是解决此问题的正确方法? What plugins, other than the email-ext plugin is required to do this job? 要完成此工作,除了email-ext插件外,还需要哪些插件? Thanks in advance for your help. 在此先感谢您的帮助。

I'm using http://wiki.jenkins-ci.org/display/JENKINS/HTTP+Request+Plugin to monitor whether some websites are up or down. 我正在使用http://wiki.jenkins-ci.org/display/JENKINS/HTTP+Request+Plugin监视某些网站处于打开还是关闭状态。 You can set it to 'Fail the build' and set up a 'Post-build Action' 'Email Notification'. 您可以将其设置为“构建失败”,并设置“构建后操作”“电子邮件通知”。

Another option could be to setup an 'Execute shell' Build step, and curl a request to your web service, and check the response. 另一个选择是设置“执行外壳”构建步骤,并将请求卷曲到Web服务,然后检查响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM