1.0.2 • Published 3 years ago

ping-observer v1.0.2

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

ping-observer

Simple PING monitoring based on url-monitor

Installation

npm install ping-observer

How to

let pingObserver = require('ping-observer');

let host = new pingObserver({
	host:'google.com', 
	interval: 5000,
	timeout: 10,
	arguments: ['-w','10']
});

host.on('available', (data) => {
	console.log(data);
})

host.on('unavailable', (data) => {
	console.log(data);
	host.stop();
})

host.start();

Options

{
	host:'google.com', // Required
	interval: 5000, // Time interval in ms, default to 5000
	timeout: 3000, // Timeout in seconds, default to 3000
	arguments: ['-w','10']  // Optional options does not provided
}

Events

  • available - Host is up.
  • unavailable - Host not working.

Responses on events

{ alive: true, host: 'google.com', time: 26 }
{ alive: false, host: 'google.com', time: 'Unknown' }

Updates

  • v1.0.0 : Initial release
  • v1.0.2 : Add optional options does not provided

Licence

The MIT License (MIT) Copyright (c) 2020 Andre Timm