title | expires_at | tags | |
---|---|---|---|
How to use |
never |
|
healthchecker
is added to a boshrelease as a monit
process under the Job that is to be monitored.
It is configured to perform a healthcheck against the main process in the Job. If healthchecker
detects a failure, it will panic and exit. monit
should be configured to run the restart-monit-job
script on the failure of the healthchecker
process. This script restarts the main monit process,
up to ten failures in a row. After 10 consecutive failures, it gives up, since restarting the process
is either in a horrible state, or the healthchecker
is misconfigured and should not be causing
process downtime.
Vendor the healthchecker
BOSH package in your bosh release using a PREFIX. This will name the healthchecker
package {PREFIX}-healthchecker
in your release to prevent collisions.
git clone https://github.com/cloudfoundry/healthchecker-release.git
cd ~/PATH/YOUR_RELEASE
bosh vendor-package healthchecker ~/workspace/healthchecker-release --prefix ${PREFIX}
The PREFIX can be anything but should probably be the name of your release or a specific job in the release that will use healthchecker, e.g. cf-networking
to make cf-networking-healthchecker
.
Once the healthchecker
package has been vendored into your release, any job in your release can make use of it by following the rest of the instructions.
Add {JOB}-healthchecker
process to the desired job's monit file, based on the example-healthchecker
process in our example monit file.
- Copy the
example-healthchecker
process to your monit file. - Change all occurances of
example
to{JOB}
, e.g.example-healthchecker
to{JOB}-healthchecker
andexample-healthchecker.pid
to{JOB}-healthchecker.pid
- The path
/var/vcap/packages/healthchecker/bin/restart-monit-job
MUST match the healthchecker PREFIX. Update the path appropriately with the PREFIX, e.g./var/vcap/packages/{PREFIX}-healthchecker/bin/restart-monit-job
.
Add BPM config for the new healthchecker process, based on our example bpm.yml.
- Copy the
example-healthchecker
process to your BPM file. - Change all occurances of
example
to{JOB}
, e.g.example-healthchecker
to{JOB}-healthchecker
and/var/vcap/jobs/example/config/healthchecker.yml
to/var/vcap/jobs/{JOB}/config/healthchecker.yml
- The path
/var/vcap/packages/healthchecker/bin/healthchecker
MUST match the healthchecker PREFIX. Update the path appropriately with the PREFIX, e.g./var/vcap/packages/{PREFIX}-healthchecker/bin/healthchecker
.
Add a healthchecker config template to your job based on our example healthchecker config template.
- Copy the config file to
{YOUR_RELEASE}/jobs/{JOB}/templates/healthchecker.yml.erb
. - Update the
component_name
to match your job, e.g.{JOB}-healthchecker
.
Update the job's spec to add the healthchecker config template, healthchecker package, and any new properties.
Based on the example, you need to add:
- healthchecker config template
- package itself
- Important: this MUST match the PREFIX used when vendoring, i.e.
{PREFIX}-healthchecker
- Important: this MUST match the PREFIX used when vendoring, i.e.
failure_counter_file
property