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.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
726K
decreased by-0.01%
Maintainers
1
Weekly downloads
 
Created
Source
Avatar

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 }
]
AttributeTypeDescriptionProtocolUsageDefaultExample
uristringResource URI to checkAllMandatorymongodb://somehost:27017
namestringResource nameAllOptionalsomeapp
ttlnumberCache time to live in millisecondsAllOptional30000
lenientbooleanReplace fail or error with warningAllOptionalfalsetrue, false
groupstringResource group name, status is set to warning when there's at least one group member having success/warning status, group members status is set to fail/error only when none of the group members has success/warning statusAllOptionaldatabases, apps, datacenter1
timeoutnumberRequest/connect timeout in millisecondshttp, https, mongodbOptional500
statusCodearrayAn array of acceptable response HTTP status codeshttp, httpsOptional[ 200, 409 ]
textarrayAn array of all texts that must exist in response body, any of them does not exist means status FAILhttp, httpsOptional[ 'foo', 'bar' ]
modestring3-digit file/directory modefileOptional777, 644

Colophon

Developer's Guide

Build reports:

Keywords

FAQs

Package last updated on 21 Jun 2015

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