@viewsonic-mvb/nest-fastify-status-monitor
v0.0.8
Published
Realtime Monitoring for Fastify-based Node applications
Downloads
339
Readme
nest-fastify-status-monitor
Simple, self-hosted module based on Socket.io and Chart.js to report realtime server metrics for Nest.js based node servers.
Installation & setup default config
- Run
npm install @viewsonic-mvb/nest-fastify-status-monitor --save
- Setup module:
import {
WebStatusMonitorModule,
WebStatusMonitorConfiguration,
} from '@viewsonic-mvb/nest-fastify-status-monitor';
@Module({
imports: [WebStatusMonitorModule.setUp()],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
- Run server and go to
/status
Run examples
- Go to
cd examples/test-fastify-status-monitor
- Run
yarn i
- Run server
yarn start
- 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',
socketPath: '/socket.io',
ignoreStartsWith: '/admin',
healthChecks: [],
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,
heap: true,
eventLoop: true,
responseTime: true,
rps: true,
statusCodes: true,
},
}
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',
port: 3000,
}
];
License
Forked from nest-status-monitor