ping-metrics

1.0.1 • Public • Published

ping-metrics

Ping an IP address and get rolling metrics such as:

  • average ping
  • ping standard deviation
  • packet loss %

Example usage:

var pingMetrics = require('ping-metrics');
var options = {
  ip: "8.8.8.8",   // IP address to ping
  interval: 1000,  // interval at which to ping (milliseconds)
  numIntervals: 60 // number of intervals that the rolling window should last
};
var ping = pingMetrics(options, function(metrics) {
  console.log([
    "Current Ping: " + metrics.ping,
    "Avg: " + metrics.average,
    "Stdev: " + metrics.standardDeviation,
    "Packet loss: " + metrics.loss + "%"
  ].join(" "));
});
ping.run();
 
// You can also stop and resume:
ping.stop();
ping.run();

Readme

Keywords

none

Package Sidebar

Install

npm i ping-metrics

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • 6