/network-health

simple network latency and packet loss monitor using Grafana and Prometheus

Pinger

A simple network latency and packet loss monitor, with beautiful graphs in Grafana!

Zero external dependencies!

in action

Installation

  1. Clone this repo locally where you have space to host the data gathered (one GB should be plenty!)
  2. Install Docker 17.12.0+ (preferably 18.02.0+)
  3. Install the latest Docker Compose
  4. Create directories for data for storage (in the cloned directory):
  • mkdir grafana-data prometheus-data
  1. If your Docker host is running Linux, you'll also need the following:
  • chown 472 grafana-data

NOTE for RaspberryPi 3/4: Please update the docker-compose.yaml and use the nefilim/pinger_arm64:1.1 image instead

Configuration

  1. Modify etc/application.conf to include the hosts you want to monitor
  2. Start all the services with: docker-compose up -d (it will start containers for Pinger, Grafana, Prometheus)
  3. Check the Pinger logs to make sure your configuration were picked up: docker-compose logs pinger

You want to see something like:

pinger | 23:34:33.803 [main] INFO o.n.p.Main$ - Creating PingController for host [4.2.2.2] in network [public]

reflecting your configuration.

Your Grafana & Prometheus data will be stored on your docker host in ./grafana-data and prometheus-data. This should allow you to preserve your dashboard configurations and data while upgrading or recreating the Grafana & Prometheus containers.

Setting up Grafana

  1. Login to the Grafana console at http://your_docker_host:3000 with the default credentials, username: admin password: admin
  2. Change the admin credentials or click Skip
  3. Click on New dashboard
  4. In the New Panel pane, select Graph
  5. Hover over the graph and press e to edit it
  6. In the Data Source dropdown under the Metrics tab, select PingerPrometheus
  7. In the Metrics tab for Series A enter the following prometheus query: average_latency{network="internal"}
  8. In the Legend format box below enter: {{host}}
  9. In the General Tab enter a suitable title Internal Latency
  10. Click X on the far right of the Graph pane to close it
  11. At the top right, click the Add panel button (+) and select graph
  12. Repeat the last process but this time for packet loss using query (average_packetloss{network="X"})
    • I like to set the Y axis minimum explicitly to 0 for packet loss (Axes tab, Left Y, Y-min = 0)
  13. Repeat steps 4 - 12 for additional networks
  14. IMPORTANT: save your new dashboard with Cmd+S / Ctrl+S

Alternatives