0.1.4 • Published 4 years ago

nest-status-monitor v0.1.4

Weekly downloads
326
License
MIT
Repository
github
Last release
4 years ago

nest-status-monitor

NPM

nest-status-monitor on npm npm Build Status Coverage Status License Edit nest-status-monitor

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

Status monitor page

Demo

Demo can be found here

Installation & setup Nest.js v6

  1. Run npm install nest-status-monitor --save
  2. Setup module:
@Module({
  imports: [StatusMonitorModule.setUp(statusMonitorConfig)],
  1. Run server and go to /status

Installation & setup Nest.js v5

  1. Run npm install nest-status-monitor@0.0.3 --save
  2. Setup module:
@Module({
  imports: [StatusMonitorModule.setUp(statusMonitorConfig)],
  1. Run server and go to /status

Run examples

  1. Go to cd examples/test-status-monitor
  2. Run npm i
  3. Run server npm start
  4. Go to http://localhost:3001

Options

Monitor can be configured by passing options object during initialization of module.

Default config:

pageTitle: 'Nest.js Monitoring Page',
port: 3001,
path: '/status',
ignoreStartsWith: '/health/alive',
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,
  }
],
chartVisibility: {
  cpu: true,
  mem: true,
  load: true,
  responseTime: true,
  rps: true,
  statusCodes: true,
},
healthChecks: []

Health Checks

You can add a series of health checks to the configuration that will appear below the other stats. The health check will be considered successful if the endpoint returns a 200 status code.

// config
healthChecks: [
  {
    protocol: 'http',
    host: 'localhost',
    path: '/health/alive',
    port: 3001,
  },
  {
    protocol: 'http',
    host: 'localhost',
    path: '/health/dead',
    port: 3001,
  },
];

License

MIT License © Ivan Vasiljevic

Forked from express-status-monitor