server-health-checker

1.0.1 • Public • Published

Server Health Checker

This project monitors server health by checking CPU usage, memory usage, and disk space. It displays the health check results in the console and sends an alert using the souq-error-handler package if any of the health checks enter the red zone.

Usage

To use the Server Health Checker in your project, first install it as a dependency:

npm install --save server-health-checker

Then, import and use the Server Health Checker in your project:

const ServerHealthChecker = require("server-health-checker");

// Initialize ServerHealthChecker instance
const checker = new ServerHealthChecker(intervalInSeconds, logToConsole /*true or false*/);

// Start monitoring server health
checker.startMonitoring();

Parameters

intervalInSeconds (number): The interval in seconds between server health checks.

logToConsole (boolean, optional, default: true): Whether to display server health check results in the console. Pass false to disable console logs.

Example Usage

  1. Using Server Health Checker with console logs enabled (default behavior):
const ServerHealthChecker = require("server-health-checker");

const checker = new ServerHealthChecker(60); // Check server health every 60 seconds
checker.startMonitoring();
  1. Using Server Health Checker with console logs disabled:
const ServerHealthChecker = require("server-health-checker");

const checker = new ServerHealthChecker(60, false); // Check server health every 60 seconds without console logs
checker.startMonitoring();

Readme

Keywords

none

Package Sidebar

Install

npm i server-health-checker

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

5.85 kB

Total Files

5

Last publish

Collaborators

  • oskii