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 🙏

© 2026 – Pkg Stats / Ryan Hefner

alligator-metrics

v0.3.0

Published

Ganglia metrics reporter.

Readme

alligator-metrics

alligator-metrics is a Ganglia metrics reporter. #Quick Start

NPM

vi config/metrics.js

npm start

#Configuration Config files for metrics in config/metrics ##General

  • Edit config/metrics.js
  • Add Ganglia masters to array
return {
  hosts:[{
    host:'localhost', 
    port:8649 // gmond port
  }]
};

Redis Metrics

  • Edit config/metrics/redis.js
 return {
      redis:{
        enabled:true, // enable/disable
        host:'localhost',
        port: 6379,
        database:0
      }
    };

Elasticsearch Metrics

  • Edit config/metrics/elasticsearch.js
return { 
  elasticsearch:{
    enabled:true, // enable/disable
    host:"http://localhost:9200",
    log:['error']
  }
};

Creating a Metric

You can create you own Metric by placing them in a ./metrics/ folder create a yourMetric.js file. Here's an example of a simple metric which will report to ganglia the number of cpus:

var os = require('os');
exports.cpus={
  title:'NodeJS CPUs Count',
  name: 'node_cpu_num',
  group: 'cpu',
  units: 'CPUs',
  slope: 'zero',
  type: 'uint16',
  description:'Number of CPUs',
  interval:1200,
  tmax:10,
  dmax:60,
  run:function(api,metric,send){
    metric.value=os.cpus().length;
    send(metric);
  }
};

#Metric Options

title:'NodeJS CPUs Count',
name: 'node_cpu_num',
group: 'cpu',
units: 'CPUs',  // unit of your metric
slope: 'zero',  // zero | positive | negative | both | unspecified
type: 'uint16', // string | uint | uint8 | uint16 | uint32 | int8 | int16 | int32 | float | double
description:'Number of CPUs',
interval:1200,  // Periodic reporting interval in milliseconds
tmax:10,
dmax:60

#Plugins

Creating a Plugin

  • Create a project with the following structure:
/
  initializers/
  metrics/
  scripts/
  config/
  package.json
  • Write an config file for the metric to config/ folder for example config/metrics/cpu.js:
exports.default = {
  metrics: function(api){
    return { 
      'node_cpu_num':{
        enabled:true
      }
    };
  }
}
  • Write an config install script to scripts/postinstall.js file for example:
#!/usr/bin/env node

var fs = require('fs');
var path = require('path');

var localConfig   = path.normalize(__dirname + '/../config/cpu.js');
var configPath = path.normalize(process.cwd() + '/../../config/metrics');
var config = path.normalize(process.cwd() + '/../../config/metrics/cpu.js');

if(!fs.existsSync(config)){
  console.log("coppying " + localConfig + " to " + config)
  try{ fs.mkdirSync(configPath); }catch(e){ }
  fs.createReadStream(localConfig).pipe(fs.createWriteStream(config));
}
  • Add to package.json the install script:
"scripts": {
  "postinstall": "scripts/postinstall.js"
}

Including a Plugin

  • Add to package.json your plugin:
  "dependencies": {
    "am-your-plugin":"1.0.0"
  }
  • Add to config/api.js your plugin:
metrics:[ // this is a list of metric plugin names
  'am-your-plugin'
],

More Info