Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Allow setting RabbitMQ component name #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/template_newrelic_plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ agents:
# RabbitMQ Default URL versions prior to 3.0
#management_api_url: http://guest:guest@localhost:55672
#
# You can override the component name. If this is not used, the server host/port are used as the component name.
#component_name: 'Server A'
#
# Set "debug: true" to see additional debug output
# Note: This logs the metrics locally and does not send data to new relic.
#debug: false
Expand Down
10 changes: 7 additions & 3 deletions plugins/pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ module RabbitMQPlugin
class Agent < NewRelic::Plugin::Agent::Base
agent_guid 'com.pivotal.newrelic.plugin.rabbitmq'
agent_version '1.0.5'
agent_config_options :management_api_url, :debug
agent_config_options :management_api_url, :debug, :component_name
agent_human_labels('RabbitMQ') do
uri = URI.parse(management_api_url)
"#{uri.host}:#{uri.port}"
if (!"#{self.component_name}".empty?)
"#{self.component_name}"
else
uri = URI.parse(management_api_url)
"#{uri.host}:#{uri.port}"
end
end

def poll_cycle
Expand Down