I'm trying to set up a way to constantly monitor a website that is built and deployed via Jenkins. A simple curl command would tell me if everything is OK, but how I would set up a job to do this every ~10 minutes?

Or would this be a bad idea?


You can use Build Periodically functionality under Build Triggers in Jenkins FreeStyle Job. (1)

At the Bottom of the Job Configuration, there is also a BUILD Menu with "Add Build Step" and you can execute shell. (2)

There is a POST BUILD Menu which you can use to send notifications once the build is done. (3)

Depending on how you want things done, you can have the whole script in (2) instead of splitting it into (2) and (3).

enter image description here



It's possible and pretty simple to do this with Jenkins. Here is a sample pipeline:

pipeline {
    agent any

    triggers {
        cron('*/5 * * * *')

    stages {
        stage('Health checker') {
            steps {
                sh 'curl https://mywebsite.com'

            post {
                failure {
                    mail to: 'notify-list@example.com',
                        from: 'jenkins@example.com',
                        subject: "${env.JOB_NAME} - Failed",
                        body: "Job Failed"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.