Code Monkey home page Code Monkey logo

cloud-latency's Introduction

Cloud-Latency - Measure and Graph Network Latency written in Rust

Overview

This project uses the same concept as /nerdalert/cloud-bandwidth of measuring performance metrics and writing them out to a TSDB backend and then visualizing them into Grafana. The primary difference is this measures latency to the specified targets and is written in Rust instead of Go.

The round trip time of the probes are measured and then plotted into the TSDB stack and visualized with Grafana. The RTT is measured via ICMP and/or TCP. Some endpoints are on networks filtering ICMP. In order to get around that, we can measure the time it takes to open a TCP socket on the remote host. All polling is multi-threaded using Rust concurrency runtimes.

QuickStart

Currently you simply feed in targets to monitor via the config.yml file and start the binary with cloud-latency --config=config.yml.

Start the TSDB and Grafana:

docker run -d\
 --name go-graphite\
 --restart=always\
 -p 80:80\
 -p 2003-2004:2003-2004\
 gographite/go-graphite

This maps the following ports:

Host Container Service
80 80 grafana
2003 2003 carbon receiver - plaintext
2004 2004 carbon receiver - pickle

Verify you can reach the grafana/graphite server running by pointing your browser to the container IP. If you're running Docker for desktop on a Mac, http://localhost. On Linux just point to the host IP since the port is getting mapped with -p 80:80. The default login is username: admin and password: admin. More details on troubleshooting connectivity to the grafana/graphite stack can be find in this project nerdalert/cloud-bandwidth.

git clone https://github.com/nerdalert/cloud-latency.git
cd cloud-latency/
  • Note: Like other async ICMP libraries, tokio-ping requires privileged access to run. This means the binaries need to be run using sudo.

Here you can either build the code yourself with sudo -E cargo run - --config config.yml or run the compiled binaries.

Mac:

cd ./binaries/macosx/
sudo ./cloud-latency --config ./config.yml

Linux:

cd ./binaries/linux/
sudo ./cloud-latency --config ./config.yml

Configuration File Options

The configuration file is pretty simple. It consists of the following. Comments are added inline describing each field.

---
# The time between polls. The default is 20 seconds
test_interval: 20
# The IP or dns name of the grafana server. In this case it is 
# pointing to Docker running on a mac which uses localhost.
grafana_address: localhost
# The exposed graphite/carbon port.
# Test connectivity with `nc -zv <address_of_graphite grafana container> 2003`
grafana_port: 2003
# The prefix that is used in the TSDB. View the gif below to see more.
tsdb_prefix: latency
# The endpoints that get polled. If any of these hosts don't resolve to IPs
# or are invalid IPs the program will exit. 
# (These are simply example hosts that reply to icmp)
endpoints:
  - aws.amazon.com
  - cloud.google.com
  - github.com
  - a.root-servers.net
  - b.root-servers.net
  - c.root-servers.net
  - d.root-servers.net
  - e.root-servers.net
  - f.root-servers.net
  - g.root-servers.net
  - h.root-servers.net
  - i.root-servers.net
  - j.root-servers.net
  - k.root-servers.net
  - l.root-servers.net
  - m.root-servers.net
  - 8.8.8.8
  - 8.8.4.4
  tcp_endpoints:
  - google.com:80
  - rust-lang.org:80
  - github.com:443
  - azure.microsoft.com:443
  - aws.amazon.com:443

Viewing Grafana Dashboards

  • You can import Copy the json in grafana-config.json and paste it into a new dashboard by clicking the + and then import in the Grafana splash page.

  • Grafana makes it east to setup your own graphs as shown in the following image:

cloud-latency's People

Contributors

nerdalert avatar

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.