mirror of
https://github.com/IgorKha/Grafana-Mikrotik.git
synced 2025-12-06 02:19:28 +00:00
Refactoring the directory structure and added the ability to run with docker-compose
This commit is contained in:
parent
7aba11db31
commit
ef3aab6cdb
8 changed files with 7884 additions and 5 deletions
2
.env
Normal file
2
.env
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
GF_ADMIN_USER=admin
|
||||
GF_ADMIN_PASSWORD=mikrotik
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
prometheus/data/*
|
||||
19
README.md
19
README.md
|
|
@ -8,6 +8,21 @@ Grafana dashboard for Mikrotik/routerOS. [prometheus/snmp_exporter](https://gith
|
|||
|---|---|
|
||||
| snmp_exporter | `>=0.20.0` |
|
||||
| Grafana | `>=8.1.7` |
|
||||
## 🐳 Deploy with docker-compose
|
||||
|
||||
1. Change targets ip (192.168.88.1) into file prometheus/prometheus.yml
|
||||
2. Run
|
||||
```console
|
||||
docker-compose up -d
|
||||
```
|
||||
3. Open [localhost:3000](http://localhost:3000)
|
||||
|
||||
Grafana login: admin, password: mikrotik
|
||||
|
||||
If you want to change the credentials, then edit the ".env" file
|
||||
|
||||
-----------
|
||||
## Manual deploy
|
||||
|
||||
1.add into prometheus.yml
|
||||
|
||||
|
|
@ -15,7 +30,7 @@ Grafana dashboard for Mikrotik/routerOS. [prometheus/snmp_exporter](https://gith
|
|||
- job_name: Mikrotik
|
||||
static_configs:
|
||||
- targets:
|
||||
- 0.0.0.0 # SNMP device IP.
|
||||
- 192.168.88.1 # SNMP device IP.
|
||||
metrics_path: /snmp
|
||||
params:
|
||||
module: [mikrotik]
|
||||
|
|
@ -34,7 +49,7 @@ Grafana dashboard for Mikrotik/routerOS. [prometheus/snmp_exporter](https://gith
|
|||
|
||||
-----------
|
||||
|
||||
## Docker snmp_exporter
|
||||
### Docker snmp_exporter
|
||||
|
||||
[](https://hub.docker.com/repository/docker/mashinkopochinko/snmp_exporter_mikrotik)
|
||||
|
||||
|
|
|
|||
34
docker-compose.yml
Normal file
34
docker-compose.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:8.1.7
|
||||
container_name: mk_grafana
|
||||
restart: always
|
||||
volumes:
|
||||
- ./grafana/provisioning/:/etc/grafana/provisioning/
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- GF_SECURITY_ADMIN_USER=${GF_ADMIN_USER}
|
||||
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD}
|
||||
- GF_USERS_ALLOW_SIGN_UP=false
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus
|
||||
container_name: mk_prometheus
|
||||
restart: always
|
||||
volumes:
|
||||
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
- ./prometheus/data/:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
snmp_exporter:
|
||||
image: mashinkopochinko/snmp_exporter_mikrotik
|
||||
container_name: mk_snmp_exporter
|
||||
restart: always
|
||||
ports:
|
||||
- "9116:9116"
|
||||
depends_on:
|
||||
- prometheus
|
||||
7766
grafana/provisioning/dashboards/Mikrotik-snmp-prometheus.json
Normal file
7766
grafana/provisioning/dashboards/Mikrotik-snmp-prometheus.json
Normal file
File diff suppressed because it is too large
Load diff
11
grafana/provisioning/dashboards/dashboard.yml
Normal file
11
grafana/provisioning/dashboards/dashboard.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: 'Prometheus'
|
||||
orgId: 1
|
||||
folder: ''
|
||||
type: file
|
||||
disableDeletion: false
|
||||
editable: true
|
||||
options:
|
||||
path: /etc/grafana/provisioning/dashboards
|
||||
50
grafana/provisioning/datasources/datasource.yml
Normal file
50
grafana/provisioning/datasources/datasource.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# config file version
|
||||
apiVersion: 1
|
||||
|
||||
# list of datasources that should be deleted from the database
|
||||
deleteDatasources:
|
||||
- name: Prometheus
|
||||
orgId: 1
|
||||
|
||||
# list of datasources to insert/update depending
|
||||
# whats available in the database
|
||||
datasources:
|
||||
# <string, required> name of the datasource. Required
|
||||
- name: Prometheus
|
||||
# <string, required> datasource type. Required
|
||||
type: prometheus
|
||||
# <string, required> access mode. direct or proxy. Required
|
||||
access: proxy
|
||||
# <int> org id. will default to orgId 1 if not specified
|
||||
orgId: 1
|
||||
# <string> url
|
||||
url: http://mk_prometheus:9090
|
||||
# <string> database password, if used
|
||||
password:
|
||||
# <string> database user, if used
|
||||
user:
|
||||
# <string> database name, if used
|
||||
database:
|
||||
# <bool> enable/disable basic auth
|
||||
basicAuth: false
|
||||
# <string> basic auth username, if used
|
||||
basicAuthUser:
|
||||
# <string> basic auth password, if used
|
||||
basicAuthPassword:
|
||||
# <bool> enable/disable with credentials headers
|
||||
withCredentials:
|
||||
# <bool> mark as default datasource. Max one per org
|
||||
isDefault: true
|
||||
# <map> fields that will be converted to json and stored in json_data
|
||||
jsonData:
|
||||
graphiteVersion: "1.1"
|
||||
tlsAuth: false
|
||||
tlsAuthWithCACert: false
|
||||
# <string> json object of data that will be encrypted.
|
||||
secureJsonData:
|
||||
tlsCACert: "..."
|
||||
tlsClientCert: "..."
|
||||
tlsClientKey: "..."
|
||||
version: 1
|
||||
# <bool> allow users to edit datasources from the UI.
|
||||
editable: true
|
||||
|
|
@ -8,7 +8,7 @@ global:
|
|||
# Attach these labels to any time series or alerts when communicating with
|
||||
# external systems (federation, remote storage, Alertmanager).
|
||||
external_labels:
|
||||
monitor: 'example'
|
||||
monitor: 'Mikrotik'
|
||||
|
||||
# Alertmanager configuration
|
||||
alerting:
|
||||
|
|
@ -40,7 +40,7 @@ scrape_configs:
|
|||
- job_name: Mikrotik
|
||||
static_configs:
|
||||
- targets:
|
||||
- 0.0.0.0 # SNMP device IP.
|
||||
- 192.168.88.1 # SNMP device IP.
|
||||
metrics_path: /snmp
|
||||
params:
|
||||
module: [mikrotik]
|
||||
|
|
@ -50,4 +50,4 @@ scrape_configs:
|
|||
- source_labels: [__param_target]
|
||||
target_label: instance
|
||||
- target_label: __address__
|
||||
replacement: localhost:9116 # The SNMP exporter's real hostname:port.
|
||||
replacement: mk_snmp_exporter:9116 # The SNMP exporter's real hostname:port.
|
||||
Loading…
Add table
Add a link
Reference in a new issue