init commit

This commit is contained in:
Vassiliy Yegorov
2020-07-08 16:03:52 +07:00
commit edaa556a5e
30 changed files with 633 additions and 0 deletions

4
4.Addons/.env.example Normal file
View File

@@ -0,0 +1,4 @@
APP_NAME=mon
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=admin

1
4.Addons/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.env

View File

@@ -0,0 +1,68 @@
version: '3.7'
services:
grafana:
container_name: ${APP_NAME}-grafana
image: grafana/grafana:latest
restart: always
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GF_SECURITY_ADMIN_PASSWORD}
- GF_SECURITY_ADMIN_USER=${GF_SECURITY_ADMIN_USER}
- GF_AUTH_ANONYMOUS_ENABLED=false
- GF_USERS_ALLOW_SIGN_UP=false
- GF_USERS_ALLOW_ORG_CREATE=false
labels:
- "traefik.enable=true"
- "traefik.docker.network=webproxy"
- "traefik.http.routers.grafana.entrypoints=https"
- "traefik.http.routers.grafana.rule=Host(`grafana.tfm.zone`)" # change URL !
- "traefik.http.routers.grafana.tls=true"
- "traefik.http.routers.grafana.tls.certresolver=letsEncrypt"
- "traefik.http.routers.grafana.service=grafana-service"
- "traefik.http.services.grafana-service.loadbalancer.server.port=3000"
volumes:
- grafana:/var/lib/grafana/
expose:
- 3000
networks:
- monitor_net
- webproxy
prometheus:
container_name: ${APP_NAME}-prometheus
image: prom/prometheus
restart: always
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
labels:
- "traefik.enable=true"
- "traefik.docker.network=webproxy"
- "traefik.http.routers.prometheus.entrypoints=https"
- "traefik.http.routers.prometheus.rule=Host(`prom.tfm.zone`)" # change URL !
- "traefik.http.routers.prometheus.tls=true"
- "traefik.http.routers.prometheus.tls.certresolver=letsEncrypt"
- "traefik.http.routers.prometheus.service=prometheus-service"
- "traefik.http.routers.prometheus.middlewares=prometheus-auth"
- "traefik.http.services.prometheus-service.loadbalancer.server.port=9090"
- "traefik.http.middlewares.prometheus-auth.basicauth.users=admin:$$2y$$05$$7GBmuRxTR0T3IZ5rQO4iB.cj2p23RjIIkLB/l5bPn3gzkpfVahvKO" # admin \ admin in "echo $(htpasswd -nbB admin admin) | sed -e s/\\$/\\$\\$/g"
volumes:
- ./prometheus/:/etc/prometheus/
- prometheus_data:/prometheus
expose:
- 9090
networks:
- monitor_net
- webproxy
volumes:
prometheus_data:
grafana:
networks:
webproxy:
external:
name: webproxy
monitor_net:
name: monitor_net

5
4.Addons/mon-init.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
[[ ! -f .env ]] && cp .env.example .env
docker-compose up -d

View File

@@ -0,0 +1,42 @@
# my global config
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Attach these labels to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels:
monitor: 'my-project'
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
# - 'alert.rules'
# - "first.rules"
# - "second.rules"
# alert
alerting:
# alertmanagers:
# - scheme: http
# static_configs:
# - targets:
# - "alertmanager:9093"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'traefik-exporter'
file_sd_configs:
- files:
- /etc/prometheus/traefik-exporter.yml

View File

@@ -0,0 +1,5 @@
- targets:
- traefik:8082
labels:
env: test
job: traefik-exporter