From 048f190538dd115696f5e1ae67289c3769e385c7 Mon Sep 17 00:00:00 2001 From: David Joos Date: Fri, 24 Jan 2014 23:50:13 +0000 Subject: [PATCH] Added hostname field to server monitoring config file, fixes #51 --- README.md | 1 + attributes/default.rb | 1 + metadata.rb | 2 +- recipes/server-monitor.rb | 3 ++- templates/default/nrsysmond.cfg.erb | 16 ++++++++++++++++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a661b5a1..6e338ca4 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Attributes * `node['newrelic']['server_monitoring']['ssl']` * `node['newrelic']['server_monitoring']['ssl_ca_bundle']` * `node['newrelic']['server_monitoring']['ssl_ca_path']` +* `node['newrelic']['server_monitoring']['hostname']` * `node['newrelic']['server_monitoring']['pidfile']` * `node['newrelic']['server_monitoring']['collector_host']` * `node['newrelic']['server_monitoring']['timeout']` diff --git a/attributes/default.rb b/attributes/default.rb index 7f4b1548..5d4226c0 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -22,6 +22,7 @@ default['newrelic']['server_monitoring']['ssl'] = nil default['newrelic']['server_monitoring']['ssl_ca_bundle'] = nil default['newrelic']['server_monitoring']['ssl_ca_path'] = nil +default['newrelic']['server_monitoring']['hostname'] = nil default['newrelic']['server_monitoring']['pidfile'] = nil default['newrelic']['server_monitoring']['collector_host'] = nil default['newrelic']['server_monitoring']['timeout'] = nil diff --git a/metadata.rb b/metadata.rb index a24f16fd..743e9dc9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license "MIT" description "Installs/Configures New Relic" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.5.6" +version "0.5.7" %w{ debian ubuntu redhat centos fedora scientific amazon windows smartos }.each do |os| supports os diff --git a/recipes/server-monitor.rb b/recipes/server-monitor.rb index 2657ff16..c414f5f5 100644 --- a/recipes/server-monitor.rb +++ b/recipes/server-monitor.rb @@ -23,8 +23,9 @@ :loglevel => node['newrelic']['server_monitoring']['loglevel'], :proxy => node['newrelic']['server_monitoring']['proxy'], :ssl => node['newrelic']['server_monitoring']['ssl'], - :ssl_ca_path => node['newrelic']['server_monitoring']['ssl_ca_path'], :ssl_ca_bundle => node['newrelic']['server_monitoring']['ssl_ca_bundle'], + :ssl_ca_path => node['newrelic']['server_monitoring']['ssl_ca_path'], + :hostname => node['newrelic']['server_monitoring']['hostname'], :pidfile => node['newrelic']['server_monitoring']['pidfile'], :collector_host => node['newrelic']['server_monitoring']['collector_host'], :timeout => node['newrelic']['server_monitoring']['timeout'] diff --git a/templates/default/nrsysmond.cfg.erb b/templates/default/nrsysmond.cfg.erb index 69dcdd81..e291e8f3 100644 --- a/templates/default/nrsysmond.cfg.erb +++ b/templates/default/nrsysmond.cfg.erb @@ -114,6 +114,22 @@ ssl_ca_bundle=<%= @ssl_ca_bundle %> ssl_ca_path=<%= @ssl_ca_path %> <% end %> +# +# Option : hostname +# Value : A meaningful host name to be displayed in the user interface. On +# many cloud based nodes the host name is incomprehensible and makes +# finding a specific host problematic. Using this option will allow +# you to assign a more meaningful name to a host. You must ensure +# that all your host names are unique. +# Default: Whatever the system calls the host. +# Note : Can also be set with the -n command line option. +# +<% if @hostname.nil? %> +#hostname= +<% else %> +hostname=<%= @hostname %> +<% end %> + # # Option : pidfile # Value : Name of a file where the server monitoring daemon will store it's