Comments (14)
Hi @jotajota,
thanks for getting in touch!
The php-agent recipe actually restarts the web server service (default: apache2) during the run, I think an actual reload instead would be better in your case, that shouldn't trigger the APC cache to be flushed - right?
I'd suggest you to change :restart in https://github.com/escapestudios/chef-newrelic/blob/master/recipes/php-agent.rb on line 29, 34 & 105 to :reload in your local cookbook and upload that to run some tests. Let me know if that fixes your issue, then I'll have a look at implementing that in the community version.
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
No, it seems that reload also flushes the apc cache. Would it make sense to check if the newrelic agent is already present before (re)installing it? By the look of it we are reinstalling the agent on every chef run and that seems wasteful :)
from newrelic.
Hi @jotajota,
by just checking whether the agent is already present you could actually end up running an outdated agent, so I'm not very much in favour of that solution. What if we were to add in a way to find out whether the php-agent upgrade actually resulted in a new php-agent version or not? Then we would only trigger all the rest if a new agent actually got installed...
I'm in favour of writing it to a file (~compile_flags, see below) in the chef cache, so that even on an apt-get upgrade the next time the cookbook runs it will pick up the upgraded agent and will make the necessary changes. If the file is not present, the "base" version will be stored, which will then be used in the future.
In other cookbooks we use the compile flags (https://github.com/escapestudios/chef-mplayer/blob/master/recipes/source.rb) to trigger additional bits, but haven't done anything similar with the package resource to be honest :-)
Let me know what you think!
Kind regards,
David
from newrelic.
Yeah having an outdated agent doesn't seem like a nice idea. I'll hack around a bit and get back to you if I think of something.
from newrelic.
Hi,
a notifies on the package resource could actually help out to prevent reinstalling the agent:
package "newrelic-php5" do
action :upgrade
notifies :run, "execute[newrelic-install]", :immediately
end
execute "newrelic-install" do
command "newrelic-install install"
action :nothing
notifies :restart, "service[#{node[:newrelic][:web_server][:service_name]}]", :delayed
end
Could you give our development branch with these changes a go?
(https://github.com/escapestudios/chef-newrelic/tree/development)
Thanks in advance!
Kind regards,
David
from newrelic.
Well, it's got better for sure :) Now we are not reinstalling newrelic on every run. Now the only thing we need is make it so that the recipe only sends the restart event to the webserver when there is an actual change on the newrelic agent.
I will take a look into that this weekend. Thanks so much!
from newrelic.
Cool :)
Which startup mode are you using, agent or external? That is the other place where a restart is notified...
Thanks in advance for your feedback, have a great weekend!
from newrelic.
Agent, going with the default settings for now.
from newrelic.
Ok, I've been giving this another go and the problem is not where I thought (the package upgrade) but in the next block (the if startup_mode == agent). Can you tell me what are you trying to accomplish here? Again, why do you turn the agent off and on on every run?
from newrelic.
Hi,
when using the agent mode, the daemon (=external mode) is stopped and there is actually nothing else turned off and on to be honest... (https://newrelic.com/docs/php/newrelic-daemon-startup-modes)
Only if there are changes to newrelic.ini the template resource should notify a restart of the web server. As a test: could you take out line 106 (notifies restart of web server) and see whether your issue is still there? Just to make sure your web server's restart is triggered over there or somewhere else...
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
Hi,
could you pull down the latest version of the development branch? We've just pushed some changes in there that should address the issue you flagged: rather than on any daemon changes (stop/start), we now send notifications to restart the web server on actual config changes - for both agent mode as external mode.
Again, for more information: see https://newrelic.com/docs/php/newrelic-daemon-startup-modes for more information.
Let me know how it goes, thanks in advance!
Kind regards,
David
from newrelic.
Works flawlessly now. Thanks a lot!
from newrelic.
Hi @jotajota,
perfect! FYI: we've just released the updates as version 0.4.4 of the community cookbook...
Thanks for your feedback!
Kind regards,
David
from newrelic.
👍 !!
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.