Showing with 26 additions and 10 deletions.
  1. +6 −0 CHANGELOG.md
  2. +1 −0 files/amq_metrics
  3. +17 −9 files/tk_metrics
  4. +1 −0 manifests/pe_metric.pp
  5. +1 −1 metadata.json
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Z Release 4.2.1

## Bug Fixes:
- PE versions < 2016.2 now GET each metric individually instead of using a POST
- [PR #30](https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/30)

# Minor Release 4.2.0

## Improvements
Expand Down
1 change: 1 addition & 0 deletions files/amq_metrics
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ HOSTS = config['hosts']
PORT = config['metrics_port']
METRICS = config['additional_metrics']
CLIENTCERT = config['clientcert']
PE_VERSION = config['pe_version']

POST_DATA = METRICS.to_json

Expand Down
26 changes: 17 additions & 9 deletions files/tk_metrics
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ HOSTS = config['hosts']
PORT = config['metrics_port']
METRICS = config['additional_metrics']
CLIENTCERT = config['clientcert']
PE_VERSION = config['pe_version']

$error_array = []

Expand Down Expand Up @@ -82,18 +83,25 @@ HOSTS.each do |host|
post_data = []

unless METRICS.empty? then
METRICS.each do |metric|
post_data << metric['url']
end
if Gem::Version.new(PE_VERSION) < Gem::Version.new('2016.2.0') then
METRICS.each do |metric|
endpoint = "#{host_url}/metrics/v1/mbeans/#{metric['url']}"
dataset['servers'][hostkey][METRICS_TYPE][metric['name']] = get_endpoint(endpoint)
end
else
METRICS.each do |metric|
post_data << metric['url']
end

endpoint = "#{host_url}/metrics/v1/mbeans"
metrics_output = post_endpoint(endpoint, post_data.to_json)
endpoint = "#{host_url}/metrics/v1/mbeans"
metrics_output = post_endpoint(endpoint, post_data.to_json)

METRICS.each_index do |index|
metric_name = METRICS[index]['name']
metric_data = metrics_output[index]
METRICS.each_index do |index|
metric_name = METRICS[index]['name']
metric_data = metrics_output[index]

dataset['servers'][hostkey][METRICS_TYPE][metric_name] = metric_data
dataset['servers'][hostkey][METRICS_TYPE][metric_name] = metric_data
end
end
end

Expand Down
1 change: 1 addition & 0 deletions manifests/pe_metric.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'metrics_port' => $metrics_port,
'additional_metrics' => $additional_metrics,
'clientcert' => $::clientcert,
'pe_version' => $facts['pe_server_version'],
}

file { "${scripts_dir}/${metrics_type}_config.yaml" :
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "npwalker/pe_metric_curl_cron_jobs",
"version": "4.2.0",
"version": "4.2.1",
"author": "npwalker",
"summary": "A Puppet module for gathering metrics from PE components",
"license": "Apache-2.0",
Expand Down