https://github.com/khalidit23/grafana
https://github.com/khalidit23/grafana
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/khalidit23/grafana
- Owner: khalidit23
- Created: 2026-04-19T04:55:55.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-19T06:44:22.000Z (about 2 months ago)
- Last Synced: 2026-04-19T07:23:25.645Z (about 2 months ago)
- Size: 2.45 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ก MikroTik Monitoring Stack (Grafana + Prometheus + VictoriaMetrics)





A complete **Docker-based monitoring stack** for MikroTik devices using:
* ๐ Grafana (Visualization)
* ๐ Prometheus (Metrics scraping)
* ๐ก SNMP Exporter (SNMP โ Prometheus)
* ๐๏ธ VictoriaMetrics (Long-term storage)
---
# ๐ง Architecture Diagram
```
โโโโโโโโโโโโโโโโ
โ MikroTik โ
โ Router โ
โโโโโโโโฌโโโโโโโโ
โ SNMP
โผ
โโโโโโโโโโโโโโโโโโโ
โ SNMP Exporter โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Prometheus โ
โ (Collector) โ
โโโโโโโโโโฌโโโโโโโโโ
โ remote_write
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VictoriaMetrics โ
โ (Long-term Storage) โ
โโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโ
โ Grafana โ
โ Dashboard UI โ
โโโโโโโโโโโโโโโโ
```
---
# ๐ Project Structure
```
mikrotik-grafana/
โ
โโโ docker-compose.yml
โ
โโโ prometheus/
โ โโโ prometheus.yml
โ โโโ data/
โ
โโโ snmp_exporter/
โ โโโ snmp.yml
โ
โโโ victoriametrics-data/
โ
โโโ grafana/
โโโ provisioning/
โโโ datasources/
โโโ victoriametrics.yml
```
---
# ๐ Quick Start
## 1๏ธโฃ Clone Repository
```bash
git clone https://github.com/YOUR_USERNAME/mikrotik-grafana.git
cd mikrotik-grafana
```
---
## 2๏ธโฃ Start Stack
```bash
docker compose up -d
```
---
## 3๏ธโฃ Access Services
| Service | URL |
| --------------- | -------------------------- |
| Grafana | http://localhost:3000 |
| Prometheus | http://localhost:9090 |
| VictoriaMetrics | http://localhost:8428 |
| VM UI | http://localhost:8428/vmui |
| SNMP Exporter | http://localhost:9116 |
---
# ๐ Default Login (Grafana)
```
Username: admin
Password: admin
```
---
# ๐ Example Metrics
## CPU Load
```promql
avg(hrProcessorLoad{instance="YOUR_ROUTER_IP"})
```
## RAM Usage %
```promql
(
hrStorageUsed{hrStorageDescr="main memory"}
/
hrStorageSize{hrStorageDescr="main memory"}
) * 100
```
## WAN Traffic
```promql
rate(ifHCInOctets{ifName="ether1-WAN"}[5m]) * 8
```
# ๐งฑ Features
* ๐ก MikroTik SNMP Monitoring
* ๐ Real-time + Historical metrics
* ๐๏ธ 1 Year Data Retention (VictoriaMetrics)
* ๐ Grafana Dashboards
* โก Lightweight Docker Setup
* ๐ง Easy to extend
---
# โ๏ธ Configuration
## Prometheus โ VictoriaMetrics
```yaml
remote_write:
- url: http://victoriametrics:8428/api/v1/write
```
---
## VictoriaMetrics Retention
```yaml
--retentionPeriod=12
```
๐ Keeps data for **12 months**
---
# ๐ฏ Dashboard Layout (Recommended)
## Row 1 (Stat Cards)
* Uptime
* CPU Load
* RAM Usage
## Row 2 (Traffic)
* WAN Traffic
* LAN Traffic
## Row 3 (Advanced)
* WLAN
* VPN / API Traffic
---
# ๐ How It Works
| Component | Role |
| --------------- | ----------------- |
| SNMP Exporter | Collect SNMP data |
| Prometheus | Scrape & forward |
| VictoriaMetrics | Store metrics |
| Grafana | Visualize data |
---
# ๐ Future Improvements
* ๐ Alerting (CPU / Link Down)
* ๐ Loki for Logs
* ๐ Multi-device Monitoring
* ๐ NOC Dashboard Layout
* โ๏ธ Cloud Storage Backup
---
# ๐ Troubleshooting
## Prometheus not starting
```bash
docker logs prometheus
```
## Grafana datasource error
* Ensure only **one `isDefault: true`**
---
# ๐ Resources
* https://grafana.com
* https://prometheus.io
* https://docs.victoriametrics.com
---
# ๐งพ License
MIT License
---
# โค๏ธ Author
**Your Name / GitHub**
---
โญ If this project helped you, please star the repository!