Skip to content

dimonnwc3/host-pinger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a8e89c5 · Feb 14, 2019

History

36 Commits
Jun 26, 2018
Aug 3, 2016
May 28, 2016
Jun 26, 2018
Jun 11, 2018
Feb 14, 2019
Feb 14, 2019

Repository files navigation

Host pinger

Ping your multiple hosts in realtime from the CLI or use it as Node.js module.

CLI

Install

npm install --global host-pinger

Usage

$ host-pinger --help

   Usage
     $ host-pinger [alias@]host, [[alias@]host...]

   Options
     -a, --amount Amount of pings. Infinitely (0) by default;
     -d, --delay Delay in ms. 1000 by Default;
     -h, --help Get help;

   Examples
    host-pinger [email protected] google.com -a 20 -d 1000

Node.js Module

Install

npm install --save host-pinger

Usage

const HostPinger = require('host-pinger');

let hostPinger = new HostPinger({
  hosts: [
    {alias: 'Home', host: '192.168.1.1'},
    'google.com'
  ]
});

//Get pings
hostPinger.start(servers => {
  //...
});

//Stop receive pings
hostPinger.stop();


//Error handling
hostPinger.on('error', err => {
  //...
});

HostPinger

new HostPinger([opts])

Create a new HostPinger.

Param Type Description
[options] Object
[options.amount] Number Amount of pings. Infinitely (0) by default;
[options.delay] Number Delay in ms. 1000 by Default;
[options.hosts] Array Array of hosts strings or objects

Server response structure

{ hostName: 'google.com',
 address: '92.223.8.109',
 ping: 10 }

Releases

No releases published

Packages

No packages published