trek-status-monitor

〰️ Realtime Monitoring solution for Trek.js, inspired by status.github.com

Showing:

Popularity

Downloads/wk

22

GitHub Stars

2

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

4

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

trek-status-monitor

Simple, self-hosted module based on Socket.io and Chart.js to report realtime server metrics for Trek-based node servers.

Forked from express-status-monitor.

Monitoring Page

Installation

$ npm install trek-status-monitor --save

Example

const Engine = require('trek-engine')

// setups & configs status monitor.
const statusMonitor = require('trek-status-monitor')({
  title: 'Trek Status',
  path: '/status'
})

const app = new Engine()

// registers status monitor's middleware
app.use(statusMonitor.middleware)

app.use(({ req, res, rawRes }) => {
  // registers status monitor's page route, defaults to `/status`
  if (req.path === statusMonitor.path) {
    return statusMonitor.page({ rawRes })
  }
  res.end('Hello world')
})

app.run(3000, () => {
  console.log('listening on http://0.0.0.0:3000')
})
$ npm i
$ node examples/index.js
$ open http://0.0.0.0:3000/status

APIs

  • config: Object

    Monitor can be configured by passing options object into statusMonitor constructor.

    Default config:

    {
      title: 'Trek Status',     // Default title
      path: '/status',
      spans: [{
        interval: 1,            // Every second
        retention: 60           // Keep 60 datapoints in memory
      }, {
        interval: 5,            // Every 5 seconds
        retention: 60
      }, {
        interval: 15,           // Every 15 seconds
        retention: 60
      }]
    }
    
  • path: String

    Alias to config.path, defaults to /status.

  • middleware: Function

    The Trek's middleware.

    app.use(statusMonitor.middleware)

  • page: Function

    The Trek's middleware, but using for the special route.

    router.get(statusMonitor.path, statusMonitor.page)

Badges

Build Status codecov


fundon.me  ·  GitHub @fundon  ·  Twitter @_fundon

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial