master
Siroco 1 year ago
commit 4915a25370
Signed by: siroco
GPG Key ID: 1324098302A514B0
  1. 9
      Dockerfile
  2. 23
      README.md
  3. 11
      config/alert.rules.yml.template
  4. 22
      config/alertmanager.yml.template
  5. 21
      config/prometheus.yml.template
  6. 32
      docker-compose.yml
  7. 39
      docker-compose.yml.template

@ -0,0 +1,9 @@
FROM registry.sindominio.net/debian
RUN apt-get update && \
apt-get -qy --no-install-recommends install prometheus ca-certificates &&\
apt-get clean
VOLUME ["/etc/prometheus","/var/lib/prometheus"]
CMD /usr/bin/prometheus --log.level=debug

@ -0,0 +1,23 @@
# Prometheus
> Prometheus collects metrics from targets by scraping metrics HTTP endpoints. Since Prometheus exposes data in the same manner about itself, it can also scrape and monitor its own health.
https://prometheus.io/
Construido a través de la imagen de GNU/Linux Debian de Sindominio
## Configuración
Hay una plantilla para el _docker-compose.yml_, hay que adaptarla a cada infraestructura
De la misma manera, adjunto los templates de los ficheros de configuración:
* _alert.rules.yml_ : Configuración de las emisiones de alertas a AlertManager (tiempo de espera, intentos, ...)
* _prometheus.yml_ : Configuración de los grupos/usuarios/exporters que debe controlar Prometheus
* _alertmanager.yml_ : Configuración del servicio de AlertManager para el envió de las notificaciones
Más información de la configuración:
* https://prometheus.io/docs/prometheus/latest/configuration/configuration/
* https://prometheus.io/docs/alerting/latest/configuration/

@ -0,0 +1,11 @@
groups:
- name: alert.rules
rules:
- alert: InstanceDown
expr: up == 0
for: 30s
labels:
severity: "critical"
annotations:
summary: "Instance {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minutes."

@ -0,0 +1,22 @@
global:
resolve_timeout: 5m
smtp_smarthost: localhost:25
smtp_from: "prometheus@sindominio.net"
smtp_require_tls: false
route:
group_by: ['alertname','cluster', 'service']
group_wait: 10s
group_interval: 10s
repeat_interval: 1h
receiver: 'email-1'
inhibit_rules:
- source_match:
severity: 'critical'
target_match:
severity: 'warning'
# Apply inhibition if the alertname is the same.
equal: ['alertname', 'cluster', 'service']
receivers:
- name: email-1
email_configs:
- to: admin@sindominio.net

@ -0,0 +1,21 @@
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
external_labels:
monitor: 'sindominio-monitor'
scrape_configs:
- job_name: 'docker-exporter'
basic_auth:
username: 'username'
password: 'pass'
static_configs:
- targets: ['monitor:9100']
rule_files:
- alert.rules.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- alertmanager:9093

@ -0,0 +1,32 @@
version: "3"
services:
sindominio-prometheus:
container_name: prometheus
user: 110:65534
image: registry.sindominio.net/prometheus
restart: always
ports:
- "9091:9090"
volumes:
- ./config/:/etc/prometheus/:ro
- ./data/:/var/lib/prometheus/
sindominio-alertmanager:
container_name: alertmanager
user: 110:65534
image: registry.sindominio.net/alertmanager
restart: always
volumes:
- ./config/:/etc/prometheus/:ro
- ./data/:/var/lib/prometheus/
sindominio-grafana:
container_name: grafana
user: 110:65534
#image: registry.sindominio.net/grafana
build: ./grafana/
restart: always
volumes:
- ./grafana/var/lib/grafana:/var/lib/grafana
- ./grafana/etc/grafana:/etc/grafana

@ -0,0 +1,39 @@
version: "3"
services:
sindominio-prometheus:
container_name: prometheus
user: 110:65534
image: registry.sindominio.net/prometheus
restart: always
ports:
- "9091:9090"
volumes:
- ./config/:/etc/prometheus/:ro
- ./data/:/var/lib/prometheus/
sindominio-alertmanager:
container_name: alertmanager
user: 110:65534
image: registry.sindominio.net/alertmanager
restart: always
volumes:
- ./config/:/etc/prometheus/:ro
- ./data/:/var/lib/prometheus/
sindominio-grafana:
container_name: grafana
<<<<<<< HEAD
<<<<<<< HEAD
#user: 110:65534
=======
user: 110:65534
>>>>>>> 52cb4b3 (Dockerfile update)
=======
#user: 110:65534
>>>>>>> fa44f6f (Update prometheus config)
image: registry.sindominio.net/grafana
restart: always
volumes:
- ./grafana/var/lib/grafana:/var/lib/grafana
- ./grafana/etc/grafana:/etc/grafana
Loading…
Cancel
Save