Hi Mark, Thanks for the details. Your suggestions sound good but bit too advanced for this newbie, I'm just getting my head around Jenkins Pipelines.
Was thinking something simpler to do a basic health check using curl to to check the URLs and return a 200 response code and if not successful to send an email. Something along the lines of the pipeline example here: https://devops.stackexchange.com/questions/8936/can-should-i-use-jenkins-to-monitor-whether-a-website-is-up-and-send-out-an-emai or http://www.mobabel.net/creating-a-web-service-health-check-with-jenkins-pipelines-and-mattermost-notification/ Thanks Misteek On Thursday, 31 March 2022 at 17:52:04 UTC+2 Mark Waite wrote: > On Thursday, March 31, 2022 at 9:37:40 AM UTC-6 misteek wrote: > >> Hi all, >> >> New to jenkinsfile/groovy world. >> >> Can someone please let me know how to create a jenkins pipeline health >> check to check if multiple websites are running. >> >> If any of the sites are down or http response code is not 200 an email >> notification should be sent. >> >> For every website to be checked should I create separate "stages" in the >> pipeline or is there a better way? >> > > I think that what you're describing is a "test" to confirm the web sites > are running. One way to implement that is to create the web site checker > as tests that output their results in JUnit format, then use the JUnit > plugin to display the results in Jenkins. > > That allows you to run the tests outside Jenkins and see multiple results > inside Jenkins. > > For example, you could write the test in Python and output the result to a > junit format with as described > https://stackoverflow.com/questions/11241781/python-unittests-in-jenkins > > Another example, you could write the test in Javascript with jest, as > described in > https://stackoverflow.com/questions/54294612/how-to-publish-jest-test-results-in-jenkins > > You could write the test in Java and output the result to junit format as > done in the tutrorial > https://www.jenkins.io/doc/tutorials/build-a-java-app-with-maven/#add-a-test-stage-to-your-pipeline > > Each of those techniques have the benefit that you write the test locally, > run it locally, then use Jenkins to execute the same test as you run > locally. > > Mark Waite > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a8cdb766-e2c1-4ef7-9926-dc5bd45bbee9n%40googlegroups.com.
