1.3.0 • Published 10 years ago

cf-health-check v1.3.0

Weekly downloads
73
License
ISC
Repository
github
Last release
10 years ago

cf-health-check

Manage health checks which determine the overall health of a service's dependencies.

dependency status

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

Paul Serby

License

ISC

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago