cf-health-check

1.3.0 • Public • Published

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

/cf-health-check/

    Package Sidebar

    Install

    npm i cf-health-check

    Weekly Downloads

    92

    Version

    1.3.0

    License

    ISC

    Last publish

    Collaborators

    • serby