From 6a44ce709c3a25fcecc8bdbeb7bb60d5aa0847cf Mon Sep 17 00:00:00 2001 From: Martin Evgeniev Date: Wed, 6 Feb 2019 11:20:29 +0100 Subject: [PATCH] Fix: prometheus and node_exporter installation Also add bidirectional <> communications form qed to prometheus --- deploy/aws/main.tf | 2 +- deploy/aws/modules/prometheus/main.tf | 9 +++------ deploy/aws/modules/qed/main.tf | 4 ++++ deploy/aws/network.tf | 9 ++++++++- deploy/aws/variables.tf | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/deploy/aws/main.tf b/deploy/aws/main.tf index 80918fa3e..b3a208659 100644 --- a/deploy/aws/main.tf +++ b/deploy/aws/main.tf @@ -227,7 +227,7 @@ module "prometheus" { - job_name: 'Qed0-HostMetrics' scrape_interval: 10s static_configs: - - targets: ['${module.leader.private_ip}:9100', ] + - targets: ['${module.leader.private_ip}:9100'] - job_name: 'Qed0-QedMetrics' scrape_interval: 10s static_configs: diff --git a/deploy/aws/modules/prometheus/main.tf b/deploy/aws/modules/prometheus/main.tf index 9fb7d44d9..8d7abe0c1 100644 --- a/deploy/aws/modules/prometheus/main.tf +++ b/deploy/aws/modules/prometheus/main.tf @@ -79,15 +79,12 @@ resource "aws_instance" "prometheus" { sudo yum install -y https://dl.grafana.com/oss/release/grafana-5.4.2-1.x86_64.rpm sudo service grafana-server start - while [ ! -f ${var.path}/prometheus ]; do - sleep 1 # INFO: wait until binary exists + while [ `lsof ${var.path}/prometheus | wc -l` -gt 0 ]; do + sleep 1 # INFO: prevents Error of `text file busy` done - sleep 1 chmod +x ${var.path}/prometheus - nohup ${var.path}/prometheus --config.file=${var.path}/prometheus.yml & + ${var.path}/prometheus --config.file=${var.path}/prometheus.yml - - DATA } diff --git a/deploy/aws/modules/qed/main.tf b/deploy/aws/modules/qed/main.tf index 14c7b3734..4443d1fe2 100644 --- a/deploy/aws/modules/qed/main.tf +++ b/deploy/aws/modules/qed/main.tf @@ -82,6 +82,10 @@ resource "aws_instance" "qed-server" { done chmod +x ${var.path}/qed + chmod +x ${var.path}/node_exporter + + ${var.path}/node_exporter & ${var.path}/qed ${var.command} + DATA } diff --git a/deploy/aws/network.tf b/deploy/aws/network.tf index 49baf44d9..913045685 100644 --- a/deploy/aws/network.tf +++ b/deploy/aws/network.tf @@ -75,9 +75,16 @@ module "security_group" { to_port = 65535 protocol = "tcp" source_security_group_id = "${module.security_group.this_security_group_id}" + }, + { + from_port = 0 + to_port = 65535 + protocol = "tcp" + source_security_group_id = "${module.prometheus_security_group.this_security_group_id}" } ] - number_of_computed_ingress_with_source_security_group_id = 1 + + number_of_computed_ingress_with_source_security_group_id = 2 } diff --git a/deploy/aws/variables.tf b/deploy/aws/variables.tf index d6b0d6050..0b0edf114 100644 --- a/deploy/aws/variables.tf +++ b/deploy/aws/variables.tf @@ -4,4 +4,4 @@ variable "aws_profile" { variable "keypath" { default = "~/.ssh/id_rsa_free" -} +} \ No newline at end of file