-
Notifications
You must be signed in to change notification settings - Fork 259
add support for trusted fact tags and add info line for puppetserver … #662
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
Changes from 6 commits
d3cea86
0a59781
c3a779d
8f14548
510a635
4888b23
e4a7814
57d9cfd
0bc0df6
febfa1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| API_KEY = config[:datadog_api_key] | ||
| API_URL = config[:api_url] | ||
| REPORT_FACT_TAGS = config[:report_fact_tags] || [] | ||
| REPORT_TRUSTED_FACT_TAGS = config[:report_trusted_fact_tags] || [] | ||
|
|
||
| if ENV['DD_PROXY_HTTP'].nil? | ||
| ENV['DD_PROXY_HTTP'] = config[:proxy_http] | ||
|
|
@@ -135,9 +136,13 @@ def process | |
| end | ||
|
|
||
| facts = Puppet::Node::Facts.indirection.find(host).values | ||
| dog_tags = REPORT_FACT_TAGS.map { |name| "#{name}:#{facts.dig(*name.split('.'))}" } | ||
| facts_tags = REPORT_FACT_TAGS.map { |name| "#{name}:#{facts.dig(*name.split('.'))}" } | ||
| trusted_facts = (Puppet.lookup(:trusted_information) { Hash.new }).to_h | ||
| trusted_facts = { "trusted" => trusted_facts.to_h } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make sure
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the examples section in Puppet docs [1], it looks like the [1] https://puppet.com/docs/puppet/5.5/lang_facts_and_builtin_vars.html#examples |
||
| trusted_fact_tags = REPORT_TRUSTED_FACT_TAGS.map { |name| "#{name}:#{trusted_facts.dig(*name.split('.'))}" } | ||
| dog_tags = facts_tags + trusted_fact_tags | ||
|
|
||
| Puppet.debug "Sending events for #{@msg_host} to Datadog" | ||
| Puppet.debug "Sending events for #{@msg_host} to Datadog. Trusted facts #{trusted_facts.to_s}. Trusted facts tags #{@trusted_fact_tags.to_s}." | ||
| @dog.emit_event(Dogapi::Event.new(event_data, | ||
| msg_title: event_title, | ||
| event_type: 'config_management.run', | ||
|
|
@@ -147,5 +152,6 @@ def process | |
| source_type_name: 'puppet', | ||
| tags: dog_tags), | ||
| host: @msg_host) | ||
| Puppet.info "Event sent for #{@msg_host} to Datadog" | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.