npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

health_checker

v1.3.1

Published

Get basic health stats on your server

Downloads

6

Readme

Health Checker

Returns high level information on overall server health, including:

  • CPU Utilization (%)
  • Free Memory (gigs)
  • Disk space (gigs)

Additionally returns a boolean isHealthy, which indicates if any of the values exceed certain thresholds. While there are default thresholds, you may override these values to meet your specific needs.

Installation

npm install health_checker

Usage

var healthChecker = require('health_checker');

var thresholdOverride = {
    availableMemory = .1
};

healthChecker.getStats(thresholdOverride, function(error, results){
    if(error){
        console.log("Oh no!");
    }else{
        //Do something with the results
    }
});

Sample Results

{
    cpuUtilization: 0.01904296875,
    availableMemory: 2.828726272,
    interval: 5,
    diskSpace: 4.427292672,
    isHealthy: true
}

CPU Utilization

CPU Utilization is a calculated value. It takes the load average returned by the OS, and divides it by the number of CPUs. The load average is based on either a 1, 5, or 15 minute interval. (The default setting is 5 minutes.) Note that the interval only applies to the CPU, and not the other values.

Default Thresholds

The system uses default threshold values, to determine if the isHealthy value is set to true or false. You can ignore this value, or potentially take some action such as triggering an alert. All of these default values can be overridden, to suit your specific needs.

var defaultThresholds = {
    cpuUtilization: .9, //90% utilized
    interval: 5, //Average load over 5 min. (Only applies to CPU)
    availableMemory: .2, //200 megs available
    diskSpace: .5 //500 megs free
};