From b22472422f308e694a92d49e2b9a86c05a9a5917 Mon Sep 17 00:00:00 2001 From: Colin Frei Date: Wed, 14 Sep 2016 11:41:26 +0200 Subject: [PATCH 1/2] Allow passing in a component name --- .../pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb b/plugins/pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb index 7dc1388..25b0945 100755 --- a/plugins/pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb +++ b/plugins/pivotal_rabbitmq_plugin/pivotal_rabbitmq_plugin.rb @@ -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 From 9a3752c769ad7106808aea05fea68273bc299efb Mon Sep 17 00:00:00 2001 From: Colin Frei Date: Wed, 14 Sep 2016 11:43:54 +0200 Subject: [PATCH 2/2] Add config option for component name --- config/template_newrelic_plugin.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/template_newrelic_plugin.yml b/config/template_newrelic_plugin.yml index 8e463f3..7834f93 100644 --- a/config/template_newrelic_plugin.yml +++ b/config/template_newrelic_plugin.yml @@ -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