0.1.15 • Published 6 years ago
@tanand/health-check-plugin-manager v0.1.15
@tanand/health-check-plugin-manager
A health check plugin manager.
Install
npm install @tanand/health-check-plugin-manager
Usage
const healthCheckManager = require('@tanand/health-check-plugin-manager');
const mongoPlugin = require('@tanand/health-check-mongo-plugin');
const mysqlPlugin = require('@tanand/health-check-mysql-plugin');
const redisPlugin = require('@tanand/health-check-redis-plugin');
healthCheckManager.configure({
port: 3000,
runChecking: true,
checkingInterval: 10000,
});
healthCheckManager.addPlugin([
mongoPlugin.create({
host: '127.0.0.1',
port: 27017
}),
mysqlPlugin.create({
user: 'username',
password: 'password',
database: 'database_name'
}),
redisPlugin.create({
password: 'password'
})
]);
healthCheckManager.start();
The manager will run an express server on the configure port and provide the following endpoint to get health report and perform some operations:
Endpoint to get the health report of your service plugin.
// GET
'/health-status'
Endpoint to get running service list
// GET
'/service-list'
Endpoint to start health check
//GET
'/start-health-check'
Endpoint to stop health check
// GET
'/stop-health-check'
Endpoint to set health check interval
// POST
// payload = { interval: 10000 }
'/set-interval'