6

I execute git clone https://github.com/mesosphere/marathon.git to download the latest marathon,And I had known from marathon doc that we can set the property of 'healthChecks' to Monitor the job.

but when i start marathon , i can't find the property 'healthChecks' anywhere,

And i am sure that the marathon i had download is the latest.

anybody could tell me how to use the 'healthChecks' ?

this is the marathon doc for 'healthChecks'

And you can see it on http://mesosphere.github.io/marathon/docs/rest-api.html#post-v2-apps

 "healthChecks": [
    {
        "protocol": "HTTP",
        "path": "/health",
        "gracePeriodSeconds": 3,
        "intervalSeconds": 10,
        "portIndex": 0,
        "timeoutSeconds": 10,
        "maxConsecutiveFailures": 3
    },
    {
        "protocol": "TCP",
        "gracePeriodSeconds": 3,
        "intervalSeconds": 5,
        "portIndex": 1,
        "timeoutSeconds": 5,
        "maxConsecutiveFailures": 3
    },
    {
        "protocol": "COMMAND",
        "command": { "value": "curl -f -X GET http://$HOST:$PORT0/health" },
        "maxConsecutiveFailures": 3
    }
],
KingOfSocket
  • 293
  • 5
  • 18

2 Answers2

9

The Health Checks doc page provides detailed information on how to use them.

Screen shot of Health Checks in Marathon 0.11

Note that health checks are application dependent, which means you have to implement them in your app and expose them since only you know what constitutes a healthy state in your app.

For example, Marathon itself has the /ping URL which indicates a basic availability of the service.

Michael Hausenblas
  • 13,162
  • 4
  • 52
  • 66
  • but where to use them ? . where is the property 'healthcheck' on marathon UI????? – KingOfSocket Sep 21 '15 at 02:12
  • 1
    I took a screen shot from Marathon 0.11 here: https://dl.dropboxusercontent.com/u/10436738/screenshots/2015-09-21_marathon_healthchecks.png and updated answer. Don't forget to vote/check the answer as correct, so that others also benefit from it. – Michael Hausenblas Sep 21 '15 at 09:35
  • which version did you used ? i download many different version of marathon, but I was unable to find where to configure the health check – KingOfSocket Sep 23 '15 at 02:40
  • 1
    As I said above in my comment, version 0.11 ... also, you need to implement them in your app. Unsure what's unclear? – Michael Hausenblas Sep 23 '15 at 06:38
  • sorry , I am hard to understand that, you said 'you need to implement them in your app' ? does this mean that I should create something like controller or servlet in my app to tell marathon wheather my app is healthy ?.. i am so sorry , i'm not good at English...... – KingOfSocket Sep 23 '15 at 08:27
  • 1
    Correct, @KingOfSocket you need to implement an endpoint in your app, say `/health` for example, with the logic capturing what makes your app healthy. For example, health could mean: all connections or databases are alive and available. – Michael Hausenblas Sep 23 '15 at 09:11
  • one more question .... how could i do to configure the path which marathon to request to get my-App's information , you said `/health` ? I guess marathon use `http://${HOST}:${PORT}/${WEB_NAME}/health` to get My-App's health information , but how could marathon know the ${HOST} and ${PORT} ?... – KingOfSocket Sep 24 '15 at 02:08
  • 1
    StackOverflow is not a chat platform. If you want to discuss above questions, I suggest you go to the #mesos or #marathon channel on IRC/Freenode or join us on Slack at chat.mesosphere.com to continue. – Michael Hausenblas Sep 24 '15 at 03:36
  • OMG. Leave people who are learning alone. Stop ruining Stack Overflow with your definition of what it is and isn't. – antman1p Mar 02 '17 at 12:59
0

Editing of health checks is not available in the web interface prior to version v0.13.0, see release notes:

Improved application modal The application create/edit modal has undergone significant architectural and UX improvements. It is now possible to specify application labels, accepted resource roles, the user field and health checks. Additionally, a more fine-grained input validation and error handling has been implemented.

On lower versions you should use the Marathon REST API

Sevle
  • 3,109
  • 2
  • 19
  • 31
Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85