This package has been deprecated

Author message:

The Ravenwall service has been discontinued.

ravenwall

1.0.1 • Public • Published

Ravenwall

Monitor the the health and various custom variables for your node.js processes and let Ravenwall check and store the data. Use Ravenwall.com to view your node.js processes' data in a dashboard, or send email/sms/phone alerts based on the captured data.

Ravenwall captures arbitrary content at intervals, e.g. a JSON blob every 10 seconds. Any data sent can be used for trending, analysis, or alerting.

DEMO

with npm, do:

npm install ravenwall

Add this line to your code:

var ravenwall = require("ravenwall").demo()

It will log something like the following to the console, follow the link to watch track your node process' health:

Check out your stats at https://demo.ravenwall.com/s/abcde159-ccff-4fca-808e-e96eb2b4ad6e

Or, run the provided demo script in examples/demo.js. It has some simple custom variable collection and reporting.

Example

{ ravenwall_agent: 'nodejs_0.1.9',
  system:
   { arch: 'x64',
     platform: 'linux',
     hostname: 'x220',
     uptime: 2836104.000152195,
     loadavg: { '1m': 0.1494140625, '5m': 0.1513671875, '15m': 0.138671875 },
     cpu:
      { cores: 4,
        model: 'Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz',
        speed: 2701 },
     memory: { free: 424890368, total: 8255836160 } },
  process:
   { pid: 26358,
     title: 'node',
     uptime: 15.239411229733378,
     user: 'bryce',
     versions:
      { http_parser: '1.0',
        node: '0.10.12',
        v8: '3.14.5.9',
        ares: '1.9.0-DEV',
        uv: '0.10.11',
        zlib: '1.2.3',
        modules: '11',
        openssl: '1.0.1e' },
     active_requests: 1,
     active_handles: 2,
     memory: { rss: 20504576, heapTotal: 16571136, heapUsed: 5504376 } },
  statware: { checktime: 1372281169541, stats_runtime: 0.000482022 } }

Using The Agent

Production mode:

var ravenwall = require("ravenwall")(options)
 
// E.g.
var rw = require("ravenwall")({apiToken: MY_API_TOKEN})

Options

The only required option for production mode is a Ravenwall API Token.

  • apiToken {string} -- your Ravenwal API Token, available once you create an account. You may also use the RAVENWALL_API_TOKEN environment variable.
  • id {string} -- Set a series id defining where the reported data will be stored. If not specified a random one will be asigned.
  • tags {Array[string]} -- Tags to add/apply to this series. Tags may be removed on the Ravenwall site. Tags should match /^[a-zA-Z0-9:_-]+$/
  • initial {Object} -- An optional object with properties to seed the series data with.
  • sysstats {Bool} -- Append system stats to each data point. (Default true)
  • procstats {Bool} -- Append process stats to each data point. (Default true)
  • memstats {Bool} -- Append memory stats to each data point. (Default true)
  • push {Bool} -- Set up an http agent to push the data to Ravenwall's API. (Default true)
  • pushSeconds {Int} -- How frequently to push data to Ravenwall for this process, in seconds. Set to <= 0 to disable automatic posting of data. (Default 10)
  • page {Bool} -- Set up a status http server for the process that will list the stats locally. (Default false) E.g. if your pagePort is 7667, http://localhost:7667/stats.json
  • pagePort {Int} -- What port to run the stats page on. (Default 7667)
  • log {Bool} -- Whether to create a recurring stats logger.
  • logHandle {Function} -- A handle to log to. (Default console.log)
  • logSeconds {Int} -- How frequently to log stats. (Default 60)

.demo()

Start the ravenwall agent in demo mode. Does not require an account but no historical information will be retained, nor any monitors or data aggregation is available.

E.g.

var rw = require("ravenwall").demo()

rw.registerHelper(helper)

Create an asynchronous helper that calls a function to insert your own data. The helper must be in the form function (statObject, next) and call next() when done.

E.g.

rw.registerHelper(function (statObjeft, next) {
  redis_client.multi()
    .scard("accounts")
    .scard("users")
    .get("burger_count")
    .get("foo")
    .exec(function (e, replies) {
      statObjeft.num_accounts = replies.shift()
      statObjeft.num_users = replies.shift()
      statObjeft.burger_count = replies.shift()
      statObjeft.foo = replies.shift()
      next()
    })
})
 
rw.getStatus(console.log)
/*
  { num_accounts: 123456,
    num_users: 654321,
    burger_count: 121212121,
    foo: 'The cat says, "Meow."' }
*/

rw.getStatus(callback)

Asynchronously fetch the status manually. You will not typically need to use this.

E.g.

rw.getStatus(console.log)
/*
  {}
*/

rw.set(key, value)

Safely set a status value. Will initialize the key if not yet present.

E.g.

rw.set("foo", "bar")
 
rw.getStatus(console.log)
/*
  {foo: 'bar'}
*/

rw.increment(key)

Safely increment the value stored at a key, initializing the key if not yet present.

E.g.

rw.increment("burgers")
 
rw.getStatus(console.log)
/*
  {burgers: 1}
*/

rw.incrementHash(key, member)

Increment key/member value stored as a hash, useful for creating related buckets of counters.

E.g.

rw.incrementHash("method", req.method)
 
rw.getStatus(console.log)
/*
  { method:
     { GET: 201,
       POST: 19,
       PUT: 10 } }
*/

var capped = rw.cappedHistory(key, max_entries)

Create a fixed-array of max_entries max size. Add entries with capped.push(...). This will create an internal helper that will emit the min/max/mean for this key.

var c = rw.cappedHistory("speed", 1000)
 
c.push(1)
c.push(3)
c.push(10)
 
rw.getStatus(console.log)
/*
  speed: { min: 1, max: 10, mean: 4.666666666666667 } }
*/

Readme

Keywords

none

Package Sidebar

Install

npm i ravenwall

Weekly Downloads

7

Version

1.0.1

License

none

Last publish

Collaborators

  • bryce