Skip to content

Commit

Permalink
add docker-compose grafana/prometheus/exporter sample stack
Browse files Browse the repository at this point in the history
  • Loading branch information
tchapacan committed Apr 9, 2024
1 parent ef58dc5 commit a851840
Show file tree
Hide file tree
Showing 13 changed files with 3,381 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ Cargo.lock
# IDE cache folders
.vscode/
.idea/

# Env vars file
.env
62 changes: 57 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ Available:
- **Extracts metrics:** general status, wan configuration, devices status, bandwidth
- **Exposes metrics:** in Prometheus format, compatible with Grafana
- **Docker image:** [tchapacan/livebox-exporter-rs:latest](https://hub.docker.com/r/tchapacan/livebox-exporter-rs)
- **Grafana dashboard template:** check the `example` folder

Future:

- *Grafana dashboard template soon available...*
- *More metrics...*

![grafana dashboard](./images/grafana-dashboard.png)

## Metrics

Expand Down Expand Up @@ -130,6 +127,58 @@ Options:
- Use the [prometheus_exporter_base](https://github.com/MindFlavor/prometheus_exporter_base) crate for formatting Prometheus metrics.
- Based on a rework version of the [livebox](https://crates.io/crates/livebox/) rust client project to output additional metrics.


## Example (docker-compose)

*Grafana/prometheus/livebox-exporter-rs*

```sh
example
├── .env
├── docker-compose.yaml
├── grafana
│   ├── HomeLan.json
│   └── datasource.yml
└── prometheus
└── prometheus.yml
```

### Requirements
- Docker should be installed on your machine.

### Environment Variables
- Configure your livebox password .env and source it before running `docker-compose`.

```sh
cd example && cp .env.example .env
```

*Update env..*

```sh
source .env
```

> Update your `LIVEBOX_PASSWORD` env secrets variable and source it

### Docker Compose
- Run the following command to start the services defined in the `docker-compose.yaml` file:
```sh
docker-compose up -d
```

### Accessing Grafana
- Open your web browser and navigate to http://localhost:3000.
- Log in with the default credentials:
- Username: admin
- Password: grafana

### Import dashboard template
- Once logged into Grafana, click on the **+** icon in the left sidebar and select **Import**.
- Upload **HomeLan.json** json dashboard template from example or copy paste content
- Import and start enjoying your dashboard!


## Contributing

Contributions are really welcome! If you encounter any issues, have suggestions, or would like to add/fix features, please do:
Expand All @@ -139,6 +188,9 @@ Contributions are really welcome! If you encounter any issues, have suggestions,

For more details here are the [contribution guidelines](CONTRIBUTING.md)

## Security

If you discover any **security-related issues**, please follow the **responsible disclosure** process and report a security issues [here](https://github.com/tchapacan/livebox-exporter-rs/security/advisories/new). Thank you!

## Alternatives

Expand Down
1 change: 1 addition & 0 deletions example/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export LIVEBOX_PASSWORD=password
49 changes: 49 additions & 0 deletions example/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
services:
livebox-exporter-rs:
image: tchapacan/livebox-exporter-rs
container_name: livebox-exporter-rs
command:
- "-P"
- ${LIVEBOX_PASSWORD:-password}
ports:
- 9100:9100
restart: unless-stopped
networks:
- monitoring_network
environment:
- LIVEBOX_PASSWORD

prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ./prometheus:/etc/prometheus
- prom_data:/prometheus
networks:
- monitoring_network

grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
volumes:
- ./grafana:/etc/grafana/provisioning/datasources
networks:
- monitoring_network

volumes:
prom_data:

networks:
monitoring_network:
driver: bridge
Loading

0 comments on commit a851840

Please sign in to comment.