doc-metrix-disk

0.0.1 • Public • Published

doc-metrix-disk

NPM version Build Status Coverage Status Dependencies

Provides an API for doc-metrix disk performance metrics.

Installation

$ npm install doc-metrix-disk

For use in the browser, use browserify.

Usage

To interface with the disk documentation,

var metrics = require( 'doc-metrix-disk' );

The interface has the following methods...

Metrics

Metric centric methods...

metrics.mexists( name )

Checks whether a metric having the provided name is included in the documentation.

metrics.mexists( 'disk.ioInProgress' );
// returns true

metrics.mexists( 'cpu.utilization' );
// returns false

Note: method is not case sensitive.

metrics.mlist()

Lists all metrics included in the documentation.

metrics.mlist();
// returns an array of metric names

metrics.mfilter( regexp )

Lists all metrics satisfying a regular expression filter.

metrics.mfilter( /Reads/i );

Note: filtering for metric names is case sensitive. Ignore case /i for case insensitive filtering.

metrics.mget( [filter] )

Returns metric documentation. The provided filter may be a string or a regular expression. If a metric does not have documentation, returns null. To return a metric's documentation,

metrics.mget( 'disk.ioInProgress' );
// returns {...}

metrics.mget( 'cpu.utilization' );
// returns null

To return metric documentation matching a filter,

metrics.mget( /Reads/i );
// returns {...}

To return all metric documentation,

metrics.mget();
// returns {"metric1":{...},"metric2":{...},...}

Note: when the filter is a string, the method is not case sensitive.

Note: when the filter is a regular expression, the method is case sensitive. If case does not matter, ignore case /i;

Devices

Device centric methods...

metrics.dexists( name )

Checks whether a device having the provided name is known to have associated metric documentation.

metrics.dexists( 'dm-0' );
// returns true

metrics.dexists( 'cpu0' );
// returns false

metrics.dlist()

Lists all devices known to have associated metric documentation.

metrics.dlist();
// returns an array of device names

Note: the returned list may contain regular expressions. Regular expressions are included to account for platform variability.

metrics.dget( [name] )

Returns documentation associated with devices. If a device does not have associated metric documentation, returns null. To return a single device's metric documentation,

metrics.dget( 'dm-0' );
// returns {"metric0":{...},"metric1":{...},...}

metrics.dget( 'cpu0' );
// returns null

To return all devices and their associated metric documentation,

metrics.dget();
// returns {"device0":{...},"device1":{...},...}

Examples

To run the example code from the top-level application directory,

$ node ./examples/index.js

Notes

After running the following commands,

$ npm install
$ npm update

this package, when used as a dependency, will attempt an HTTP request to retrieve the latest documentation from Github.

During development, run the following command to retrieve the latest documentation

$ npm run docs

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ open reports/coverage/lcov-report/index.html

License

MIT license.


Copyright

Copyright © 2014. NodePrime.

Package Sidebar

Install

npm i doc-metrix-disk

Weekly Downloads

2

Version

0.0.1

License

none

Last publish

Collaborators

  • kgryte