/speed-monitor

Keep tabs on your home internet speed and make your ISP step up their game – it's data-driven peace of mind!

Primary LanguageJavaScript


SPEED-MONITOR

Keep tabs on your home internet speed and make your ISP step up their game – it's data-driven peace of mind!

JavaScript YAML Docker JSON

git-last-commit GitHub commit activity GitHub top language

Dashboard


📖 Table of Contents


📍 Overview

The Speed Monitor repository consists of a network speed monitoring Node.js application that periodically runs tests, storing the results such as download speed, upload speed, and latency in a PostgreSQL database. It uses a Grafana dashboard to visually represent this data. The configuration allows for setting of test intervals and database connections through environment variables. It is dockerized for deployment ease, and the use of dotenv, pg, and speedtest-net ensures precise and efficient project execution.


📂 Repository Structure

└── speed-monitor/
    ├── Dockerfile
    ├── db/
    │   └── init.sql
    ├── docker-compose.yml
    ├── grafana/
    │   └── dashboard.json
    ├── index.js
    ├── package-lock.json
    ├── package.json

⚙️ Modules

Root
File Summary
index.js This Node.js application periodically runs a network speed test, logging the results (download speed, upload speed, and latency) to a PostgreSQL database. The test run interval and database connection details are configured using environment variables. Docker and Docker Compose files are included for deployment, and Grafana is used to visualize the speed test data.
Dockerfile The code is a Dockerfile responsible for creating a Docker image. It uses the Node LTS image as base, sets /usr/src/app as the working directory, and copies package json files to install production dependencies. It then copies the remaining app files, exposes port 3000, and sets npm start as the default command to run on container startup. Other files suggest the application also involves a database, a Grafana dashboard, and uses Docker Compose for orchestration.
package-lock.json The code represents a package-lock.json file in a speed-monitor project. It provides a detailed record of the exact versions of dependencies installed for the project. These include dotenv, pg, and speedtest-net. This ensures that all installations of the project use the exact same versions of dependencies. The project structure includes Docker configuration, a database with an SQL init script, a Grafana dashboard, and Node.js application files.
docker-compose.yml The code is a Docker Compose configuration for a network speed monitoring application comprised of three services. The app service runs the application, connecting to a Postgres db service for data storage. A grafana service displays application data through dashboards. The application uses environment variables for database connection details and speed test interval setting. The application and database are exposed over ports 3000 and 5432, respectively, and Grafana is exposed over port 3001.
package.json The speed-monitor is a Node.js application that utilizes dotenv to manage environment variables, pg to interact with a Postgres database, and speedtest-net to monitor internet speed. The application is Dockerized for easy deployment and works with Grafana for data visualization. The start-up script is defined in the package.json file. The SQL initialization script and Grafana dashboard configuration are included.
Db
File Summary
init.sql The provided code is part of a speed monitoring application. It employs Docker and Grafana for visualizations. The db/init.sql file initiates a PostgreSQL table, speedtest_results, to store internet speed test data which includes download speed, upload speed, latency, and the time of testing.
Grafana
File Summary
dashboard.json The code defines a Grafana dashboard configuration for visualizing internet speed. It fetches data from a Postgres datasource and presents it as time-series graphs for download and upload speeds, latency (Ping), and gauges for average download and upload speeds. It also includes a heatmap representing the average download speed over time. Customization options like colors, thresholds, tooltips, legends, and data source queries are specified. This dashboard auto-refreshes every 5 minutes.

🚀 Getting Started

Dependencies

Please ensure you have the following dependencies installed on your system:

- ℹ️ Docker

- ℹ️ Docker Compose

🔧 Installation

  1. Clone the speed-monitor repository:
git clone https://github.com/mii9000/speed-monitor
  1. Change to the project directory:
cd speed-monitor

🤖 Running speed-monitor

► docker-compose up -d

🤝 Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines

Click to expand
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone <your-forked-repo-url>
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear and concise message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


📄 License

This project is protected under the MIT License.


👏 Acknowledgments

Return