Code Monkey home page Code Monkey logo

stat's Introduction

Stat

Stat Build Workflow

Description

A small project that allows you to gather statistics (integers/counts) from files on the file system. This was designed for Linux.

This is useful for retrieving the incoming/outgoing packets per second or incoming/outgoing bytes per second on a network interface.

Building Program

You can simply use make to build this program. The Makefile uses clang to compile the program.

apt-get install clang # (Debian/Ubuntu-based systems)
yum install devtoolset-7 llvm-toolset-7 llvm-toolset-7-clang-analyzer llvm-toolset-7-clang-tools-extra # (CentOS/Others)
make

You may use make install to copy the gstat executable to your $PATH via /usr/bin.

Note - We use gstat instead of stat due to other common packages.

Command Line Usage

General command line usage can be found below.

gstat [-i <interface> --pps --bps --path <path> -c <"kbps" or "mbps" or "gbps"> --custom <integer>]
--pps => Set path to RX packet path.
--bps => Set path to RX byte path.
-p --path => Use count (integer) from a given path on file system.
-i --dev => The name of the interface to use when setting --pps or --bps.
-c --convert => Convert to either "kbps", "mbps", or "gbps".
--custom => Divides the count value by this much before outputting to stdout.
--interval => Use this interval (in microseconds) instead of one second.
--count -n => Maximum amount of times to request the counter before stopping program (0 = no limit).
--time -t => Time limit (in seconds) before stopping program (0 = no limit).

Note - If you want to receive another counter such as outgoing (TX) packets, you can set the file to pull the count from with the -p (or --path) flag. For example:

gstat --path /sys/class/net/ens18/statistics/tx_packets

Credits

stat's People

Contributors

gamemann avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

nking1232

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.