Awesome
Zag-NetStats
Zag-NetStats is a lightweight and efficient network monitoring tool written in Go. It collects and displays real-time statistics about network interfaces, including data transfer speeds and total usage. With a clean interface and customizable output formats, it’s suitable for developers, system administrators, and anyone who needs detailed network statistics.
<br> <div align="center"> </div> <br>Features
- Real-Time Monitoring: View instantaneous upload and download speeds.
- Detailed Usage Statistics: Monitor total data sent, received, and overall usage.
- Customizable Output:
- JSON format for integration with other tools.
- Tabular format for a clear and human-readable display.
- Cross-Platform Support: Works on Linux, macOS, and Windows.
- Configurable Precision and Refresh Interval: Fine-tune precision and update frequency as needed.
Installation
Option 1: Download from Releases
- Go to the Releases page of the repository.
- Download the binary for your operating system.
- Extract the downloaded file.
- Run the binary:
./zag-netStats -i <interface_name>
Option 2: Build from Source
- Ensure you have Go installed (version 1.23.2 or higher).
- Clone this repository:
git clone https://github.com/ShadowZagrosDev/Zag-NetStats.git cd Zag-NetStats
- Build the binary:
go build -o zag-netStats ./cmd/main.go
- Run the tool:
./zag-netStats -i <interface_name>
Usage
Command-Line Options
Option | Description | Default Value |
---|---|---|
-i (required) | Specify the network interface to monitor. | N/A |
-t | Refresh interval in seconds (1 to 3600). | 1 |
-p | Precision for rounding numerical values (0 to 6). | 2 |
-f | Output format: json or table . | table |
Example
Monitor a network interface (eth0
) with a refresh interval of 2 seconds and JSON output:
./zag-netStats -i eth0 -t 2 -f json
Sample Output
Tabular Format
+-----------+------------+------------+------------+------------+-------------+
| Interface | Sent Speed | Recv Speed | Total Sent | Total Recv | Total Usage |
+-----------+------------+------------+------------+------------+-------------+
| eth0 | 12.34 MB/s | 56.78 MB/s | 1.23 GB | 4.56 GB | 5.79 GB |
+-----------+------------+------------+------------+------------+-------------+
JSON Format
{
"interface": "eth0",
"sentSpeed": { "value": 12.34, "unit": "MB/s" },
"recvSpeed": { "value": 56.78, "unit": "MB/s" },
"totalSent": { "value": 1.23, "unit": "GB" },
"totalRecv": { "value": 4.56, "unit": "GB" },
"totalUsage": { "value": 5.79, "unit": "GB" }
}
How It Works
- Interface Selection: The tool retrieves network I/O statistics for the specified interface using gopsutil.
- Data Processing:
- Calculates instantaneous upload and download speeds.
- Computes total data sent and received since the start of monitoring.
- Output Rendering: Formats the data as a table or JSON for display.
Contributing
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Submit a pull request.
Please ensure your changes are well-documented and tested.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
- gopsutil for providing cross-platform system utilities.
- tablewriter for rendering tabular output.
Issues
For issues and feature requests, please use the GitHub Issues section.
Author
ShadowZagrosDev
Feel free to connect via GitHub for any questions or feedback.