Coder Social home page Coder Social logo

rluvaton / connection-monitor Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 4.0 2.17 MB

monitoring connections using ping and display it in a compact way!

Home Page: https://www.npmjs.com/package/connection-monitor

License: MIT License

JavaScript 100.00%
cli nodejs connection-monitor ping npm windows hacktoberfest

connection-monitor's Introduction

Welcome to Connection Monitor πŸ‘‹

Documentation Maintenance License: MIT

No more multiple terminal windows just to ping! use this CLI tool written in NodeJS for monitoring connections using ping and display it in a compact way!

🏠 Homepage

Install

npm i connection-monitor -g

Features

🌟 Support Windows, Mac, and Linux (for using in Alpine run apk add iputils)

🌟 Print to terminal in table view for compact results

🌟 Real-time table update

Usage

Usage: connection-monitor [options]

Options:
  --version      Show version number                                   [boolean]
  -c, --config   JSON config file that have the connection monitor data [string]
  -e, --example  Show an example File                 [boolean] [default: false]
  -d, --default  Use the default configuration        [boolean] [default: false]
  -h, --help     Show help                                             [boolean]

Examples:
  connection-monitor -c conf.json  Start monitor the connection with the data
                                   from the conf file
  connection-monitor -d            This will use the default configuration
                                   for pinging Google & CloudFlare DNS
                                   and Google & Bing Domains
  connection-monitor -e            Output example config file

Config file example

[
  {"name": "Google DNS", "ip": "8.8.8.8"},
  {"name": "CloudFlare DNS", "ip": "1.1.1.1"},
  {"name": "Google", "ip": "google.com"},
  {"name": "Bing", "ip": "bing.com"},
  {"name": "Home Server", "ip": "192.168.1.16", "description": "Ubuntu"}
]

Author

πŸ‘€ Raz Luvaton

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2020 Raz Luvaton.
This project is MIT licensed.

connection-monitor's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar merge-when-green[bot] avatar rluvaton avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

connection-monitor's Issues

Crash when passing config

When running

npm start -- -c "C:\example-conf.json"

It throws an error

(node:8112) UnhandledPromiseRejectionWarning: TypeError: configCmd is not a function
    at start (C:\Users\rluva\Programming\Unkown\NodeJS\connection-monitor\src\index.js:11:15)
    at Object.<anonymous> (C:\Users\rluva\Programming\Unkown\NodeJS\connection-monitor\bin\cli.js:4:19)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32)
    at Function.Module._load (internal/modules/cjs/loader.js:822:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1143:12)
    at internal/main/run_main_module.js:16:11
(node:8112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch blo
ck, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the No
de.js process with a non-zero exit code.

Print table and immediately exit

In some environments, connection-monitor starts, print a table, and immediately exit

Tested environments:

OS node version Working
Debian 10 14.16.0 βœ…
Debian 10 14.4.0 βœ…
Debian 10 14.5.0 βœ…
WSL - Ubuntu 18.04 14.15.5 βœ…
WSL - Ubuntu 20.04 14.15.5 ❌
WSL - Ubuntu 20.04 14.16.0 ❌
WSL - Ubuntu 20.04 15.10.0 ❌
MacOS - Catalina 14.~ ❌
Windows 15.8.0 βœ…
Windows 14.15.5 βœ…

Tested config

[
  {"name": "Google DNS", "ip": "8.8.8.8"},
  {"name": "CloudFlare DNS", "ip": "1.1.1.1"},
  {"name": "Google", "ip": "google.com"},
  {"name": "Bing", "ip": "bing.com"},
  {"name": "Home Server", "ip": "192.168.1.16", "description": "Ubuntu"}
]

render1614466276142

Support sections in table

To be able to output the table with sections to divide some IPs from others and set a title for each section

Only updates part of the data in the table

In case change is true every other change will be ignored

const startListen = (index, target, columnsObj, tablePrint) => {
target.pingData.on(EVENTS.DATA, ({isAlive, time, error}) => {
let changed = false;
if (columnsObj[COLUMNS.IS_ALIVE.key]) {
changed = changed || tablePrint.update(index, columnsObj[COLUMNS.IS_ALIVE.key].index, isAlive, false);
}
if (columnsObj[COLUMNS.ADDITIONAL_DATA.key]) {
changed = changed || tablePrint.update(index, columnsObj[COLUMNS.ADDITIONAL_DATA.key].index, isAlive ? `took ${time}ms` : '', false);
}
if (columnsObj[COLUMNS.ERROR.key]) {
const errorStr = !isAlive && error && typeof error === 'object' ? error.message || error.response : '';
changed = changed || tablePrint.update(index, columnsObj[COLUMNS.ERROR.key].index, errorStr, false);
}
if (changed) {
tablePrint.refresh();
}
});
target.pingData.on(EVENTS.ERROR, (err) => {
console.error('error for ip', {ip: target.ip, err})
});
target.run();
}

Can't exit

After I run the application I can't exit by pressing CTRL-C

example config file output contain comment instead of description

The output is:

Example of a config file:
[
  {"name": "Router", "ip": "192.168.1.1", "comment": ""},
  {"name": "Home Server", "ip": "192.168.1.16", "comment": "description"},
  {"name": "Local", "ip": "127.0.0.1", "comment": "Local Host"}
]

while it should be:

Example of a config file:
[
  {"name": "Router", "ip": "192.168.1.1", "description": ""},
  {"name": "Home Server", "ip": "192.168.1.16", "description": ""},
  {"name": "Local", "ip": "127.0.0.1", "description": "Local Host"}
]

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Add tests

Add unit tests and integration tests

Add Linux and Mac support

Currently we update the code for Windows one to be have real-time feature, but need to add this to Linux ad Mac too

On inetutils ping implementation displaying `undefinedms` and empty error column

Caused by #53 .

Failed on ping from inetutils and works on ping from iputils

Output:

+----------------+-------------+--------------+----------+------------------+-------+
| Name           | Description | IP           | Is Alive | Additional Data  | Error |
+----------------+-------------+--------------+----------+------------------+-------+
| Google DNS     |             | 8.8.8.8      | true     | took 46.364ms    |       |
+----------------+-------------+--------------+----------+------------------+-------+
| CloudFlare DNS |             | 1.1.1.1      | true     | took 77.903ms    |       |
+----------------+-------------+--------------+----------+------------------+-------+
| Google         |             | google.com   | true     | took 70.828ms    |       |
+----------------+-------------+--------------+----------+------------------+-------+
| Bing           |             | bing.com     | true     | took 11.075ms    |       |
+----------------+-------------+--------------+----------+------------------+-------+
| Home Server    | Ubuntu      | 192.168.1.16 | true     | took undefinedms |       |
+----------------+-------------+--------------+----------+------------------+-------+

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.