Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure New Relic ini for php cli #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
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']}", "Pay PHP Default"],
["/etc/php/7.1/cli/conf.d", "Pay PHP CLI"],
["/etc/php5/cli/conf.d", "Pay PHP CLI"],
].each do |dir, appname|
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'] || 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