@arunwij/health-check
v0.0.8
Published
http service health monitor
Downloads
30
Maintainers
Readme
Health Check
health-check is HTTP service health monitor. We'll notify you when your application health status changes.
Installation
npm install @arunwij/health-check
Usage
const { HealthCheck, intervals } = require('@arunwij/health-check');
// specify service details
// name - service name
// url - service url
// interval - monitoring interval
// recipients - alert email recipients
const serviceConfigs = [
{
name: "My Service 1",
url: "https://my-service-1-url.com/health",
interval: intervals["every-5-seconds"],
recipients: ["[email protected]", "[email protected]"]
},
{
name: "My Service 2",
url: "http://localhost:3000",
interval: intervals["every-5-seconds"],
recipients: ["[email protected]"]
}
]
// specify email server configs
const emailConfig = {
from: "[email protected]",
host: "smtp-host-url",
port: "smtp-port",
auth: {
user: "username",
pass: "password"
}
}
const healthCheck = new HealthCheck(serviceConfigs, emailConfig);
healthCheck.monitor();
Monitoring Alert Preview
Periodic Health Check Service Status
This feature sends periodic emails for recipients to make sure the health check service is running without issue.
const periodicStatusAlertConfig = {
interval: intervals["once-a-day"],
recipients: ["[email protected]"],
environment: "My Server Production"
};
healthCheck.sendPeriodicServiceStatus(periodicStatusAlertConfig);