48 lines
2.2 KiB
Puppet
48 lines
2.2 KiB
Puppet
# This puppet manifest is used to configure Telegraf for Sweden Connect
|
|
|
|
# @param version Version of the docker image to use. (referenced in compose file)
|
|
# @param server_fqdn The FQDN of the server. (referenced in compose file)
|
|
# @param server_type Type of server, used in compose for config differentiation
|
|
# @param ports Port mappings for container to override default
|
|
# @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
|
|
# @param influxdb2_org Influx organization (referenced in compose file)
|
|
# @param influxdb2_bucket Influx bucket name (referenced in compose file)
|
|
# @param influxdb2_bucket_proxy Influx bucket name (referenced in compose file)
|
|
# @param use_ftics This should be true if sunet::fticks is used
|
|
class eid::telegraf2 (
|
|
Enum['proxy', 'log'] $server_type,
|
|
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"],
|
|
String $influxdb2_org = 'SwedenConnect',
|
|
String $influxdb2_bucket = 'eidas',
|
|
String $influxdb2_bucket_proxy = 'eidas-proxy',
|
|
Boolean $use_fticks = false,
|
|
) {
|
|
|
|
# Get influx password token from eyaml
|
|
$influx2_token = hiera(influx2_token,'NOT_SET_IN_HIERA')
|
|
|
|
if $influx2_token != 'NOT_SET_IN_HIERA' {
|
|
sunet::docker_compose { 'telegraf':
|
|
content => template('eid/telegraf2/docker-compose.yml.erb'),
|
|
service_name => 'telegraf',
|
|
compose_dir => '/etc/',
|
|
compose_filename => 'docker-compose.yml',
|
|
description => 'telegraf'
|
|
}
|
|
|
|
# Create the influx config file
|
|
file { "${service_dir}/telegraf.conf":
|
|
ensure => file,
|
|
owner => 'root',
|
|
group => 'root',
|
|
path => "${service_dir}/telegraf.conf",
|
|
mode => '0644',
|
|
content => template('eid/telegraf2/telegraf.conf.erb'),
|
|
}
|
|
}
|
|
}
|