Comments (17)
I'm experiencing the same results and ended up just running some execute
providers per the NewRelic tutorial
# Set newrelic license
node.default["newrelic"]["license"] = data_bag_item( "api_keys", "newrelic" )["license"]
# Install newrelic
# include_recipe "newrelic" # Boo! :-( I wish this worked!
execute "rpm -Uvh https://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm"
yum_package "newrelic-sysmond" do
action :install
end
execute "nrsysmond-config --set license_key=#{node["newrelic"]["license"]}"
service "newrelic-sysmond" do
supports :start => true, :stop => true, :status => true, :restart => true, :reload => true
action :start
end
from newrelic.
Hi @tatemz,
it seems that the issue that @silverl is experiencing is with the start of the service, which you do in a similar way as the cookbook. Would you mind double-checking whether your issue is not just the (other) issue of @silverl of the license not being set unless setting "node.default['newrelic']['server_monitoring']['license'] = data_bag_item( "api_keys", "newrelic" )["license"]"?
Would you mind giving the following a try?
# Set newrelic license
node.default['newrelic']['server_monitoring']['license'] = data_bag_item( "api_keys", "newrelic" )["license"]
# Install newrelic
include_recipe "newrelic" # does this work?
Thanks in advance!
Kind regards,
David
from newrelic.
Hi @silverl,
would you mind checking /etc/newrelic/nrsysmond.cfg, especially whether the license is filled out correctly? I'd like to know why newrelic-sysmond fails to start...
(FYI: "Job for newrelic-sysmond.service failed. See 'systemctl status newrelic-sysmond.service' and 'journalctl -xn' for details.")
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
@djoos @tatemz The original problem here is actually a Chef issue that pops up often in wrapper cookbooks and nested attributes https://tickets.opscode.com/browse/CHEF-4234 Hopefully something is addressed in Chef 12 regarding attribute precedence.
There are a few workarounds for wrapper cookbooks, but none of them should be needed in this case. I'd suggest re-factoring the license bits in this cookbook since the server/plugin license key is always the same to one attribute instead of 3. Correct me if I'm wrong.
from newrelic.
Running into the same issue here (Ubuntu 12.04, Chef-Client 11.12.8).
Recipe attributes/default.rb
:
default['newrelic']['license'] = '...'
The issue was that the newrelic.cfg
had a line that read:
license_key=
(The license key was empty.)
I suspect this happens because the newrelic
recipe has:
default['newrelic']['license'] = nil
default['newrelic']['server_monitoring']['license'] = node['newrelic']['license']
default['newrelic']['application_monitoring']['license'] = node['newrelic']['license']
default['newrelic']['plugin_monitoring']['license'] = node['newrelic']['license']
Which is to say, when I set my own default['newrelic']['license']
, it's already too late; the nil
has already been copied into the other values, which don't get updated.
from newrelic.
Yea, it could be moved to late binding interpolation, but I think it'd be easier to just simplify and have one var for the key. I've since moved to managing my own recipe for the daemon, it is really a simple thing to install and template with notifies restart.
from newrelic.
Hi @Aupajo,
"Which is to say, when I set my own default['newrelic']['license'], it's already too late"
How exactly are you setting your license attribute?
FYI: this works like a treat (environments/production.rb - but in a role works fine as well):
default_attributes(
{
"newrelic" => {
"license" => "xyz"
}
}
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
Well, not everyone sets attrs in roles/env - it fails when set in a wrapper cookbook
from newrelic.
"it fails when set in a wrapper cookbook"
How exactly do you set it in your wrapper cookbook? Via node.override it should work there, no?
from newrelic.
Maybe it does with override - i haven't checked, but I would prefer not to do add a bunch of override attrs to my landscape.
Does the cookbook need 3 attrs for the same value or would one suffice and eliminate this issue for people?
from newrelic.
@djoos That error happens when I set the license in attributes/default.rb
of another recipe that includes the newrelic
recipe.
from newrelic.
Hi @Aupajo,
"That error happens when I set the license in attributes/default.rb of another recipe that includes the newrelic recipe."
via node.default? If so, a default has been set already. Could you give node.override a go?
Kind regards,
David
from newrelic.
Hi @jolexa,
"I would prefer not to do add a bunch of override attrs to my landscape."
No problem, you can then use...
default_attributes(
{
"newrelic" => {
"license" => "xyz"
}
}
to achieve that!
"Does the cookbook need 3 attrs for the same value or would one suffice and eliminate this issue for people?"
It's not only this particular attribute, it's a wider "issue" with Chef, as a default is provided in the cookbook attributes. In this particular case the license-attribute. The cookbook only needs 1 value to be set correctly, namely: license - that's it! The other 2 will be using this value then if there isn't a (very) specific need to have different values for application and agent monitoring.
Just make sure to set the license attribute correctly and you're good to go...
Hope this helps!
David
from newrelic.
Hi guys,
have you been able to resolve the issues you were experiencing?
Thanks in advance for your feedback!
Kind regards,
David
from newrelic.
@djoos Yes, thanks. I'd resolved the issue by specifying the license in the role prior to posting the second comment.
Two cents: late binding (i.e. determining the derived license key at the time the template is rendered rather than in the default attributes) might be helpful here, plus it wouldn't break or change the behaviour of any existing set-up.
from newrelic.
I got same issue, I had to replaced all node[]
by node.default[]
at https://github.com/escapestudios-cookbooks/newrelic/blob/master/resources/yml.rb, now it's working fine.
I find the change so simple to create a PR.
from newrelic.
Hi guys,
this thread covered quite a few things... I'll close the issue now, but please do send me a PR with additional info if you deem there's still any outstanding items you encountered here that needs resolving!
Kind regards,
David
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.