![Header](https://git.pixelhosting.nl/PixelHosting/Router-tools/raw/branch/main/example/header.png)

# AS215085.net Router tools

This document outlines the installation and configuration of the AS215085.net Router Tools.

## Screenshots

[See the screenshots of the application here](https://git.pixelhosting.nl/PixelHosting/Router-tools/src/branch/main/example)


## Installation

Clone the Git repository to the `/opt` directory on your server.

```bash
cd /opt && git clone https://git.pixelhosting.nl/Blackwhitebear8/Router-tools.git
```


## Prerequisites
Before you begin, ensure the following systems are operational and correctly configured:
* A working and configured VyOS router
* A working and configured LibreNMS instance
* A working and configured Akvorado instance


## Configuration
Follow the steps below to configure the tools.

### 1. VyOS API Configuration
1. Log in to your VyOS router and enter configuration mode.
2. Set up an API key. Replace ```YourKey``` with your own unique and secure key.
   ```bash 
   set service https api keys id api key 'YourKey'
   ```
3. Set the IP address for the API to listen on. Replace ```VyosIP``` with your router's IP address.
   ```bash 
   set service https listen-address 'VyosIP'
   ```
4. Set the listening port for the API (port 80 is used in this example).
   ```bash
   set service https port '80'
   ```
5. Allow clients to connect. **Note:** ```0.0.0.0/0``` allows all IP addresses, which is insecure for production. You should restrict this to the IP address of the server where the tools are running.
   ```bash
   set service https allow-client address '0.0.0.0/0'
   ```
6. Commit your changes and save the configuration.
   ```bash
   commit
   save
   ```

### 2. Application Configuration
Next, configure the application itself.
1. Install the required Python packages: 
   ```bash
   apt update
   apt install -y gunicorn python3 python3-jinja2 python3-flask python3-gunicorn python3-dotenv python3-requests python3-matplotlib python3-networkx
   ```

2. Edit crontab for the collector.py
   ```bash
   */10 * * * * /usr/bin/python3 /opt/Router-tools/collector.py >/dev/null 2>&1
   ```


## Running the Application
Once the configuration is complete, you can run the application using Gunicorn.
```bash
gunicorn -w 4 -b 0.0.0.0:5000 app:app
```
The application will now be accessible on port ```5000``` of your server.


## License

> This project is licensed under the **Apache License 2.0** with the **Commons Clause** restriction.
>
> You may use, modify, and distribute this work for personal and non-commercial purposes only.
>
> **You must provide a clear link or reference to the original project when redistributing or using this work.**
>
> Commercial use is strictly prohibited.