Simple PING monitoring based on url-monitor
npm install ping-observer
let pingObserver = require('ping-observer');
let host = new pingObserver({
host:'google.com',
interval: 5000,
timeout: 10
});
host.on('available', (data) => {
console.log(data);
})
host.on('unavailable', (data) => {
console.log(data);
host.stop();
})
host.start();
{
host:'google.com', // Required
interval: 5000, // Time interval in ms, default to 5000
timeout: 3000 // Timeout in seconds, default to 3000
}
available
- Host is up.unavailable
- Host not working.
{ alive: true, host: 'google.com', time: 26 }
{ alive: false, host: 'google.com', time: 'Unknown' }
v1.0.0 :
Initial release
The MIT License (MIT) Copyright (c) 2020 Andre Timm