Cleanup of telegraf2 class, SC-2522

This commit is contained in:
Patrik Holmqvist 2025-03-27 09:27:03 +01:00
parent 884e7c293d
commit ad74413fdc
Signed by: pahol
GPG key ID: 5D5B0D4E93F77273
2 changed files with 21 additions and 64 deletions

View file

@ -11,14 +11,15 @@ class eid::telegraf2 (
Array $ports = [], Array $ports = [],
String $service_dir = '/etc/telegraf', String $service_dir = '/etc/telegraf',
Array $influx_urls = ["https://metrics-external-1.sunet.se:8086"], Array $influx_urls = ["https://metrics-external-1.sunet.se:8086"],
String $influxdb2_org = "SwedenConnect", String $influxdb2_org = 'SwedenConnect',
String $influxdb2_bucket = "eidas", String $influxdb2_bucket = 'eidas',
String $influxdb2_bucket_proxy = "eidas-proxy", String $influxdb2_bucket_proxy = 'eidas-proxy',
) { ) {
# Get influx values # Get influx password token from eyaml
$influx2_token = hiera(influx2_token,'NOT_SET_IN_HIERA') $influx2_token = hiera(influx2_token,'NOT_SET_IN_HIERA')
if $influx2_token != 'NOT_SET_IN_HIERA' {
sunet::docker_compose { 'telegraf': sunet::docker_compose { 'telegraf':
content => template('eid/telegraf2/docker-compose.yml.erb'), content => template('eid/telegraf2/docker-compose.yml.erb'),
service_name => 'telegraf', service_name => 'telegraf',
@ -27,33 +28,6 @@ class eid::telegraf2 (
description => 'telegraf' description => 'telegraf'
} }
#file {["${service_dir}/telegraf.conf.d"]: ensure => directory }
#concat {"${service_dir}/telegraf.conf":
# owner => 'root',
# group => 'root',
# mode => '0644',
#notify => [Sunet::Docker_compose["telegraf"]]
#}
# Below not pretty but I'm piggy-backing on this class to add a secondary output to test the new influx2-server
#if ($influx2_token != 'NOT_SET_IN_HIERA') {
# file { "${service_dir}/telegraf.conf.d/95-telegraf.conf":
# ensure => file,
# owner => 'root',
# group => 'root',
# path => "${service_dir}/telegraf.conf.d/95-telegraf.conf",
# mode => '0644',
# content => template('eid/telegraf2/95-telegraf.conf.erb'),
# }
#}
#eid_glob(["${service_dir}/telegraf.conf.d/*.conf"]).each |String $file| {
# concat::fragment { $file:
# target => "${service_dir}/telegraf.conf",
# source => $file,
# }
#}
file { "${service_dir}/telegraf.conf": file { "${service_dir}/telegraf.conf":
ensure => file, ensure => file,
owner => 'root', owner => 'root',
@ -62,5 +36,5 @@ class eid::telegraf2 (
mode => '0644', mode => '0644',
content => template('eid/telegraf2/telegraf.conf.erb'), content => template('eid/telegraf2/telegraf.conf.erb'),
} }
}
} }

View file

@ -1,17 +0,0 @@
[[outputs.influxdb_v2]]
urls = ["https://metrics-external-1.sunet.se:8086"]
token = <%= @influxdb2_token %>
organization = <%= @influxdb2_org %>
bucket = <%= @influxdb2_bucket %>
insecure_skip_verify = true
[outputs.influxdb_v2.tagdrop]
influxdb_database = ["*"]
[[outputs.influxdb_v2]]
urls = ["https://metrics-external-1.sunet.se:8086"]
token = <%= @influxdb2_token %>
organization = <%= @influxdb2_org %>
bucket = <%= @influxdb2_bucket %>
insecure_skip_verify = true
tagexclude = ["influxdb_database"]
[outputs.influxdb_v2.tagpass]
influxdb_database = ["proxy"]