Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/thlorenz/procps-ticker

Ticks `proc` info of the host machine at given intervals and exposes it via a stream interface.
https://github.com/thlorenz/procps-ticker

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# procps-ticker [![build status](https://secure.travis-ci.org/thlorenz/procps-ticker.png?branch=master)](http://travis-ci.org/thlorenz/procps-ticker)

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

```js
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](https://raw.githubusercontent.com/thlorenz/procps-ticker/master/assets/procps-ticker.gif)

**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*

- [Installation](#installation)
- [procps](#procps)
- [API](#api)
- [readproctab(opts) → {ReadableStream}](#readproctabopts--readablestream)
- [Stream::end()](#streamend)
- [sysinfo::getdiskstat(opts) → {ReadableStream}](#sysinfogetdiskstatopts--readablestream)
- [sysinfo::getstat(opts) → {ReadableStream}](#sysinfogetstatopts--readablestream)
- [sysinfo::loadavg(opts) → {ReadableStream}](#sysinfoloadavgopts--readablestream)
- [sysinfo::meminfo(opts) → {ReadableStream}](#sysinfomeminfoopts--readablestream)
- [sysinfo::uptime(opts) → {ReadableStream}](#sysinfouptimeopts--readablestream)
- [sysinfo::uptimeSince(opts) → {ReadableStream}](#sysinfouptimesinceopts--readablestream)
- [sysinfo::vminfo(opts) → {ReadableStream}](#sysinfovminfoopts--readablestream)
- [License](#license)

## 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](https://github.com/thlorenz/docme)*

## License

MIT