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

Ship directly to influx #6

Closed
wants to merge 3 commits into from

Conversation

npwalker
Copy link
Contributor

Porting npwalker/pe_metric_curl_cron_jobs#48 to puppet_metrics_collector

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.
@jarretlavallee
Copy link
Contributor

I took a brief look at this and it looks pretty great. I'll test this out this week and put in a review.

HelenCampbell pushed a commit to puppetlabs/puppetlabs-splunk_hec that referenced this pull request May 17, 2019
This commit adds the splunk_hec puppet face/app allowing for a cat json | puppet splunk_hec like workflow. The first functionality of this code is to enable sending pe metrics data to Splunk using the current CS best practices for collecting the CS data.

This will need changes in the puppet metrics collector module managed by CS to enable that specific workflow: puppetlabs/puppetlabs-puppet_metrics_collector#6

This also adds the transaction_uuid to the fact event submission, so correlation of facts created, the catalog, and the report are now possible.

This introduces an epochtime function to ensure that across all of our event submission code, we're always generating a timestamp of the same precision and in the same way.
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 great. I tested it out and was able to get the metrics to populate.

true => $local_metrics_command,
}

$metrics_command = $metrics_server_type ? {
Copy link
Contributor

Choose a reason for hiding this comment

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

This command should redirect STDOUT to /dev/null otherwise it will spam the /var/spool/mail/root every run.

@@ -15,6 +15,7 @@
Array[String] $activemq_hosts = [ '127.0.0.1' ],
Integer $activemq_port = 8161,
Boolean $symlink_puppet_metrics_collector = true,
Optional[Puppet_metrics_collector::Metrics_server] $metrics_server_info = undef,
Copy link
Contributor

Choose a reason for hiding this comment

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

The format for this parameter needs to be documented in the readme as well as an example.

@@ -0,0 +1,362 @@
#!/opt/puppetlabs/puppet/bin/ruby
Copy link
Contributor

Choose a reason for hiding this comment

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

There were some new changes to this file in puppetlabs/puppet-metrics-viewer#28 that should be synced over. What process should we use to ensure these are both in sync?

fail( 'When using an influxdb server you must provide the db_name to store metrics in' )
}

$local_metrics_command = "${metrics_base_command} | ${conversion_script_file_name} --netcat ${metrics_server_hostname} --convert-to ${metrics_server_type}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this command overridable by a parameter? It would be nice to specify this for external tools like puppetlabs/puppetlabs-splunk_hec@b39cd4e

@jarretlavallee
Copy link
Contributor

Closing in favor of #19 which has the changes and a rebase.

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.

3 participants