0.3.0 • Published 9 years ago

health v0.3.0

Weekly downloads
46
License
-
Repository
-
Last release
9 years ago

Build Status Dependencies Status Coverage Status Published Version npm Badge

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.

Installation

npm install -g health 

Usage

// use default formatter
var health = new (require('health'))(
  setup: [ { name: 'google', uri: 'http://google.com' } ]
);

// use built-in formatter (html, text, or xml)
var health = new (require('health'))(
  setup: [ { name: 'google', uri: 'http://google.com' } ],
  formatter: 'html'
);

// use custom formatter function
var health = new (require('health'))(
  setup: [ { name: 'google', uri: 'http://google.com' } ],
  formatter: function (results) {
    return results.join('|');
  }
);

// check resources
health.check(function (err, result) {
});

From command-line:

health -f html -s health.json check

Configuration

Health setup is just a simple JSON:

[
  { "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

Developer's Guide

Build reports:

0.3.0

9 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago