mirror of
https://github.com/M0r13n/mikrotik_monitoring.git
synced 2025-12-06 18:19:30 +00:00
Remove Synology NAS config, as it is not of interest for most users
This commit is contained in:
parent
7c8b4dfac5
commit
c2ec8c0c9b
8 changed files with 17 additions and 10206 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
tmp
|
||||||
54
README.md
54
README.md
|
|
@ -30,58 +30,24 @@ Create a user that is part of the group:
|
||||||
|
|
||||||
`/user add name=prometheus group=prometheus password=TOP_SECRET`
|
`/user add name=prometheus group=prometheus password=TOP_SECRET`
|
||||||
|
|
||||||
|
|
||||||
## Prepare Synology NAS
|
|
||||||
|
|
||||||
Firstly, activate SNMPv3 in your Synology NAS und set a username and password (md5).
|
|
||||||
|
|
||||||
In order to get stats from a Synology NAS into Prometheus an exporter is needed.
|
|
||||||
|
|
||||||
-> https://github.com/prometheus/snmp_exporter
|
|
||||||
|
|
||||||
This exporter comes with a pre-build docker image.
|
|
||||||
|
|
||||||
There is a pre-build `snmp.yml`, where you only need to update the username and password in the bottom `auth` section.
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Optional: How to generate `snmp.yml`</summary>
|
|
||||||
|
|
||||||
The generator file can be found in `./synology/generator.yml`.
|
|
||||||
|
|
||||||
Create the `snmp.yml` exporter config:
|
|
||||||
|
|
||||||
1. Change `auth.username` and `auth.password` to match the Synology NAS
|
|
||||||
2. Make a temporary directory: `mkdir tmp && cd tmp`
|
|
||||||
3. Get the SNMP exporter repo: `git clone git@github.com:prometheus/snmp_exporter.git && cd snmp_exporter`
|
|
||||||
4. Copy the generator file: `cp ../../synology/generator.yml ./generator && cd generator` (yes override)
|
|
||||||
5. Prepare the MIB files: `make mibs`
|
|
||||||
6. Generate the `snmp.yml` file using Docker:
|
|
||||||
```bash
|
|
||||||
docker build -t snmp-generator .
|
|
||||||
sudo docker run -ti \
|
|
||||||
-v "${PWD}:/opt/" \
|
|
||||||
snmp-generator generate
|
|
||||||
```
|
|
||||||
7. If everything went well, a config file has been written to `./snmp.yml`
|
|
||||||
8. Copy this file into the Synology folder (next to the generator.yml): `cp ./snmp.yml ../../../synology/`
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
|
|
||||||
## Prepare Raspi
|
## Prepare Raspi
|
||||||
You need Ubuntu Server for ARM 64 bit in order to use this setup. You may also use Raspian, but then you are limited to 32bit ARM executables. This would mean, that you need to compile the `mikrotik-exporter` by hand, because there are no predefined 32-bit Docker images.
|
|
||||||
|
You need Ubuntu Server for ARM 64 bit in order to use this setup. You may also use Raspian, but then you are limited to 32bit ARM executables. This would mean, that you need to compile the `mikrotik-exporter` by hand, because there are no pre built 32-bit Docker images.
|
||||||
|
|
||||||
|
You need to execute the following steps on the target machine itself (e.g. Raspberry Pi).
|
||||||
|
|
||||||
Install Python and pip:
|
Install Python and pip:
|
||||||
|
|
||||||
`sudo apt install python3-dev python3 python3-pip -y`
|
`sudo apt install python3-dev python3 python3-pip -y`
|
||||||
|
|
||||||
Install Docker + Docker-compose
|
Install Docker + Docker-compose (reboot required)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -sSL https://get.docker.com | sh
|
curl -sSL https://get.docker.com | sh
|
||||||
sudo usermod -aG docker ubuntu
|
sudo usermod -aG docker ubuntu
|
||||||
sudo pip3 install docker-compose
|
sudo pip3 install docker-compose
|
||||||
sudo systemctl enable docker
|
sudo systemctl enable docker
|
||||||
|
sudo reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
Build the mktxp Docker image
|
Build the mktxp Docker image
|
||||||
|
|
@ -94,7 +60,7 @@ git clone https://github.com/akpw/mktxp.git
|
||||||
cd mktxp
|
cd mktxp
|
||||||
|
|
||||||
# Build the docker image
|
# Build the docker image
|
||||||
docker build -t mktxp
|
docker build . -t mktxp
|
||||||
```
|
```
|
||||||
|
|
||||||
Now get this repo and install all services:
|
Now get this repo and install all services:
|
||||||
|
|
@ -108,7 +74,7 @@ git clone https://github.com/M0r13n/mikrotik_monitoring.git
|
||||||
cd mikrotik_monitoring
|
cd mikrotik_monitoring
|
||||||
|
|
||||||
# Let docker-compose do it's job
|
# Let docker-compose do it's job
|
||||||
sudo docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
You may need to adjust the following configuration files and add your own credentials for your router:
|
You may need to adjust the following configuration files and add your own credentials for your router:
|
||||||
|
|
@ -117,3 +83,7 @@ You may need to adjust the following configuration files and add your own creden
|
||||||
|
|
||||||
|
|
||||||
Done. You should now be able to open the Grafana dashboard on Port 3000 of your Raspberry Pi.
|
Done. You should now be able to open the Grafana dashboard on Port 3000 of your Raspberry Pi.
|
||||||
|
|
||||||
|
## Multiple Nodes
|
||||||
|
|
||||||
|
It is possible to monitor multiple (Mikrotik) devices. Just change add as many devices to `mktxp/mktxp.conf` as you want.
|
||||||
|
|
@ -59,12 +59,3 @@ services:
|
||||||
- default
|
- default
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# SNMP Exporter
|
|
||||||
# https://github.com/prometheus/snmp_exporter
|
|
||||||
synology_snmp:
|
|
||||||
image: "prom/snmp-exporter"
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- 9116:9116
|
|
||||||
volumes:
|
|
||||||
- ./synology/snmp.yml:/etc/snmp_exporter/snmp.yml
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -32,5 +32,5 @@
|
||||||
poe = False # Enable for PoE stats
|
poe = False # Enable for PoE stats
|
||||||
hostname = 192.168.0.1 # Change to your IP
|
hostname = 192.168.0.1 # Change to your IP
|
||||||
username = prometheus # Change to your Mikrotik user
|
username = prometheus # Change to your Mikrotik user
|
||||||
password = TOP_SECRET # Change to your Mikrotik password
|
password = Mascha33 # Change to your Mikrotik password
|
||||||
port = 8728 # Default Port for Mikrotik API
|
port = 8728 # Default Port for Mikrotik API
|
||||||
|
|
|
||||||
|
|
@ -27,27 +27,7 @@ scrape_configs:
|
||||||
# metrics_path defaults to '/metrics'
|
# metrics_path defaults to '/metrics'
|
||||||
# scheme defaults to 'http'.
|
# scheme defaults to 'http'.
|
||||||
|
|
||||||
static_configs:
|
|
||||||
- targets: ['mikrotik_exporter:9436', 'mktxp:49090']
|
|
||||||
|
|
||||||
# This job queries the Synology Exporter
|
|
||||||
- job_name: 'synology-snmp'
|
|
||||||
|
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets:
|
- targets:
|
||||||
- 192.168.0.114 # Actual IP of the Synology NAS
|
- 'mikrotik_exporter:9436'
|
||||||
|
- 'mktxp:49090'
|
||||||
# Non default metrics path
|
|
||||||
# Full URL looks something like: http://<EXPORTER_IP>:9116/snmp?module=synology&target=<NAS_IP>
|
|
||||||
metrics_path: /snmp
|
|
||||||
|
|
||||||
params:
|
|
||||||
module: [synology] # Tell the exporter to use the synology module
|
|
||||||
|
|
||||||
relabel_configs:
|
|
||||||
- source_labels: [__address__]
|
|
||||||
target_label: __param_target
|
|
||||||
- source_labels: [__param_target]
|
|
||||||
target_label: instance
|
|
||||||
- target_label: __address__
|
|
||||||
replacement: synology_snmp:9116 # SNMP exporter's hostname:port.
|
|
||||||
|
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
# Synology
|
|
||||||
#
|
|
||||||
# Synology MIBs can be found here:
|
|
||||||
# http://www.synology.com/support/snmp_mib.php
|
|
||||||
# http://dedl.synology.com/download/Document/MIBGuide/Synology_MIB_File.zip
|
|
||||||
#
|
|
||||||
# Tested on RS2414rp+ NAS
|
|
||||||
#
|
|
||||||
modules:
|
|
||||||
synology:
|
|
||||||
version: 3
|
|
||||||
auth:
|
|
||||||
username: monitoring
|
|
||||||
password: 333monitoring
|
|
||||||
auth_protocol: MD5
|
|
||||||
security_level: authNoPriv
|
|
||||||
walk:
|
|
||||||
- interfaces
|
|
||||||
- sysUpTime
|
|
||||||
- ifXTable
|
|
||||||
- laNames
|
|
||||||
- laLoadInt
|
|
||||||
- ssCpuUser
|
|
||||||
- ssCpuSystem
|
|
||||||
- ssCpuIdle
|
|
||||||
- memory
|
|
||||||
- hrStorage
|
|
||||||
- 1.3.6.1.4.1.6574.1 # synoSystem
|
|
||||||
- 1.3.6.1.4.1.6574.2 # synoDisk
|
|
||||||
- 1.3.6.1.4.1.6574.3 # synoRaid
|
|
||||||
- 1.3.6.1.4.1.6574.4 # synoUPS
|
|
||||||
- 1.3.6.1.4.1.6574.5 # synologyDiskSMART
|
|
||||||
- 1.3.6.1.4.1.6574.6 # synologyService
|
|
||||||
- 1.3.6.1.4.1.6574.101 # storageIO
|
|
||||||
- 1.3.6.1.4.1.6574.102 # spaceIO
|
|
||||||
- 1.3.6.1.4.1.6574.104 # synologyiSCSILUN
|
|
||||||
lookups:
|
|
||||||
- source_indexes: [spaceIOIndex]
|
|
||||||
lookup: spaceIODevice
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [storageIOIndex]
|
|
||||||
lookup: storageIODevice
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [serviceInfoIndex]
|
|
||||||
lookup: serviceName
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [ifIndex]
|
|
||||||
# Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
|
|
||||||
lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [diskIndex]
|
|
||||||
lookup: diskID
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [raidIndex]
|
|
||||||
lookup: raidName
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [laIndex]
|
|
||||||
lookup: laNames
|
|
||||||
drop_source_indexes: true
|
|
||||||
- source_indexes: [hrStorageIndex]
|
|
||||||
lookup: hrStorageDescr
|
|
||||||
drop_source_indexes: true
|
|
||||||
overrides:
|
|
||||||
diskModel:
|
|
||||||
type: DisplayString
|
|
||||||
diskSMARTAttrName:
|
|
||||||
type: DisplayString
|
|
||||||
diskSMARTAttrStatus:
|
|
||||||
type: DisplayString
|
|
||||||
diskSMARTInfoDevName:
|
|
||||||
type: DisplayString
|
|
||||||
diskType:
|
|
||||||
type: DisplayString
|
|
||||||
ifType:
|
|
||||||
type: EnumAsInfo
|
|
||||||
modelName:
|
|
||||||
type: DisplayString
|
|
||||||
raidFreeSize:
|
|
||||||
type: gauge
|
|
||||||
raidName:
|
|
||||||
type: DisplayString
|
|
||||||
raidTotalSize:
|
|
||||||
type: gauge
|
|
||||||
serialNumber:
|
|
||||||
type: DisplayString
|
|
||||||
serviceName:
|
|
||||||
type: DisplayString
|
|
||||||
version:
|
|
||||||
type: DisplayString
|
|
||||||
2755
synology/snmp.yml
2755
synology/snmp.yml
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue