Skip to content

Commit

Permalink
fix(instances): set influxdb token by variable to telegraf
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Nov 7, 2024
1 parent 6ad6cc6 commit 074e55a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions instances/modules/common/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ resource "aws_instance" "server" {
"sudo usermod -aG docker ubuntu",
# Altera o hostname antes de instalar o telegraf
"sudo hostnamectl set-hostname --transient --static ${var.instance_name}",
# Configura a variável que será usada no telegraf
"export INFLUXDB_TOKEN=${var.influxdb_token}",
"echo 'export INFLUXDB_TOKEN=${var.influxdb_token}' >> ~/.bashrc",
# Inicia a configuração do monitoramento
"cd /home/ubuntu/monitoring/",
"sudo chmod +x install-telegraf.sh",
"sudo ./install-telegraf.sh"
"sudo ./install-telegraf.sh",
# Configura a variável que será usada no telegraf
"sudo su -c 'echo \"INFLUXDB_TOKEN=${var.influxdb_token}\" >> /etc/default/telegraf'",
# Reinicia o telegraf para garantir que a variavel está configurada
"sudo systemctl restart telegraf",
]

connection {
Expand Down

0 comments on commit 074e55a

Please sign in to comment.