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

rrdcached-binding

v0.2.0

Published

Node.js lib connecting to the rrdcached

Downloads

6

Readme

rrdcached-binding

This is a Node.js lib for binding to RRDrool's rrdcached using node's net API.

Usage

You can connect to both UNIX and TCP sockets. Sockets should have a unix: prefix followed by a path. For TCP connections, an IP address and port must be supplied.

Most commands the daemon understands are encapsulated as own functions. Nevertheless, any command can be sent as a string. You'll get an Object back as a result:

{ statuscode: 4,
  status: 'Help for FLUSHALL',
  error: false,
  info:
   [ 'Usage: FLUSHALL',
     '',
     'Triggers writing of all pending updates.  Returns immediately.' ] }

The most important attributes will be error, which indicates if the command completed normally, and the info array, which contains the actual result of the command. See PROTOCOL section for details about statuscode etc. and Valid Commands for a list of commands.

Installation

npm install rrdcached-binding

Connecting

RRD = require('./rrdcached');
RRD.connect('unix:/tmp/rrdcached.sock', function(err){
	console.log('connected');
});

OR

RRD = require('./rrdcached');
RRD.connect('192.168.0.200:42217', function(err){
	console.log('connected');
});

Commands

Supported commands are:

  • RRD.update(filename, values, callback)
    • values can be a single String or an Array of String
  • RRD.flush(filename, callback)
  • RRD.flushall(callback)
  • RRD.help(command, callback)
  • RRD.pending(filename, callback)
  • RRD.forget(filename, callback)
  • RRD.queue(callback)
    • In addition to the info-array, there is a parsed queue Object with file -> number of values to be written for the file
  • RRD.stats(callback)
    • In addition to the info-array, there is a parsed assiciative stats Object with the different stats
  • RRD.ping(callback)
  • RRD.first(filename, rranum, callback)
    • rranum is optional
  • RRD.last(filename, callback)
  • RRD.info(filename, callback)
  • RRD.create(filename, options, DSDefinitions, RRADefinitions, callback)
  • RRD.batch(commands, callback)
    • commands is currently an Array of String consisting of custom commands (see below)
  • RRD.quit(callback)

Note that callback is of the form function(err, reply)!

Sending custom commands

RRD.write('HELP FLUSHALL', function(err, reply){
	if(err){
		console.log("Error: " + err);
		return;
	}
	console.log(reply);
	console.log('exiting');
	process.exit(0);
});

TODO

  • [ ] FETCH command
  • [ ] FETCHBIN command

Known issues