Comments (25)
Hi Juan,
the php-agent recipe includes by default the default recipe of the php cookbook. It seems you haven't got that particular cookbook (could not find recipe default for cookbook php
), would you mind double-checking this and uploading it to your Chef server/OpsWorks?
Hope this helps!
Kind regards,
David
from newrelic.
By default chef has access to the following php cookbook https://github.com/aws/opsworks-cookbooks/tree/master-chef-11.4/php. I now see that the custom AWS OpsWorks cookbook for PHP doesn't have a default
recipe. Any way around this?
from newrelic.
Hi,
the newrelic-cookbook can handle different php-cookbooks/recipes by just making use of the attribute (see default['newrelic']['php_recipe'] = "php::default"
in attributes/php_agent.rb). The default value is php::default
, but you can easily change it...
Let me know how it goes, thanks in advance for your feedback!
Kind regards,
David
from newrelic.
Hi @onema,
how did that go in the end? Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
I would also be interested in hearing how this works as I'm having the same issue. I think it boils down to php-agent needing the node['php']['ext_conf_dir'] in order to place newrelic.ini file. as @onema said opsworks doesn't have php::default cookbook. I'm currently stuck in trying to find where to get this variable from.
from newrelic.
Hi! Did anyone manage to make the cookbook work in Amazon OpsWorks and if so: can you show me and example of what a Custom Chef Json string look like? Also do you specify a branch?
from newrelic.
I did get this to work by hacking it a bit.
These are the steps I took:
- Set php layer to run the newrelic::default recipe in the setup stage
- Set php layer in opsworks to run newrelic::php-agent in configure stage
- Changed the php-agent.rb recipe to disable the php_recipe and added a recipe apache2::service as this was needed to restart the apache, the diff is below
+# include_recipe node['newrelic']['php_recipe']
+# FIXME: need this recipe as we are restarting apache
+include_recipe 'apache2::service' - attributes/php-agent.rb disabled the recipe as well
-default['newrelic']['php_recipe'] = ""
+# disable as we are using opsworks and do not have php node
+#default['newrelic']['php_recipe'] = "php::configure" - Add the license key to attributes/default.php
- The php recipe is needed to get the php directory at this line template "#{node['php']['ext_conf_dir']}/newrelic.ini" as I couldn't find right php recipe to include I set the external JSON in stack configuration to point to the php installation using this json, (below code also sets the name):
{"newrelic" : {
"application_monitoring" : {
"appname" : "Prod Webservice us-east-1"
}
},
"php" : {
"ext_conf_dir" : "/etc/php5/conf.d/"
}
}
Hope that helps someone :)
Elvis
from newrelic.
Hi guys,
I'd like to make this process easier for OpsWorks, but will need your help to do so...
Quickly reading through @elvisbot's last post, would it help adding in a New Relic-cookbook attribute for ['php']['ext_conf_dir'](defaulting to node['php']['ext_conf_dir'])?
You run newrelic::default (=repo + server-monitoring) and then newrelic::php-agent (application monitoring) but specify a custom node['newrelic']['php-agent']['php']['ext_conf_dir'](still to be added in)...
Also: not 100% why the apache2::service is included - could you shed some more light on step #2?
Thanks in advance!
Kind regards,
David
from newrelic.
Hi,
It would probably help adding an attribute php ext_conf_dir so that it is managed through the code, but the approach I took is not so bad either. Ideally we should be able to import an opsworks recipe that gives us the ext_conf_dir attribute, I couldn't find this recipe.
I specify the apache2::service as a dependency as this is where the code to restart apache lives, otherwise the notifying of apache2 doesn't work, i.e. this line 'notifies :restart, "service[#{node['newrelic']['web_server']['service_name']}]", :delayed'
Thanks
Elvis
from newrelic.
Hi guys,
I've just added in the additional attribute - please do let me know how it goes, thanks in advance!
Kind regards,
David
from newrelic.
can someone fix this error for me?
Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb
ArgumentError
You must supply a name when declaring a template resource
Cookbook Trace:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:55:in `from_file'
Relevant File Content:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:
48: command 'php5enmod newrelic'
49: action :nothing
50: only_if { node['newrelic']['php_agent']['execute_php5enmod'] }
51: end
52:
53: # configure New Relic INI file and set the daemon related options (documented at /usr/lib/newrelic-php5/scripts/newrelic.ini.template)
54: # and restart the web server in order to pick up the new settings
55>> template node['newrelic']['php_agent']['config_file'] do
56: cookbook node['newrelic']['php_agent']['template']['cookbook_ini']
57: source node['newrelic']['php_agent']['template']['source_ini']
58: owner 'root'
59: group 'root'
60: mode 0644
61: variables(
62: :enabled => node['newrelic']['application_monitoring']['enabled'],
63: :license => license,
64: :logfile => node['newrelic']['application_monitoring']['logfile'],
from newrelic.
Hi @gentitope,
you haven't specified the config_file-attribute. Please set it in your role/environment/wrapper cookbook. The actual value depends on your depends on your php external configuration directory; eg. "/etc/php5/conf.d/newrelic.ini" or "/etc/php5/mods-available/newrelic.ini"...
Hope this helps!
David
P.S. The cookbook should definitely throw a more user-friendly message before running into the error you got... I'll make a note of that!
from newrelic.
I am new to opsworks. please where is role/environment/wrapper cookbook to set the attribute.
Thanks
from newrelic.
newrelic deamon does not start at boot until apache is restarted manually.
How can i fix this?
Thanks
from newrelic.
Hi @gentitope,
please do have a look at New Relic PHP agent's startup modes: https://docs.newrelic.com/docs/agents/php-agent/installation/starting-php-daemon
HTH!
David
from newrelic.
Hello David,
Even after setting the config file like below:
default['newrelic']['php_agent']['config_file'] = '/etc/php5/apache2/conf.d/newrelic.ini'
I still receive the error
Relevant File Content:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:
48: command 'php5enmod newrelic'
49: action :nothing
50: only_if { node['newrelic']['php_agent']['execute_php5enmod'] }
51: end
52:
53: # configure New Relic INI file and set the daemon related options (documented at /usr/lib/newrelic-php5/scripts/newrelic.ini.template)
54: # and restart the web server in order to pick up the new settings
55>> template node['newrelic']['php_agent']['config_file'] do
56: cookbook node['newrelic']['php_agent']['template']['cookbook_ini']
57: source node['newrelic']['php_agent']['template']['source_ini']
58: owner 'root'
59: group 'root'
60: mode 0644
61: variables(
62: :enabled => node['newrelic']['application_monitoring']['enabled'],
63: :license => license,
64: :logfile => node['newrelic']['application_monitoring']['logfile'],
I am doing this on ubuntu linux AWS
I look forward to your response.
Thanks
Temitope
from newrelic.
Hi @tobiadeniji,
would you mind trying to set the attribute in your role or environment? Just to make sure it's actually set... Also: what is the exact error message you get? (didn't seem to be included)
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
Hi David,
This is the error below:
ArgumentError
You must supply a name when declaring a template resource
Cookbook Trace:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:55:in `from_file'
Relevant File Content:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:
48: command 'php5enmod newrelic'
49: action :nothing
50: only_if { node['newrelic']['php_agent']['execute_php5enmod'] }
51: end
52:
53: # configure New Relic INI file and set the daemon related options (documented at /usr/lib/newrelic-php5/scripts/newrelic.ini.template)
54: # and restart the web server in order to pick up the new settings
55>> template node['newrelic']['php_agent']['config_file'] do
56: cookbook node['newrelic']['php_agent']['template']['cookbook_ini']
57: source node['newrelic']['php_agent']['template']['source_ini']
58: owner 'root'
59: group 'root'
60: mode 0644
61: variables(
62: :enabled => node['newrelic']['application_monitoring']['enabled'],
63: :license => license,
64: :logfile => node['newrelic']['application_monitoring']['logfile'],
Despite declaring the config file path in the cookbook attribute.
How can I solve this?
Thanks
Temitope Oteyowo | Linux Administrator
Phone +234 (0) 703-232-8080
Our Mission: To be the Engine of Commerce and Trade in Africa
https://www.facebook.com/Shopkonga /Shopkonga https://twitter.com/Shopkonga /Shopkonga https://plus.google.com/u/1/b/108084064638315602176/108084064638315602176/posts /Shopkonga
8 Montgomery Road, Yaba, Lagos, Nigeria.
From: David Joos [mailto:[email protected]]
Sent: Saturday, November 15, 2014 9:18 PM
To: escapestudios-cookbooks/newrelic
Cc: gentitope
Subject: Re: [newrelic] OpsWorks - newrelic::php-agent exception (#56)
Hi @tobiadeniji https://github.com/tobiadeniji ,
would you mind trying to set the attribute in your role or environment? Just to make sure it's actually set... Also: what is the exact error message you get? (didn't seem to be included)
Thanks in advance for your feedback!
Kind regards,
David
—
Reply to this email directly or view it on GitHub #56 (comment) . https://github.com/notifications/beacon/AIa_Kl4qyEmmXcS4O-soQX6xjgD89-nEks5nN6xkgaJpZM4BhgD1.gif
from newrelic.
Hello David,
I waiting for your expert input.
ArgumentError
You must supply a name when declaring a template resource
Cookbook Trace:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:55:in `from_file'
Relevant File Content:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/php_agent.rb:
48: command 'php5enmod newrelic'
49: action :nothing
50: only_if { node['newrelic']['php_agent']['execute_php5enmod'] }
51: end
52:
53: # configure New Relic INI file and set the daemon related options (documented at /usr/lib/newrelic-php5/scripts/newrelic.ini.template)
54: # and restart the web server in order to pick up the new settings
55>> template node['newrelic']['php_agent']['config_file'] do
56: cookbook node['newrelic']['php_agent']['template']['cookbook_ini']
57: source node['newrelic']['php_agent']['template']['source_ini']
58: owner 'root'
59: group 'root'
60: mode 0644
61: variables(
62: :enabled => node['newrelic']['application_monitoring']['enabled'],
63: :license => license,
64: :logfile => node['newrelic']['application_monitoring']['logfile'],
[2014-11-17T12:29:27+00:00] ERROR: Running exception handlers
[2014-11-17T12:29:27+00:00] ERROR: Exception handlers complete
[2014-11-17T12:29:27+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2014-11-17T12:29:27+00:00] ERROR: You must supply a name when declaring a template resource
[2014-11-17T12:29:27+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Thanks
from newrelic.
Hi @gentitope,
it seems like node['newrelic']['php_agent']['config_file'] hasn't been set... (eg. /etc/php5/conf.d/newrelic.ini or /etc/php5/mods-available/newrelic.ini - see README.md)
The cookbook should test that attribute first and return a more user friendly error though rather than letting the Chef resource error out...
Let me know how it goes - setting this attribute should help!
Kind regards,
David
from newrelic.
Hello David,
This is my setting in attribute: default['newrelic']['php_agent']['config_file'] = ' /etc/php5/mods-available/newrelic.ini'. Where else do i need to set this parameters because i still get the same error.
Where is the location of the attribute of role or environment?
Thank you for your help so far.
Temitope
from newrelic.
Hi Gentitope,
are you setting this attribute in a wrapper cookbook, or... ? It just seems the way the atteibute value is set doesn't work...
I'm not too familiar with OpsWorks, but here's an article on how to set attributes on OpsWorks: http://blogs.aws.amazon.com/application-management/post/TxZX2UI4YSBW3T/Customizing-AWS-OpsWorks-with-Attributes
Hope this helps!
Kind regards,
David
from newrelic.
Hello David,
I have issue installing python agent.
Find the error below:
Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/python_agent.rb
NoMethodError
No resource or method named python_pip' for
Chef::Recipe "python_agent"'
Cookbook Trace:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/python_agent.rb:12:in `from_file'
Relevant File Content:
/var/lib/aws/opsworks/cache.stage2/cookbooks/newrelic/recipes/python_agent.rb:
5: # Copyright 2012-2014, Escape Studios
6: #
7:
8: include_recipe 'newrelic::repository'
9:
10: license = node['newrelic']['application_monitoring']['license']
11:
12>> python_pip 'newrelic' do
13: if node['newrelic']['python_agent']['python_venv']
14: virtualenv node['newrelic']['python_agent']['python_venv']
15: end
16: action node['newrelic']['python_agent']['agent_action']
17: if node['newrelic']['python_agent']['python_version'] != 'latest'
18: version node['newrelic']['python_agent']['python_version']
19: end
20: end
21:
from newrelic.
Hi @gentitope,
could you make sure to include the python (default) recipe in your run list?
I'll try to have a look at some better error checking though...
Hope this helps!
Kind regards,
David
from newrelic.
If anyone else finds this thread, note there's a similar issue regarding php-agent here: #208
It appears it's been renamed to php_agent, and updating your recipe name should solve a lot of problems.
from newrelic.
Related Issues (20)
- Newrelic dot APM agent doesnot upgrade HOT 4
- doesn't support strip_command_line parameter HOT 2
- Every node attribute used a default value to a property needs a `lazy { }` around it. HOT 6
- Cannot overwrite windows newrelic-infra agent source HOT 1
- Cloning resource attributes for service[newrelic-daemon] from prior resource HOT 1
- [agent_dotnet] Add support for enabling distributed tracing on the newrelic.config.erb template HOT 1
- Error executing action `enable` on resource 'newrelic_agent_infrastructure[Install]' is failing on debian7
- Default value of 'windows_checksum' in newrelic/resources/agent_infrastructure.rb does not match computed checksum HOT 1
- Recipe newrelic::java_agent fails install with the `Error executing action run on resource execute[newrelic_install_newrelic.jar]` HOT 2
- hello-world
- Hi world HOT 1
- Distributed Tracing feature in PHP Agent cookbook doesn't work
- add max_procs for newrelic_infra.yml
- Saleem A. H
- Compile Error on server_monitor.rb HOT 2
- "platform?" bug after ugprading newrelic version HOT 2
- Adding add event_queue_depth attribute to newrelic-infra.yml file is not there
- Cookbook failed on chef-client 17.8.25 HOT 2
- Hello World
- Please add Ubuntu 22.04 support, Ubuntu 20.04 fails with malformed repository line
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from newrelic.