cf-health-check
v1.3.0
Published
Manage health checks which determine the overall health of a service's dependencies
Downloads
452
Readme
cf-health-check
Manage health checks which determine the overall health of a service's dependencies.
Installation
npm install --save cf-health-check
Usage
Register an async function that performs something you want to check.
var healthCheck = new HealthCheck({ timeout: 5000 })
function checkConnection(cb) {
serviceLocator.serviceDatabase.stats(function (err, stats) {
cb(err, stats.ok === 1 ? 'OK' : 'Error')
})
}
// Optional
function cleanFn() {
// do something to clean up check.
}
healthCheck.register('critical'
, { name: 'Database', description: 'Active connection to database', fn: checkConnection, cleanFn: cleanFn })
healthCheck.run(function (err, results) {
// Process results
})
Options
- timeout - Length of time each check is allowed before returning 'Timed out' status. (Default 10s)
Credits
License
ISC