Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move lookup_options to hiera #134

Merged

Conversation

alexjfisher
Copy link
Member

This allows the merge strategy to be overriden by users in their own
hiera.

This allows the merge strategy to be overriden by users in their own
hiera.
@alexjfisher
Copy link
Member Author

@rschemm Could you test this for me and report back?

@@ -24,16 +24,12 @@
debug = <%= @debug %>
quiet = <%= @quiet %>

<% if @_outputs -%>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A hash is always truthy. I did consider changing it to unless @outputs.empty?, but I don't think there's any point. The defaults aren't empty, and does having no inputs or outputs make a lot of sense?

@rschemm-godaddy
Copy link

hierarchy:
  - name: "role common"
    path: "roles/%{::server_type}/common.eyaml"

  - name: "environment specific"
    path: "envs/%{::env}.eyaml"

  - name: "Common for all roles"
    path: "common.eyaml"

common.eyaml

telegraf::global_tags:
  role: "%{::server_type}"

telegraf::interval: '60s'
telegraf::round_interval: true
telegraf::metric_batch_size: 1000
telegraf::metric_buffer_limit: 10000
telegraf::collection_jitter: "0s"
telegraf::flush_interval: "60s"
telegraf::flush_jitter: "0s"
telegraf::precision: ""
telegraf::debug: false
telegraf::quiet: false
telegraf::logfile: ""
telegraf::hostname: testing
telegraf::omit_hostname: false

telegraf::outputs:
  cloudwatch:
    region: "%{::ec2_region}"
    namespace: "testing"

telegraf::inputs:
  nstat:
    dump_zeros: true
    fieldpass:
      - "*TcpOutRsts*"
      - "*TcpExtPruneCalled*"

in roles/role1/common.eyaml

lookup_options:
  telegraf::inputs:
    merge: first
telegraf::inputs:
  nstat:
    dump_zeros: true
    fieldpass:
      - "*IcmpInErrors*"

in envs/dev.eyaml

lookup_options:
  telegraf::inputs:
    merge: deep
telegraf::inputs:
  jolokia2_agent:
    username: *jolokia_user
    password: *jolokia_pass

Notice: Compiled catalog for testing in environment production in 1.73 seconds
Warning: Found multiple default providers for sysctl: augeas, parsed; using augeas
Notice: /Stage[main]/Telegraf::Config/File[/etc/telegraf/telegraf.conf]/ensure: defined content as '{md5}6ef9007fd6a6ed571569bcf7afbe8a1c'
Notice: /Stage[main]/Telegraf::Service/Service[telegraf]: Triggered 'refresh' from 1 events
Notice: Applied catalog in 0.41 seconds
+ RC=2
+ set +x
RC=2.  The run succeeded, and some resources were changed.
$ cat /etc/telegraf/telegraf.conf
# Telegraf Configuration
#
# THIS FILE IS MANAGED BY PUPPET
#
[global_tags]
  role = "dir"

[agent]
  hostname = "testing"
  omit_hostname = false
  interval = "60s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "60s"
  flush_jitter = "0s"
  precision = ""
  logfile = ""
  debug = false
  quiet = false

#
# OUTPUTS:
#
[outputs.cloudwatch]
namespace = "testing"
region = "us-west-2"


#
# INPUTS:
#
[inputs.nstat]
dump_zeros = true
fieldpass = ["*IcmpInErrors*"]

Testing with all inputs removed from hiera

$ cat /etc/telegraf/telegraf.conf
# Telegraf Configuration
#
# THIS FILE IS MANAGED BY PUPPET
#
[global_tags]
  role = "dir"

[agent]
  hostname = "testing"
  omit_hostname = false
  interval = "60s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "60s"
  flush_jitter = "0s"
  precision = ""
  logfile = ""
  debug = false
  quiet = false

#
# OUTPUTS:
#
[outputs.cloudwatch]
namespace = "testing"
region = "us-west-2"


#
# INPUTS:
#
[[inputs.cpu]]
percpu = true
totalcpu = true

Looks good to me

@alexjfisher alexjfisher changed the title Untested: Move lookup_options to hiera Move lookup_options to hiera Dec 20, 2019
@alexjfisher alexjfisher added the enhancement New feature or request label Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants