Code Monkey home page Code Monkey logo

ping-multi's Introduction

ping-multi

Interactively ping one or multiple hosts from a single location.

Screenshot 1:

Ping-multi Screenshot 1

Screenshot 2:

Ping-multi Screenshot 2

Motivation

A Perl implementation which is easy to install and is also cross-platform.

Description

Ping-multi reads hosts from a file and sends ICMP ECHO_REQUEST to them. This is the same as the standard "ping", only executed in parallel for many hosts.

The results are displayed in an interactive curses text console which features the following:

  • "Hostname" or "Resolved IP" view of the hosts
  • Statistics about the ping results of each host:
    • Last round-trip-time (RTT)
    • Packet loss %
    • Average RTT
    • Minimum RTT
    • Maximum RTT
    • Standard deviation of the RTT
    • Received and Transmitted packets count
  • Ping history:
    • simple view showing received (.) and lost (X) reply packets
    • scaled view which additionally visualizes the RTT value using the numbers between 0 and 9

You can select the statistics forwards and backwards using the lower "s" and upper "S" keys, similar to the "Vim" behavior.

The host status changes can be logged to a file. This allows you to review the time of each event.

Installation

The program depends on the following additional Perl modules:

  • Curses
  • JSON
  • Statistics::Descriptive

On Debian/Ubuntu you can install them using the following command:

sudo apt-get install libcurses-perl libjson-perl libstatistics-descriptive-perl

Example

Ping multiple hosts specified directly on the command-line; you can also provide just one host:

sudo ./ping-multi google.com github.com

Ping multiple hosts specified in a file; you can also add more single hosts directly as additional command-line arguments:

sudo ./ping-multi -f sample.list

Ping and log up/down events to a file:

sudo ./ping-multi -l events.log google.com github.com

Ping hosts synchronously; this comment explains when this ping method is useful:

sudo ./ping-multi -S 192.168.0.1 192.168.0.2 192.168.0.15

Required privileges

Making ICMP ping requests requires "root" privileges on Linux.

Alternatively, you can and you should get advantage of the Linux capabilities and execute "ping-multi" with an unprivileged user who only has the CAP_NET_RAW capability. In such a case you need to define the environment variable PING_MULTI_NO_ROOT_CHECK, because the Perl module Net::Ping doesn't detect Linux capabilities. Here is a quick example, but do you own research on how to assign capabilities to a process:

sudo setpriv --reuid nobody --regid nogroup --init-groups \
	--inh-caps -all,+net_raw --ambient-caps -all,+net_raw \
	env PING_MULTI_NO_ROOT_CHECK=1 \
	./ping-multi google.com github.com

Docker

You can also use Docker to run ping-multi:

docker run --rm -it chrislwade/ping-multi
docker run --rm -it chrislwade/ping-multi google.com github.com
docker run --rm -it chrislwade/ping-multi -f sample.list
docker run --rm -it chrislwade/ping-multi -l events.log google.com github.com
docker run --rm -it chrislwade/ping-multi -S 192.168.0.1 192.168.0.2 192.168.0.15

The Docker image is maintainted by @chrislwade.

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.