使用prometheus监控群晖

简介

就是下面这个项目

https://github.com/ddiiwoong/synology-prometheus

操作

因为我家里已经又了prometheus等,所以就看下他的docker-compose里面写了什么

https://github.com/ddiiwoong/synology-prometheus/blob/master/docker-compose.yml

也就是我只要node-exportersnmp-exporter就好了

1
2
3
4
5
6
7
8
9
10
11
12
version: '3.8'
services:
node_exporter:
image: prom/node-exporter:v1.3.1
container_name: node_exporter
command:
- '--path.rootfs=/host'
network_mode: host
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro,rslave'
1
2
3
4
5
6
7
8
9
10
11
version: '3.8'
services:
snmp-exporter:
image: prom/snmp-exporter
container_name: snmp-exporter
command:
- '--config.file=/etc/snmp_exporter/snmp.yml'
network_mode: host
restart: always
volumes:
- './snmp_exporter/:/etc/snmp_exporter/'

群晖里面要开启snmpv1服务,然后社群填写synology

然后snmp.yml就是

https://github.com/ddiiwoong/synology-prometheus/blob/master/snmp-synology/snmp.yml

之后配置prometheus

1
2
3
4
5
6
7
8
9
10
11
12
13
- job_name: 'snmp-exporter'
static_configs:
- targets: ['10.10.100.244']
metrics_path: /snmp
params:
module: [synology]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.10.100.244:9116
1
2
3
4
5
- job_name: 'node'
file_sd_configs:
- files:
- "/file_sd/node-exporter.yaml"
refresh_interval: 5s

grafana的dashboard

它提供的也还可以

https://grafana.com/grafana/dashboards/14284

但是数据太多了,我还是喜欢自己配置

欢迎关注我的博客www.bboy.app

Have Fun

欢迎关注我的其它发布渠道