@icemobile/loyalty-health
v3.0.1
Published
Resource status monitoring library.
Downloads
30
Readme
Health
Health is a resource status monitoring library.
This is handy when you want to monitor the status of multiple resources using a simple configuration file. For example, if your application requires a web service and a MongoDB database to be available, Health module can monitor those resources and return status ok/fail against each resource along with the response time.
It also supports result caching via ttl attribe of each resource, which is handy when you want to monitor multiple resources at a different interval or to reduce the load on certain resources.
Usage
var Health = require('health');
var health = new Health({
setup: [
{ name: 'google', uri: 'http://google.com' },
{ name: 'db', uri: 'postgresql://user:[email protected]:5432/mydb' },
]
});
// check resources
health.check(function (err, result) {
});Testing
$ npm install -g buster
$ buster-testConfiguration
Health setup is via JSON options object provided to Health() constructor:
[
{ "name": "Google", "uri", "http://google.com", "statusCodes": [ 200 ] },
{ "name": "GMail", "uri", "https://mail.google.com", "timeout": "1000" },
{ "name": "MongoDB", "uri": "mongodb://somehost:27017", "timeout": 200, "ttl": 30000 },
{ "name": "Temp", "uri": "file:///tmp", "mode": "777", "ttl": 360000 }
]Colophon
Build reports:

