aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-09-29 20:02:39 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2024-09-29 20:02:39 +0200
commit0d13a5b4a2392200e78c8e15aa59044ec18eea16 (patch)
tree6fefc67b3e9cf2d7183eb870f03c589303f5e881
parentbfffb5e3ca2d548064a783a8800ee3a829d50d17 (diff)
downloadinfra-0d13a5b4a2392200e78c8e15aa59044ec18eea16.tar.gz
infra-0d13a5b4a2392200e78c8e15aa59044ec18eea16.tar.bz2
infra-0d13a5b4a2392200e78c8e15aa59044ec18eea16.tar.xz
infra-0d13a5b4a2392200e78c8e15aa59044ec18eea16.zip
prometheus
-rwxr-xr-xbin/terraform2
-rw-r--r--terraform/hash-prometheus/.terraform.lock.hcl19
-rw-r--r--terraform/hash-prometheus/backend.tf4
-rw-r--r--terraform/hash-prometheus/main.tf2
-rw-r--r--terraform/hash-prometheus/play-config.yml17
-rw-r--r--terraform/hash-prometheus/prometheus.tf13
-rw-r--r--terraform/hash-prometheus/prometheus.yml17
7 files changed, 58 insertions, 16 deletions
diff --git a/bin/terraform b/bin/terraform
index d90a3d8..e1a4dfc 100755
--- a/bin/terraform
+++ b/bin/terraform
@@ -2,7 +2,7 @@
set -euo pipefail
-version=1.3.6
+version=1.9.5
basedir="${0%/*}"
diff --git a/terraform/hash-prometheus/.terraform.lock.hcl b/terraform/hash-prometheus/.terraform.lock.hcl
index 3098d65..52de25e 100644
--- a/terraform/hash-prometheus/.terraform.lock.hcl
+++ b/terraform/hash-prometheus/.terraform.lock.hcl
@@ -23,6 +23,25 @@ provider "registry.terraform.io/cyrilgdn/postgresql" {
]
}
+provider "registry.terraform.io/hashicorp/local" {
+ version = "2.5.2"
+ hashes = [
+ "h1:JlMZD6nYqJ8sSrFfEAH0Vk/SL8WLZRmFaMUF9PJK5wM=",
+ "zh:136299545178ce281c56f36965bf91c35407c11897f7082b3b983d86cb79b511",
+ "zh:3b4486858aa9cb8163378722b642c57c529b6c64bfbfc9461d940a84cd66ebea",
+ "zh:4855ee628ead847741aa4f4fc9bed50cfdbf197f2912775dd9fe7bc43fa077c0",
+ "zh:4b8cd2583d1edcac4011caafe8afb7a95e8110a607a1d5fb87d921178074a69b",
+ "zh:52084ddaff8c8cd3f9e7bcb7ce4dc1eab00602912c96da43c29b4762dc376038",
+ "zh:71562d330d3f92d79b2952ffdda0dad167e952e46200c767dd30c6af8d7c0ed3",
+ "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
+ "zh:805f81ade06ff68fa8b908d31892eaed5c180ae031c77ad35f82cb7a74b97cf4",
+ "zh:8b6b3ebeaaa8e38dd04e56996abe80db9be6f4c1df75ac3cccc77642899bd464",
+ "zh:ad07750576b99248037b897de71113cc19b1a8d0bc235eb99173cc83d0de3b1b",
+ "zh:b9f1c3bfadb74068f5c205292badb0661e17ac05eb23bfe8bd809691e4583d0e",
+ "zh:cc4cbcd67414fefb111c1bf7ab0bc4beb8c0b553d01719ad17de9a047adff4d1",
+ ]
+}
+
provider "registry.terraform.io/hashicorp/null" {
version = "3.2.3"
hashes = [
diff --git a/terraform/hash-prometheus/backend.tf b/terraform/hash-prometheus/backend.tf
index 3913062..ab991d8 100644
--- a/terraform/hash-prometheus/backend.tf
+++ b/terraform/hash-prometheus/backend.tf
@@ -4,9 +4,11 @@ terraform {
bucket = "terraform-a6726272-73ff-11ed-8bdd-c79eb8376e05"
key = "hash-prometheus/terraform.tfstate"
skip_region_validation = true
+ skip_requesting_account_id =true
skip_credentials_validation = true
skip_metadata_api_check = true
+ skip_s3_checksum = true
region = "eu-central-1"
- endpoint = "eu-central-1.linodeobjects.com"
+ endpoints = { s3: "https://eu-central-1.linodeobjects.com" }
}
}
diff --git a/terraform/hash-prometheus/main.tf b/terraform/hash-prometheus/main.tf
index 28c3ba2..79029bc 100644
--- a/terraform/hash-prometheus/main.tf
+++ b/terraform/hash-prometheus/main.tf
@@ -1,5 +1,5 @@
terraform {
- required_version = "~> 1.3.5"
+ required_version = "~> 1.9.5"
required_providers {
docker = {
diff --git a/terraform/hash-prometheus/play-config.yml b/terraform/hash-prometheus/play-config.yml
new file mode 100644
index 0000000..92ec3e6
--- /dev/null
+++ b/terraform/hash-prometheus/play-config.yml
@@ -0,0 +1,17 @@
+- hosts: hash
+ tasks:
+ - become: yes
+ name: mkdir /etc/docker-service/prometheus
+ file:
+ path: /etc/docker-service/prometheus
+ state: directory
+
+ - become: yes
+ name: cp /etc/docker-service/prometheus/prometheus.yml
+ register: config
+ copy:
+ src: prometheus.yml
+ dest: /etc/docker-service/prometheus/prometheus.yml
+
+ - shell: docker kill --signal HUP prometheus
+ when: config.changed
diff --git a/terraform/hash-prometheus/prometheus.tf b/terraform/hash-prometheus/prometheus.tf
index dd25727..4c77ce8 100644
--- a/terraform/hash-prometheus/prometheus.tf
+++ b/terraform/hash-prometheus/prometheus.tf
@@ -42,7 +42,7 @@ resource "docker_container" "prometheus" {
# }
mounts {
- source = "${local.path}"
+ source = local.path
target = "/etc/prometheus"
type = "bind"
}
@@ -53,19 +53,8 @@ resource "docker_container" "prometheus" {
container_path = "/prometheus"
}
- depends_on = [ null_resource.mkdir ]
}
locals {
path = "/etc/docker-service/prometheus"
}
-
-resource "null_resource" "mkdir" {
- triggers = {
- path = local.path
- }
-
- provisioner "local-exec" {
- command = "ssh ${local.host} sudo mkdir -p ${local.path}"
- }
-}
diff --git a/terraform/hash-prometheus/prometheus.yml b/terraform/hash-prometheus/prometheus.yml
index e42f0c4..afc1112 100644
--- a/terraform/hash-prometheus/prometheus.yml
+++ b/terraform/hash-prometheus/prometheus.yml
@@ -1,2 +1,17 @@
global:
- scrape_interval: 10s
+ scrape_interval: 60s
+
+scrape_configs:
+ - job_name: node
+ scrape_interval: 1m
+ static_configs:
+ - targets:
+ - "knot.dn42.trygvis.io:9100"
+ - "hash.dn42.trygvis.io:9100"
+
+ - job_name: bird
+ scrape_interval: 1m
+ static_configs:
+ - targets:
+ - "knot.dn42.trygvis.io:9324"
+ - "hash.dn42.trygvis.io:9324"