Giter Site home page Giter Site logo

Comments (17)

tatemz avatar tatemz commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

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.

jolexa avatar jolexa commented on August 16, 2024

@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.

Aupajo avatar Aupajo commented on August 16, 2024

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.

jolexa avatar jolexa commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

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.

jolexa avatar jolexa commented on August 16, 2024

Well, not everyone sets attrs in roles/env - it fails when set in a wrapper cookbook

from newrelic.

djoos avatar djoos commented on August 16, 2024

"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.

jolexa avatar jolexa commented on August 16, 2024

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.

Aupajo avatar Aupajo commented on August 16, 2024

@djoos That error happens when I set the license in attributes/default.rb of another recipe that includes the newrelic recipe.

from newrelic.

djoos avatar djoos commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

Hi guys,

have you been able to resolve the issues you were experiencing?

Thanks in advance for your feedback!

Kind regards,
David

from newrelic.

Aupajo avatar Aupajo commented on August 16, 2024

@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.

shairontoledo avatar shairontoledo commented on August 16, 2024

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.

djoos avatar djoos commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.