procps-ticker
Ticks `proc` info of the host machine at given intervals and exposes it via a stream interface.
Last updated 6 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install procps-ticker 
SYNC missed versions from official npm registry.

procps-ticker build status

Ticks proc info of the host machine at given intervals and exposes it via a stream interface.

var getstat = require('procps-ticker').sysinfo.getstat;

function pad(s) {
  return String('          ' + s).slice(-10);
}

function end(stream) {
  stream.end();
  console.error('\nending');
}

var stream = getstat({ interval: 500 })
stream
  .on('error', console.error)
  .once('data', function (d) { 
    var keys = Object.keys(d).map(function (k) { return pad(k) }).join('');
    process.stdout.write(keys + '\n');
  })
  .on('data', function (d) {
    var vals = Object.keys(d).map(function (k) { return pad(d[k]) }).join('')
    process.stdout.write(vals + '\r');
  })


setTimeout(end, 10000, stream);

procps-ticker

Table of Contents generated with DocToc

Installation

npm install procps-ticker

API

procps

Exposes the underlying procps library in order to allow calling methods on it directly.

Source:

readproctab(opts) → {ReadableStream}

Creates a stream that will emit readprocdata at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

flags number <optional>

readproc flags

Source:
Returns:

stream that emits readproctab data at the given interval

Type
ReadableStream

Stream::end()

Call this on any of the returned streams in case you want to tell the state stream to end. Useful for testing and/or when you want to end your debugging session and allow the program to exit.

Source:

sysinfo::getdiskstat(opts) → {ReadableStream}

Creates a stream that will emit disk stats at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits disk stats at the given interval

Type
ReadableStream

sysinfo::getstat(opts) → {ReadableStream}

Creates a stream that will emit stats at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits stats at the given interval

Type
ReadableStream

sysinfo::loadavg(opts) → {ReadableStream}

Creates a stream that will emit loadavg info at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits loadavg info at the given interval

Type
ReadableStream

sysinfo::meminfo(opts) → {ReadableStream}

Creates a stream that will emit meminfo at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

unit number <optional>

'b'|'k'|'m'|'g' to return usage in Bytes|KB|MB|GB respectively

Source:
Returns:

stream that emits meminfo at the given interval

Type
ReadableStream

sysinfo::uptime(opts) → {ReadableStream}

Creates a stream that will emit uptime info at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits uptime info at the given interval

Type
ReadableStream

sysinfo::uptimeSince(opts) → {ReadableStream}

Creates a stream that will emit uptime since info at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits uptime since info at the given interval

Type
ReadableStream

sysinfo::vminfo(opts) → {ReadableStream}

Creates a stream that will emit vminfo at the given interval.

Parameters:
Name Type Description
opts Object

options

Properties
Name Type Argument Description
interval number <optional>

interval in milliseconds at which to emit data (default: 1000ms)

Source:
Returns:

stream that emits vminfo at the given interval

Type
ReadableStream

generated with docme

License

MIT

Current Tags

  • 0.2.0                                ...           latest (6 years ago)

2 Versions

  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |