Giter Site home page Giter Site logo

noah-huppert / net-test Goto Github PK

View Code? Open in Web Editor NEW
42.0 2.0 5.0 731 KB

Monitors network connectivity for downtime.

License: MIT License

Shell 1.63% Dockerfile 3.01% Go 95.36%
network network-analysis network-monitoring monitoring tool monitoring-scripts monitoring-tool golang prometheus prometheus-exporter

net-test's Introduction

Net Test

Monitors network connectivity for downtime.

Table Of Contents

Overview

The Net Test program performs measurements and publishes the resulting metrics for Prometheus to scrape.

Prometheus and Grafana Docker containers are provided setup and ready to analyse Net Test data.

Grafana dashboard showing histogram of round trip time

Run

The Net Test tool measures results and publishes them for Prometheus. Grafana is used to view the data.

A Docker Compose setup is provided to make this process as easy as running a single command, see Run with Docker Compose.

If one would like to run the setup without Docker Compose see Run Manually.

Command Line Options

The behavior of the net-test tool is specified using command line options.

The tool is configured with a list of target hosts, a host picking strategy, and a set of measurements to take.

Target host options:

  • -t string: Target hosts (DNS or IP4) to measure (can be provided multiple times)
  • -T string: Add this target host to the beginning of existing target hosts

Host picking strategy:

  • -f: Only measure the first target host and fallover to other following target hosts if the measurement fails (incompatible with -a) (default true)
  • -a: Measure all target hosts (incompatible with -f)

Measurement options:

  • -p int: Interval in milliseconds at which to perform the ping measurement. A value of -1 disables this test. Results recorded to the ping_rtt_ms and ping_failures_total metrics with the target_host label. (default 10000)

Other options:

  • -m string: Host on which to serve Prometheus metrics (default ":2112")

Run with Docker Compose

A Docker Compose file is provided which orchestrates the execution of Net Test, Prometheus, and Grafana.

Run:

docker-compose up -d

Then visit 127.0.0.1:3000 and view the Net Test dashboard.

To customize the measurements and behavior of Net Test one must edit the Docker Compose configuration. Make a copy of docker-compose.custom.example.yml named docker-compose.custom.yml. Edit the services.net_test.command field in this file with your custom command line options.

For example this docker-compose.custom.yml file tells Net Test to measure example.com before any other target hosts, and run the ping test every second (see Command Line Options):

version: "3.9"
services:
  net_test:
    command: net-test -T example.com -p 1000

Run your custom Docker Compose setup with the following command:

docker-compose -f docker-compose.yml -f docker-compose.custom.yml up -d

This tells Docker Compose to look at the docker-compose.yml and docker-compose.custom.yml files for configuration. The docker-compose.yml file contains the original Docker Compose setup details. Your docker-compose.custom.yml file contains an override for the container which runs the Net Test tool.

This is a lot to type every time, so the helper script custom-docker-compose is provided to make life easier. The following is equivalent to the command above:

./custom-docker-compose up -d

Run Manually

The Net Test tool is written in Go. Run it:

go run main.go

See Command Line Options for details.

Next run Prometheus and have it scrape the host on which you set Net Test to publish metrics. By default this is 127.0.0.1:2112.

Finally run Grafana, use the configuration files provided in the grafana/ directory.

Analyse

Measurements are placed in Prometheus. The following measurement types create the following metrics:

Ping (-p <ms interval>)

  • ping_rtt_ms (Histogram, labels target_host): Round trip time to target host
  • ping_failures_total (Count, labels target_host): Incremented when a target host cannot be reached

Grafana is hosted at 127.0.0.1:3000 by the provided Docker containers. A dashboard named "Net Test" has been pre-configured to show all available measurement data.

net-test's People

Contributors

noah-huppert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

net-test's Issues

Add Live Analysis

Update analyse.sh to read output from net-test.sh live and update stats as new values come in.

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.