Export Postgres metrics to Prometheus.
This commit is contained in:
@@ -6,6 +6,9 @@ job "postgres" {
|
|||||||
port "db" {
|
port "db" {
|
||||||
to = 5432
|
to = 5432
|
||||||
}
|
}
|
||||||
|
port "exporter" {
|
||||||
|
to = 9187
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task "postgres" {
|
task "postgres" {
|
||||||
@@ -18,7 +21,7 @@ job "postgres" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
env {
|
env {
|
||||||
POSTGRES_PASSWORD = "Faelaishewohlees4nei"
|
POSTGRES_PASSWORD = "${var.pg_password}"
|
||||||
}
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
@@ -37,5 +40,29 @@ job "postgres" {
|
|||||||
memory = 512
|
memory = 512
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task "exporter" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "quay.io/prometheuscommunity/postgres-exporter"
|
||||||
|
ports = ["exporter"]
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
DATA_SOURCE_NAME = "postgresql://postgres:${var.pg_password}@${NOMAD_ADDR_db}/postgres?sslmode=disable"
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "postgres-exporter"
|
||||||
|
port = "exporter"
|
||||||
|
tags = ["metrics"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "pg_password" {
|
||||||
|
type = string
|
||||||
|
default = "Faelaishewohlees4nei"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user