prometheus
This is an old revision of the document!
Table of Contents
Prometheus
Grafana
compose.yml
version: "3"
services:
grafana:
image: grafana/grafana
container_name: grafana
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- grafana-storage:/var/lib/grafana
volumes:
grafana-storage: {}
Prometheus
compose.yml
version: "3"
services:
prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- /home/sebmas/docker/prometheus/etc:/etc/prometheus
- prom_data:/prometheus
volumes:
prom_data: {}
prometheus.yml
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scheme: http
timeout: 10s
api_version: v1
scrape_configs:
- job_name: prometheus
honor_timestamps: true
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- localhost:9090
Node exporter
cd /tmp wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-armv7.tar.gz tar -zxf node_exporter-1.7.0.linux-armv7.tar.gz mv node_exporter-1.7.0.linux-armv7/node_exporter /usr/local/bin useradd --no-create-home --shell /bin/false node_exporter chown node_exporter:node_exporter /usr/local/bin/node_exporter mkdir -p /opt/config/etc/systemd/system/ cd /opt/config/etc/systemd/system nano node_exporter.service
[Unit] Description=Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter Restart=always RestartSec=3 [Install] WantedBy=multi-user.target
ln -s /opt/config/etc/systemd/system/node_exporter.service /etc/systemd/system/ systemctl daemon-reload systemctl enable node_exporter systemctl start node_exporter systemctl status node_exporter
prometheus 2
at the end of prometheus.yml
- job_name: rpi static_configs: - targets: ['192.168.1.20:9100']
grafana 2
- add data source –> prometheus
- create dashboard –> import a dashboard –> https://grafana.com/grafana/dashboards/1860-node-exporter-full –> copy id and give it to grafana
snmp exporter
sources:
snmp exporter for synology
cd /tmp wget https://github.com/prometheus/snmp_exporter/releases/download/v0.25.0/snmp_exporter-0.25.0.linux-armv7.tar.gz tar -zxf snmp_exporter-0.25.0.linux-armv7.tar.gz cd snmp_exporter-0.25.0.linux-armv7 mv snmp_exporter /usr/local/bin/ chown node_exporter:node_exporter /usr/local/bin/snmp_exporter mkdir /opt/config/snmp_exporter cd /opt/config/snmp_exporter wget https://github.com/ddiiwoong/synology-prometheus/blob/master/snmp-synology/snmp-0.24.x.yml cd /opt/config/etc/systemd/system nano snmp_exporter
[Unit] Description=Prometheus SNMP Exporter Service Wants=network-online.target After=network-online.target [Service] Type=simple User=node_exporter Group=node_exporter ExecStart=/usr/local/bin/snmp_exporter --config.file="/opt/config/snmp_exporter/syno-snmp-0.24.x.yml" Restart=always RestartSec=3 [Install] WantedBy=multi-user.target
systemctl daemon-reload ln -s /opt/config/etc/systemd/system/snmp_exporter /etc/systemd/system/ systemctl enable snmp_exporter systemctl start snmp_exporter ssytemctl status snmp_exporterat the end of the prometheus config file add:
- job_name: 'synology'
static_configs:
- targets: ['<replace with synology nas ip>']
metrics_path: /snmp
params:
module: [synology]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- source_labels: [__param_target]
regex: (.*)
replacement: <replace with snmp_exporter ip>:9116
target_label: __address__
use this https://grafana.com/grafana/dashboards/14284-synology-nas-details/
prometheus.1707233648.txt.gz · Last modified: by ssm2017
