Skip to content

A minimalist Golang Network Monitor for GNU/Linux that follows the UNIX philosophy.

License

Notifications You must be signed in to change notification settings

rafa-dot-el/gonetmon

Repository files navigation

GoNetMon

A minimalist Golang Network Monitor for GNU/Linux that follows the UNIX philosophy.

Example usage

Given the minimalist UNIX approach, GNM output can be stripped down to an easy to parse and focused output. The example below covers monitoring only the statistics about the amount of bytes for the received packet.

gnm -transfer -hideNetworkInterface -only-rx wlp5s0
Data 374.0 b/s
Data 74.0 b/s
Data 161.0 b/s
Data 1.8 kb/s
Data 208.0 b/s
Data 807.0 b/s
Data 131.0 b/s
Data 689.2 kb/s
Data 407.0 b/s
Data 413.0 b/s
Data 937.0 b/s

Plot

When running it using a single metric (Packet count, Bytes transfer or Packets dropped) and with a single statistic (RX or TX), adding the flag -plot will render a terminal plot of the given statistic.

The following example shows the received packet count each second for the last minute and plots it on the terminal.

gnm -count -hideNetworkInterface -only-rx -plot -output-frequency 1 wlp5s0

./plot.png

Installation

Binaries

On the releases page you can find the last compiled releases.

Docker

Images are tagged based on the git tag but also the latest tag is available

docker run -it rafadotel/gonetmon

will download and execute the latest version

# docker run -it rafadotel/gonetmon

Nixos

This repository uses flakes so can be installed easily within a Nixos + Flakes setup.

Using Go tooling

This project uses standard Golang tooling, so it can be installed with:

go install -v github.com/rafa-dot-el/gonetmon@latest

Running

GNM is self explanatory and running it with --help will show the relevant information:

gnm --help
Usage: gnm [options] <network-interface>
repository: https://github.com/rafa-dot-el/gonetmon
Options:
  -all
        Show all network link statistics
  -count
        Show statistics about packet count
  -dropped
        Show statistics about dropped packets
  -hideNetworkInterface
        Don't print the network interface name
  -only-rx
        Show only received packets statistics
  -only-tx
        Show only sent packets statistics
  -output-frequency int
        Output frequency in seconds (output will be averaged to the interval) (default 5)
  -plot
        Plot the current statistics in a chart, only allows one statistic (RX or TX) and one metric (count/transfer/drops)
  -transfer
        Show statistics about total bytes transferred

Build

It uses standard Golang tooling, to build just run

go build -o gnm cmd/gnm/main.go

Release

Releases are executed using gorelease:

goreleaser release --snapshot --clean

Hacking

This project uses nix and direnv, if you have these tools installed then you just need to run

direnv allow

and

nix develop

These commands are enough to give you a development environment.

Disclaimer

This or previous program is for Educational purpose ONLY. Do not use it without permission. The usual disclaimer applies, especially the fact that me (Rafa-dot-el) is not liable for any damages caused by direct or indirect use of the information or functionality provided by these programs. The author or any Internet provider bears NO responsibility for content or misuse of these programs or any derivatives thereof. By using these programs you accept the fact that any damage (dataloss, system crash, system compromise, etc.) caused by the use of these programs is not Rafa-dot-el’s responsibility.

About

A minimalist Golang Network Monitor for GNU/Linux that follows the UNIX philosophy.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published