Traefik monitoring
This commit is contained in:
parent
b35c7e75ec
commit
3466da1205
|
@ -60,6 +60,9 @@ defaultEntryPoints = ["http", "https"]
|
||||||
address = ":1111"
|
address = ":1111"
|
||||||
readOnly = true
|
readOnly = true
|
||||||
|
|
||||||
|
# To enable Traefik to export internal metrics to Prometheus
|
||||||
|
[web.metrics.prometheus]
|
||||||
|
|
||||||
[acme]
|
[acme]
|
||||||
|
|
||||||
email = "acme@captnemo.in"
|
email = "acme@captnemo.in"
|
||||||
|
|
|
@ -13,3 +13,7 @@ output "names-emby" {
|
||||||
output "names-mariadb" {
|
output "names-mariadb" {
|
||||||
value = "${docker_container.mariadb.name}"
|
value = "${docker_container.mariadb.name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "names-traefik" {
|
||||||
|
value = "${docker_container.traefik.name}"
|
||||||
|
}
|
||||||
|
|
|
@ -260,11 +260,11 @@ SESSION_LIFE_TIME = 2592000
|
||||||
; ; This value will be forced to be false in offline mode or Gravatar is disabled.
|
; ; This value will be forced to be false in offline mode or Gravatar is disabled.
|
||||||
; ENABLE_FEDERATED_AVATAR = false
|
; ENABLE_FEDERATED_AVATAR = false
|
||||||
|
|
||||||
; [attachment]
|
[attachment]
|
||||||
; ; Whether attachments are enabled. Defaults to `true`
|
; ; Whether attachments are enabled. Defaults to `true`
|
||||||
; ENABLE = true
|
ENABLE = true
|
||||||
; ; Path for attachments. Defaults to `data/attachments`
|
; ; Path for attachments. Defaults to `data/attachments`
|
||||||
; PATH = data/attachments
|
PATH = data/attachments
|
||||||
; ; One or more allowed types, e.g. image/jpeg|image/png
|
; ; One or more allowed types, e.g. image/jpeg|image/png
|
||||||
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/pdf|text/csv
|
ALLOWED_TYPES = image/jpeg|image/png|application/zip|application/gzip|application/pdf|text/csv
|
||||||
; ; Max size of each file. Defaults to 32MB
|
; ; Max size of each file. Defaults to 32MB
|
||||||
|
@ -465,4 +465,4 @@ SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
||||||
|
|
||||||
[openid]
|
[openid]
|
||||||
ENABLE_OPENID_SIGNIN = true
|
ENABLE_OPENID_SIGNIN = true
|
||||||
ENABLE_OPENID_SIGNUP = false
|
ENABLE_OPENID_SIGNUP = true
|
||||||
|
|
2
main.tf
2
main.tf
|
@ -63,6 +63,8 @@ module "monitoring" {
|
||||||
domain = "bb8.fun"
|
domain = "bb8.fun"
|
||||||
transmission = "${module.docker.names-transmission}"
|
transmission = "${module.docker.names-transmission}"
|
||||||
traefik-labels = "${var.traefik-common-labels}"
|
traefik-labels = "${var.traefik-common-labels}"
|
||||||
|
ips = "${var.ips}"
|
||||||
|
links-traefik = "${module.docker.names-traefik}"
|
||||||
}
|
}
|
||||||
|
|
||||||
module "digitalocean" {
|
module "digitalocean" {
|
||||||
|
|
|
@ -23,5 +23,10 @@ scrape_configs:
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets: ['transmission-exporter:19091']
|
- targets: ['transmission-exporter:19091']
|
||||||
|
|
||||||
|
- job_name: 'traefik'
|
||||||
|
scrape_interval: 5s
|
||||||
|
static_configs:
|
||||||
|
- targets: ['traefik:1111']
|
||||||
|
|
||||||
rule_files:
|
rule_files:
|
||||||
- "alert.rules"
|
- "alert.rules"
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
resource docker_container "grafana" {
|
||||||
|
name = "grafana"
|
||||||
|
image = "${docker_image.grafana.latest}"
|
||||||
|
|
||||||
|
labels = "${merge(
|
||||||
|
var.traefik-labels, map(
|
||||||
|
"traefik.port", 3000,
|
||||||
|
"traefik.frontend.rule","Host:grafana.${var.domain}"
|
||||||
|
))}"
|
||||||
|
|
||||||
|
volumes {
|
||||||
|
host_path = "/mnt/xwing/data/grafana"
|
||||||
|
container_path = "/var/lib/grafana"
|
||||||
|
}
|
||||||
|
|
||||||
|
links = ["${docker_container.prometheus.name}"]
|
||||||
|
|
||||||
|
env = [
|
||||||
|
"GF_SECURITY_ADMIN_PASSWORD=${var.gf-security-admin-password}",
|
||||||
|
"GF_SERVER_ROOT_URL=https://grafana.${var.domain}",
|
||||||
|
]
|
||||||
|
|
||||||
|
restart = "unless-stopped"
|
||||||
|
destroy_grace_seconds = 10
|
||||||
|
must_run = true
|
||||||
|
}
|
|
@ -1,83 +1 @@
|
||||||
resource docker_container "grafana" {
|
|
||||||
name = "grafana"
|
|
||||||
image = "${docker_image.grafana.latest}"
|
|
||||||
|
|
||||||
labels = "${merge(
|
|
||||||
var.traefik-labels, map(
|
|
||||||
"traefik.port", 3000,
|
|
||||||
"traefik.frontend.rule","Host:grafana.${var.domain}"
|
|
||||||
))}"
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/mnt/xwing/data/grafana"
|
|
||||||
container_path = "/var/lib/grafana"
|
|
||||||
}
|
|
||||||
|
|
||||||
links = ["${docker_container.prometheus.name}"]
|
|
||||||
|
|
||||||
env = [
|
|
||||||
"GF_SECURITY_ADMIN_PASSWORD=${var.gf-security-admin-password}",
|
|
||||||
"GF_SERVER_ROOT_URL=https://grafana.${var.domain}",
|
|
||||||
]
|
|
||||||
|
|
||||||
restart = "unless-stopped"
|
|
||||||
destroy_grace_seconds = 10
|
|
||||||
must_run = true
|
|
||||||
}
|
|
||||||
|
|
||||||
resource docker_container "prometheus" {
|
|
||||||
name = "prometheus"
|
|
||||||
image = "${docker_image.prometheus.latest}"
|
|
||||||
|
|
||||||
# prometheus:prometheus
|
|
||||||
user = "985:983"
|
|
||||||
|
|
||||||
command = ["--config.file=/etc/prometheus/prometheus.yml"]
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/mnt/xwing/data/prometheus"
|
|
||||||
container_path = "/prometheus"
|
|
||||||
}
|
|
||||||
|
|
||||||
upload {
|
|
||||||
content = "${file("${path.module}/config/prometheus.yml")}"
|
|
||||||
file = "/etc/prometheus/prometheus.yml"
|
|
||||||
}
|
|
||||||
|
|
||||||
links = ["${docker_container.nodeexporter.name}", "${docker_container.cadvisor.name}"]
|
|
||||||
|
|
||||||
restart = "unless-stopped"
|
|
||||||
destroy_grace_seconds = 10
|
|
||||||
must_run = true
|
|
||||||
}
|
|
||||||
|
|
||||||
resource docker_container "nodeexporter" {
|
|
||||||
name = "nodeexporter"
|
|
||||||
image = "${docker_image.nodeexporter.latest}"
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/proc"
|
|
||||||
container_path = "/host/proc"
|
|
||||||
}
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/sys"
|
|
||||||
container_path = "/host/sys"
|
|
||||||
}
|
|
||||||
|
|
||||||
volumes {
|
|
||||||
host_path = "/"
|
|
||||||
container_path = "/rootfs"
|
|
||||||
read_only = true
|
|
||||||
}
|
|
||||||
|
|
||||||
command = [
|
|
||||||
"--path.procfs=/host/proc",
|
|
||||||
"--path.sysfs=/host/sys",
|
|
||||||
"--collector.filesystem.ignored-mount-points=\"^/(sys|proc|dev|host|etc)($$|/)\"",
|
|
||||||
]
|
|
||||||
|
|
||||||
restart = "unless-stopped"
|
|
||||||
destroy_grace_seconds = 10
|
|
||||||
must_run = true
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
resource docker_container "nodeexporter" {
|
||||||
|
name = "nodeexporter"
|
||||||
|
image = "${docker_image.nodeexporter.latest}"
|
||||||
|
|
||||||
|
volumes {
|
||||||
|
host_path = "/proc"
|
||||||
|
container_path = "/host/proc"
|
||||||
|
}
|
||||||
|
|
||||||
|
volumes {
|
||||||
|
host_path = "/sys"
|
||||||
|
container_path = "/host/sys"
|
||||||
|
}
|
||||||
|
|
||||||
|
volumes {
|
||||||
|
host_path = "/"
|
||||||
|
container_path = "/rootfs"
|
||||||
|
read_only = true
|
||||||
|
}
|
||||||
|
|
||||||
|
command = [
|
||||||
|
"--path.procfs=/host/proc",
|
||||||
|
"--path.sysfs=/host/sys",
|
||||||
|
"--collector.filesystem.ignored-mount-points=\"^/(sys|proc|dev|host|etc)($$|/)\"",
|
||||||
|
]
|
||||||
|
|
||||||
|
restart = "unless-stopped"
|
||||||
|
destroy_grace_seconds = 10
|
||||||
|
must_run = true
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
resource docker_container "prometheus" {
|
||||||
|
name = "prometheus"
|
||||||
|
image = "${docker_image.prometheus.latest}"
|
||||||
|
|
||||||
|
# prometheus:prometheus
|
||||||
|
user = "985:983"
|
||||||
|
|
||||||
|
ports {
|
||||||
|
internal = 9090
|
||||||
|
external = 9090
|
||||||
|
ip = "${var.ips["eth0"]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
command = ["--config.file=/etc/prometheus/prometheus.yml"]
|
||||||
|
|
||||||
|
volumes {
|
||||||
|
host_path = "/mnt/xwing/data/prometheus"
|
||||||
|
container_path = "/prometheus"
|
||||||
|
}
|
||||||
|
|
||||||
|
upload {
|
||||||
|
content = "${file("${path.module}/config/prometheus.yml")}"
|
||||||
|
file = "/etc/prometheus/prometheus.yml"
|
||||||
|
}
|
||||||
|
|
||||||
|
links = [
|
||||||
|
"${docker_container.nodeexporter.name}",
|
||||||
|
"${docker_container.cadvisor.name}",
|
||||||
|
"${docker_container.transmission-exporter.name}",
|
||||||
|
"${var.links-traefik}"
|
||||||
|
]
|
||||||
|
|
||||||
|
restart = "unless-stopped"
|
||||||
|
destroy_grace_seconds = 10
|
||||||
|
must_run = true
|
||||||
|
}
|
|
@ -1,13 +1,20 @@
|
||||||
# Transmission Exporter for prometheus
|
# Transmission Exporter for prometheus
|
||||||
# https://github.com/metalmatze/transmission-exporter
|
# https://github.com/metalmatze/transmission-exporter
|
||||||
|
|
||||||
resource docker_container "transmission-exporter" {
|
resource docker_container "transmission-exporter" {
|
||||||
name = "transmission-exporter"
|
name = "transmission-exporter"
|
||||||
image = "${docker_image.transmission-exporter.latest}"
|
image = "${docker_image.transmission-exporter.latest}"
|
||||||
|
|
||||||
links = ["${var.transmission}"]
|
links = ["${var.transmission}"]
|
||||||
|
|
||||||
|
ports {
|
||||||
|
internal = 19091
|
||||||
|
external = 19091
|
||||||
|
ip = "${var.ips["eth0"]}"
|
||||||
|
}
|
||||||
|
|
||||||
env = [
|
env = [
|
||||||
"TRANSMISSION_ADDR=http://transmission:9091",
|
"TRANSMISSION_ADDR=http://${var.transmission}:9091",
|
||||||
]
|
]
|
||||||
|
|
||||||
restart = "unless-stopped"
|
restart = "unless-stopped"
|
||||||
|
|
|
@ -10,6 +10,10 @@ variable "transmission" {
|
||||||
type = "string"
|
type = "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "links-traefik" {
|
||||||
|
type = "string"
|
||||||
|
}
|
||||||
|
|
||||||
variable "alert-slack-username" {
|
variable "alert-slack-username" {
|
||||||
default = "Prometheus"
|
default = "Prometheus"
|
||||||
}
|
}
|
||||||
|
@ -29,3 +33,7 @@ variable "basic_auth" {
|
||||||
variable "traefik-labels" {
|
variable "traefik-labels" {
|
||||||
type = "map"
|
type = "map"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "ips" {
|
||||||
|
type = "map"
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue