Skip to content

Commit

Permalink
Merge pull request #166 from m0dular/SUP-3681-invalid_auth
Browse files Browse the repository at this point in the history
(SUP-3681) Check for valid status key in metrics
  • Loading branch information
m0dular authored Sep 29, 2022
2 parents 5ed1f75 + 54b701f commit 12e4287
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions files/pe_metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ def retrieve_additional_metrics(host, port, use_ssl, metrics_type, metrics)
metrics.each_index do |index|
metric_name = metrics[index]['name']
metric_data = metrics_output[index]
if metric_data['status'] == 200

metric_status = metric_data ? metric_data.dig('status') : nil
next unless metric_status

if metric_status == 200
metrics_array << { 'name' => metric_name, 'data' => metric_data['value'] }
elsif metric_data['status'] == 404
elsif metric_status == 404
metrics_array << { 'name' => metric_name, 'data' => nil }
else
metric_mbean = metrics[index]['mbean']
$error_array << "HTTP Error #{metric_data['status']} for #{metric_mbean}"
$error_array << "HTTP Error #{metric_status} for #{metric_mbean}"
end
end

Expand Down

0 comments on commit 12e4287

Please sign in to comment.