Make the influx url dynamic in telegraf class, SC-2522

This commit is contained in:
Patrik Holmqvist 2025-03-26 09:28:34 +01:00
parent aedcc9e8d2
commit 0a88863867
Signed by: pahol
GPG key ID: 5D5B0D4E93F77273
2 changed files with 4 additions and 2 deletions

View file

@ -4,11 +4,13 @@
# @param server_fqdn The FQDN of the server. (referenced in compose file)
# @param ports Port mappings for container
# @param service_dir The directory where all related config and files are stored. (referenced in compose file)
# @param influx_urls List of influxdb urls to send data to
class eid::telegraf2 (
String $version = 'latest',
String $server_fqdn = $facts['networking']['fqdn'],
Array $ports = [],
String $service_dir = '/etc/telegraf',
Array $influx_urls = ["https://metrics-external-1.sunet.se:8086"],
) {
# Get influx values

View file

@ -1,5 +1,5 @@
[[outputs.influxdb_v2]]
urls = ["https://metrics-external-1.sunet.se:8086"]
urls = [<%= @influxdb2_urls %>]
token = <%= @influxdb2_token %>
organization = <%= @influxdb2_org %>
bucket = <%= @influxdb2_bucket %>
@ -7,7 +7,7 @@
[outputs.influxdb_v2.tagdrop]
influxdb_database = ["*"]
[[outputs.influxdb_v2]]
urls = ["https://metrics-external-1.sunet.se:8086"]
urls = [<%= @influx_urls %>]
token = <%= @influxdb2_token %>
organization = <%= @influxdb2_org %>
bucket = <%= @influxdb2_bucket %>