Showing with 48 additions and 4 deletions.
  1. +46 −2 README.md
  2. +2 −2 templates/puppetdb_metrics.sh.epp
48 changes: 46 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Table of Contents
=================

* [How to use](#how-to-use)
* [Monolithic Install](#monolithic-install)
* [Split Install ( Running on the Master )](#split-install--running-on-the-master-)
* [Monolithic With Compile Masters ( Running on the MoM )](#monolithic-with-compile-masters--running-on-the-mom-)
* [Split With Compile Masters ( Running on the MoM )](#split-with-compile-masters--running-on-the-mom-)
* [Other Option](#other-option)
* [What do you get](#what-do-you-get)
* [Grepping for Metrics](#grepping-for-metrics)
* [Puppetserver](#puppetserver)
* [PuppetDB](#puppetdb)

# How to use

```
Expand All @@ -6,13 +20,43 @@ include pe_metric_curl_cron_jobs

If you do not want to manage this long term and want to get it up and running quickly you can run it via puppet apply.

## Monolithic Install

```
cd /tmp;
git clone https://github.com/npwalker/pe_metric_curl_cron_jobs;
puppet apply -e "class { 'pe_metric_curl_cron_jobs': }" --modulepath .
```

## Split Install ( Running on the Master )

```
cd /tmp;
git clone https://github.com/npwalker/pe_metric_curl_cron_jobs;
puppet apply -e "class { 'pe_metric_curl_cron_jobs' : puppetdb_hosts => ['split-puppetdb.domain.com'] }" --modulepath .
```

## Monolithic With Compile Masters ( Running on the MoM )

```
cd /tmp;
git clone https://github.com/npwalker/pe_metric_curl_cron_jobs;
puppet apply -e "include pe_metric_curl_cron_jobs" --modulepath .
puppet apply -e "class { 'pe_metric_curl_cron_jobs' : puppet_server_hosts => ['compile-master-1.domain.com', 'compile-master-2.domain.com'] }" --modulepath .
```

## Split With Compile Masters ( Running on the MoM )

```
cd /tmp;
git clone https://github.com/npwalker/pe_metric_curl_cron_jobs;
puppet apply -e "class { 'pe_metric_curl_cron_jobs' : puppetdb_hosts => ['split-puppetdb.domain.com'], puppet_server_hosts => ['compile-master-1.domain.com', 'compile-master-2.domain.com'] }" --modulepath .
```

## Other Option

This option puts metrics on each individual node so I don't think it's as good as having centrally gathered metrics but you can also install the module on each individual node. If you install on a compile master you can set `puppetdb_metrics_ensure` to `absent` and if you install on a puppetdb node then you can set `$puppet_server_metrics_ensure` to `absent`.

## What do you get
# What do you get

By default the module tracks the metrics coming from the status endpoint on Puppetserver and the internal ActiveMQ metrics on PuppetDB.

Expand Down
4 changes: 2 additions & 2 deletions templates/puppetdb_metrics.sh.epp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
| -%>

<% $hosts.each | $host | { -%>
echo 'curl -k http://<%= $host %>:8080/metrics/v1/mbeans/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands' >> <%= $output_dir %>/<%= $host %>-`date +'%m_%d_%y_%R'`.json
curl -k http://<%= $host %>:8080/metrics/v1/mbeans/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands >> <%= $output_dir %>/<%= $host %>-`date +'%m_%d_%y_%R'`.json
echo 'curl -k https://<%= $host %>:8081/metrics/v1/mbeans/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands' --cert /etc/puppetlabs/puppet/ssl/certs/<%= $::clientcert %>.pem --key /etc/puppetlabs/puppet/ssl/private_keys/<%= $::clientcert %>.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem >> <%= $output_dir %>/<%= $host %>-`date +'%m_%d_%y_%R'`.json
curl -k https://<%= $host %>:8081/metrics/v1/mbeans/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=puppetlabs.puppetdb.commands --cert /etc/puppetlabs/puppet/ssl/certs/<%= $::clientcert %>.pem --key /etc/puppetlabs/puppet/ssl/private_keys/<%= $::clientcert %>.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem >> <%= $output_dir %>/<%= $host %>-`date +'%m_%d_%y_%R'`.json
<% } -%>