# simple-ws-monitor

> A simple monitoring app which uses WebSocket to communicate with clients

Latest version **1.2.0** (published 2021-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-ws-monitor
pnpm add simple-ws-monitor
yarn add simple-ws-monitor
bun add simple-ws-monitor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2021-03-03 |
| First published | 2021-02-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Yasin Osman |
| Maintainers | yasinosman |
| Keywords | Node, NodeJS, Monitoring, CPU, Usage, RAM, Usage, npm |

## Links

- npm: https://www.npmjs.com/package/simple-ws-monitor
- Repository: https://github.com/yasinosman/simple-monitor
- Homepage: https://github.com/yasinosman/simple-monitor#readme
- Issues: https://github.com/yasinosman/simple-monitor/issues
- npm.io page: https://npm.io/package/simple-ws-monitor

## Dependencies (2)

- [ws](https://npm.io/package/ws.md) ^7.4.3
- [chalk](https://npm.io/package/chalk.md) ^4.1.0

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2021-03-03
- 1.1.4 — 2021-03-01
- 1.1.3 — 2021-02-28
- 1.1.2 — 2021-02-28
- 1.1.1 — 2021-02-28
- 1.1.0 — 2021-02-28
- 1.0.0 — 2021-02-28

## README

# simple-ws-monitor

## Description

[simple-ws-monitor](https://github.com/yasinosman/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:

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

const PORT = 8000;

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

#### Client:

```javascript
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):

```javascript
{
    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

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

#### Start service

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

simple-monitor is now ready and waiting for connections.

## Development

#### Clone repository:

```bash
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.

---
_Source: https://npm.io/package/simple-ws-monitor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
