Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

health

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

health

Resource status monitoring library.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
619K
decreased by-14.74%
Maintainers
1
Weekly downloads
 
Created
Source

Health Build Status Dependencies Status

Avatar

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 }
]
AttributeTypeDescriptionProtocolUsageDefaultExample
uristringResource URI to checkAllMandatorymongodb://somehost:27017
namestringResource nameAllOptionalsomeapp
ttlnumberCache time to live in millisecondsAllOptional30000
timeoutnumberRequest/connect timeout in millisecondshttp, https, mongodbOptional500
statusCodesarrayAn array of acceptable response HTTP status codes, any match means status OKhttp, httpsOptional[ 200, '3xx', 409 ]
textsarrayAn array of all texts that must exist in response body, any of them does not exist means status FAILhttp, httpsOptional[ 'foo', 'bar' ]

Keywords

FAQs

Package last updated on 14 Jun 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc