Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/thlorenz/procps-ticker
- Owner: thlorenz
- License: mit
- Created: 2014-06-11T15:30:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-13T03:04:48.000Z (over 10 years ago)
- Last Synced: 2024-12-04T11:39:28.498Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 242 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
- Source:
readproctab(opts) → {ReadableStream}
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>
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}
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)
Returns:
stream that emits disk stats at the given interval
Type
ReadableStream
sysinfo::getstat(opts) → {ReadableStream}
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)
Returns:
stream that emits stats at the given interval
Type
ReadableStream
sysinfo::loadavg(opts) → {ReadableStream}
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}
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 respectivelyReturns:
stream that emits meminfo at the given interval
Type
ReadableStream
sysinfo::uptime(opts) → {ReadableStream}
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)
Returns:
stream that emits uptime info at the given interval
Type
ReadableStream
sysinfo::uptimeSince(opts) → {ReadableStream}
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)
Returns:
stream that emits uptime since info at the given interval
Type
ReadableStream
sysinfo::vminfo(opts) → {ReadableStream}
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)
Returns:
stream that emits vminfo at the given interval
Type
ReadableStream*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT