Skip to content

yasinosman/simple-ws-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published