Skip to content

Commit

Permalink
Configure New Relic ini for php cli
Browse files Browse the repository at this point in the history
  • Loading branch information
danxexe committed Dec 22, 2017
1 parent bbf1cc7 commit e384727
Showing 1 changed file with 50 additions and 44 deletions.
94 changes: 50 additions & 44 deletions recipes/php-agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,50 +33,56 @@

#configure New Relic INI file and set the daemon related options (documented at /usr/lib/newrelic-php5/scripts/newrelic.ini.template)
#and restart the web server in order to pick up the new settings
template "#{node['php']['ext_conf_dir']}/newrelic.ini" do
source "newrelic.ini.php.erb"
owner "root"
group "root"
mode "0644"
variables(
:enabled => node['newrelic']['application_monitoring']['enabled'],
:license => license,
:logfile => node['newrelic']['application_monitoring']['logfile'],
:loglevel => node['newrelic']['application_monitoring']['loglevel'],
:appname => node['newrelic']['application_monitoring']['appname'],
:daemon_logfile => node['newrelic']['application_monitoring']['daemon']['logfile'],
:daemon_loglevel => node['newrelic']['application_monitoring']['daemon']['loglevel'],
:daemon_port => node['newrelic']['application_monitoring']['daemon']['port'],
:daemon_max_threads => node['newrelic']['application_monitoring']['daemon']['max_threads'],
:daemon_ssl => node['newrelic']['application_monitoring']['daemon']['ssl'],
:daemon_ssl_ca_path => node['newrelic']['application_monitoring']['daemon']['ssl_ca_path'],
:daemon_ssl_ca_bundle => node['newrelic']['application_monitoring']['daemon']['ssl_ca_bundle'],
:daemon_proxy => node['newrelic']['application_monitoring']['daemon']['proxy'],
:daemon_pidfile => node['newrelic']['application_monitoring']['daemon']['pidfile'],
:daemon_location => node['newrelic']['application_monitoring']['daemon']['location'],
:daemon_collector_host => node['newrelic']['application_monitoring']['daemon']['collector_host'],
:daemon_dont_launch => node['newrelic']['application_monitoring']['daemon']['dont_launch'],
:capture_params => node['newrelic']['application_monitoring']['capture_params'],
:ignored_params => node['newrelic']['application_monitoring']['ignored_params'],
:error_collector_enable => node['newrelic']['application_monitoring']['error_collector']['enable'],
:error_collector_record_database_errors => node['newrelic']['application_monitoring']['error_collector']['record_database_errors'],
:error_collector_prioritize_api_errors => node['newrelic']['application_monitoring']['error_collector']['prioritize_api_errors'],
:browser_monitoring_auto_instrument => node['newrelic']['application_monitoring']['browser_monitoring']['auto_instrument'],
:transaction_tracer_enable => node['newrelic']['application_monitoring']['transaction_tracer']['enable'],
:transaction_tracer_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['threshold'],
:transaction_tracer_detail => node['newrelic']['application_monitoring']['transaction_tracer']['detail'],
:transaction_tracer_slow_sql => node['newrelic']['application_monitoring']['transaction_tracer']['slow_sql'],
:transaction_tracer_stack_trace_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['stack_trace_threshold'],
:transaction_tracer_explain_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['explain_threshold'],
:transaction_tracer_record_sql => node['newrelic']['application_monitoring']['transaction_tracer']['record_sql'],
:transaction_tracer_custom => node['newrelic']['application_monitoring']['transaction_tracer']['custom'],
:framework => node['newrelic']['application_monitoring']['framework'],
:webtransaction_name_remove_trailing_path => node['newrelic']['application_monitoring']['webtransaction']['name']['remove_trailing_path'],
:webtransaction_name_functions => node['newrelic']['application_monitoring']['webtransaction']['name']['functions'],
:webtransaction_name_files => node['newrelic']['application_monitoring']['webtransaction']['name']['files']
)
action :create
notifies :restart, "service[#{node['newrelic']['php-agent']['web_server']['service_name']}]", :delayed
[
"#{node['php']['ext_conf_dir']}",
"/etc/php/7.1/cli/conf.d",
"/etc/php5/cli/conf.d",
].each do |dir|
template "#{dir}/newrelic.ini" do
source "newrelic.ini.php.erb"
owner "root"
group "root"
mode "0644"
variables(
:enabled => node['newrelic']['application_monitoring']['enabled'],
:license => license,
:logfile => node['newrelic']['application_monitoring']['logfile'],
:loglevel => node['newrelic']['application_monitoring']['loglevel'],
:appname => node['newrelic']['application_monitoring']['appname'],
:daemon_logfile => node['newrelic']['application_monitoring']['daemon']['logfile'],
:daemon_loglevel => node['newrelic']['application_monitoring']['daemon']['loglevel'],
:daemon_port => node['newrelic']['application_monitoring']['daemon']['port'],
:daemon_max_threads => node['newrelic']['application_monitoring']['daemon']['max_threads'],
:daemon_ssl => node['newrelic']['application_monitoring']['daemon']['ssl'],
:daemon_ssl_ca_path => node['newrelic']['application_monitoring']['daemon']['ssl_ca_path'],
:daemon_ssl_ca_bundle => node['newrelic']['application_monitoring']['daemon']['ssl_ca_bundle'],
:daemon_proxy => node['newrelic']['application_monitoring']['daemon']['proxy'],
:daemon_pidfile => node['newrelic']['application_monitoring']['daemon']['pidfile'],
:daemon_location => node['newrelic']['application_monitoring']['daemon']['location'],
:daemon_collector_host => node['newrelic']['application_monitoring']['daemon']['collector_host'],
:daemon_dont_launch => node['newrelic']['application_monitoring']['daemon']['dont_launch'],
:capture_params => node['newrelic']['application_monitoring']['capture_params'],
:ignored_params => node['newrelic']['application_monitoring']['ignored_params'],
:error_collector_enable => node['newrelic']['application_monitoring']['error_collector']['enable'],
:error_collector_record_database_errors => node['newrelic']['application_monitoring']['error_collector']['record_database_errors'],
:error_collector_prioritize_api_errors => node['newrelic']['application_monitoring']['error_collector']['prioritize_api_errors'],
:browser_monitoring_auto_instrument => node['newrelic']['application_monitoring']['browser_monitoring']['auto_instrument'],
:transaction_tracer_enable => node['newrelic']['application_monitoring']['transaction_tracer']['enable'],
:transaction_tracer_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['threshold'],
:transaction_tracer_detail => node['newrelic']['application_monitoring']['transaction_tracer']['detail'],
:transaction_tracer_slow_sql => node['newrelic']['application_monitoring']['transaction_tracer']['slow_sql'],
:transaction_tracer_stack_trace_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['stack_trace_threshold'],
:transaction_tracer_explain_threshold => node['newrelic']['application_monitoring']['transaction_tracer']['explain_threshold'],
:transaction_tracer_record_sql => node['newrelic']['application_monitoring']['transaction_tracer']['record_sql'],
:transaction_tracer_custom => node['newrelic']['application_monitoring']['transaction_tracer']['custom'],
:framework => node['newrelic']['application_monitoring']['framework'],
:webtransaction_name_remove_trailing_path => node['newrelic']['application_monitoring']['webtransaction']['name']['remove_trailing_path'],
:webtransaction_name_functions => node['newrelic']['application_monitoring']['webtransaction']['name']['functions'],
:webtransaction_name_files => node['newrelic']['application_monitoring']['webtransaction']['name']['files']
)
action :create
notifies :restart, "service[#{node['newrelic']['php-agent']['web_server']['service_name']}]", :delayed
end
end

#https://newrelic.com/docs/php/newrelic-daemon-startup-modes
Expand Down

0 comments on commit e384727

Please sign in to comment.