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

(PIE-51) Ability to define a metrics server to ship to #19

Merged
merged 10 commits into from
Jul 11, 2019

Conversation

HelenCampbell
Copy link

@HelenCampbell HelenCampbell commented Jun 25, 2019

This is a rebase of the work done in #6 with the addition of a splunk_hec option.
All comments in the original PR should have hopefully been addressed.
Still currently a WIP.

npwalker and others added 3 commits June 19, 2019 12:01
Prior to this commit, there was no built-in way to ship metrics
to an outside metrics server.

After this commit, we pull in a script from
puppetlabs/puppet-metrics-viewer that allows conversion of the
metrics data we gather to influxdb or graphite format.

This commit adds the initial support to enabling shipping of metrics
directly to influxdb when given a hostname to connect to.
Previously, we only allowed passing an influxdb host but you may
want to pass a port or a different database type for influx.

Additionally, you may prefer to ship to graphite.

You can now do any of these by using the correct
metrics_server_info hash.
@HelenCampbell HelenCampbell force-pushed the PIE-51 branch 2 times, most recently from c50e028 to 9bf8b19 Compare June 26, 2019 11:13
@jarretlavallee jarretlavallee requested a review from npwalker June 26, 2019 17:12
@jarretlavallee
Copy link
Contributor

@HelenCampbell Thanks for picking this up and making those changes! In #6 I was wrong about the json2timeseriesdb being in sync with puppet-metrics-viewer. The changes to it allowed sending the STDIN to the script from puppetlabs/puppet-metrics-viewer#25.

@HelenCampbell HelenCampbell changed the title (WIP)(PIE-51) Ability to define a metrics server to ship to (PIE-51) Ability to define a metrics server to ship to Jul 1, 2019
$metrics_command = $metrics_server_type ? {
'influxdb' => "${port_metrics_command} --influx-db ${metrics_server_db} > /dev/null",
'graphite' => "${port_metrics_command} > /dev/null",
'splunk_hec' => "${port_metrics_command} | puppet splunk_hec --sourcetype puppet:summary --saved_report > /dev/null",

Choose a reason for hiding this comment

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

should be the following for splunk_hec (no assumption on $path setting, etc) /opt/puppetlabs/bin/puppet splunk_hec --sourcetype puppet:metrics --pe_metrics

README.md Outdated
port => Optional[Integer],
db_name => Optional[String],

Specifies a metrics server to write data to. Currently it supports `influxdb` and `graphite` type servers. The parameters `metrics_server_type` and `hostname` are both required, and `dbname` is required for a `metrics_server_type` of `influxdb`.

Choose a reason for hiding this comment

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

add splunk_hec as data source, link to splunk_hec module since users need that setup first and then just selection splunk_hec, etc.

Chris Barker and others added 2 commits July 1, 2019 12:02
Since we define all attributes of a splunk server in the splunk_hec module
we will remove it from the type here and just let a user define using a
splunk_hec as a top level toggle.
Enables use_splunk_hec bool
@mrzarquon
Copy link

@jarretlavallee this is ready for your review / merge - we had to update puppetlabs/splunk_hec to 0.7.1, but now we have a way to enable splunk support OR the metrics / graphite servers, etc.

@@ -10,6 +10,9 @@
String $metric_script_file = 'tk_metrics',
Array[Hash] $additional_metrics = [],
Boolean $ssl = true,
Boolean $use_splunk_hec = false,
Copy link
Contributor

@npwalker npwalker Jul 2, 2019

Choose a reason for hiding this comment

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

I'm kind of thinking we shouldn't special case splunk here. What about having an enum['graphite','influxdb','splunk'] export_to parameter and get rid of metrics server type inside of metrics_server_info.

@mrzarquon @HelenCampbell

@HelenCampbell
Copy link
Author

@npwalker I've done an initial attempt at pulling out the type and putting it into parameters. Still need to fully test but is this implementation along the lines of what you were thinking of? Thanks

@npwalker
Copy link
Contributor

npwalker commented Jul 9, 2019

This seems good. I wasn't necessarily thinking of moving all of the type out to individual parameters but that's mostly because I'm lazy and didn't want to have to add the parameters across all the classes.

Since you already did the work to move them all out I think this is good and probably easier for most end-consumers vs using the hash of info.

Copy link
Contributor

@jarretlavallee jarretlavallee left a comment

Choose a reason for hiding this comment

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

This looks good to me. I tested it out with the following classification and it was able to ship the metrics correctly.

  class{'puppet_metrics_collector':
    metrics_server_type => 'influxdb',
    metrics_server_hostname => 'pe-201910-agent.puppetdebug.vlan',
    metrics_server_port => 8086,
    metrics_server_db_name => 'puppet_metrics',
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants