1.2.0 • Published 3 years ago

simple-ws-monitor v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

simple-ws-monitor

Description

simple-ws-monitor is a monitoring app runs on Node.

It is aimed to periodically send various information about the system to the users such as CPU and RAM usage.

Examples

Server:

const Monitor = require("simple-ws-monitor");

const PORT = 8000;

const monitoringService = new Monitor({
    port: 8000,
    cpu: true,
    ram: true,
});

Client:

const PORT = 8000;
const monitoringService = new WebSocket(`ws://localhost:${PORT}`);

monitoringService.onerror = (e) => console.log(e);
monitoringService.onmessage = (msg) => console.log(JSON.parse(msg));

Result (in client console):

{
    Header: "Monitoring",
    Payload: {
        cpu: {
            count: "4",
            usage: "1.25",
        },
        ram: {
            total: "16.4",
            usage: "41.30",
        }
    }
}

Installation

npm i simple-ws-monitor

Usage

Import package on server side

const Monitor = require("simple-ws-monitor");

Start service

const monitoringService = new Monitor({
    port: 8000,
    cpu: true,
    ram: true,
});

simple-monitor is now ready and waiting for connections.

Development

Clone repository:

git clone https://github.com/yasinosman/simple-ws-monitor
cd simple-ws-monitor

Install packages:

npm install

Start development server

npm run dev

Contributing

Feel free to create issues or create pull requests.

1.2.0

3 years ago

1.1.1

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago