Hello everyone,
I''m trying to hook NewRelic into the Puppet agent. Why? Because
I''m pretty
positive at this point that the metrics Dashboard reports are not accurate
/ incomplete and I can''t really split out those metrics in stuff like
''which commands take too long'' or ''how long am I
waiting on the network''
and so forth.
Now, I''ve been able to hook NewRelic into the Puppet agent by changing
/usr/bin/puppet to look like this:
> #!/usr/bin/ruby1.8
> require ''rubygems''
> require ''newrelic_rpm''
> require
''new_relic/agent/instrumentation/controller_instrumentation''
> NewRelic::Agent.manual_start
> include NewRelic::Agent::Instrumentation::ControllerInstrumentation
> perform_action_with_newrelic_trace(:name => "PuppetAgentRun:
> #{`hostname`}", :category => :task) do
> require ''puppet/util/command_line''
> Puppet::Util::CommandLine.new.execute
> end
This (and a newrelic.yml) gets me some basic information in NewRelic''s
Background Tasks showing data like this:
Category Segment % Time Avg calls (per task call) Avg time
(ms)> OtherTransaction Object/PuppetAgentRun: nl12s0020 50.2 1.0 28,540
> External Net::HTTP[nl14s0008-vm5.healthcare.nedap.local]: POST 37.1 2.0
> 21,092
> External Net::HTTP[nl14s0008-vm5.healthcare.nedap.local]: GET 8.8 190
> 5,003
> External Net::HTTP[nl14s0008-vm5.healthcare.nedap.local]: PUT 3.8 2.0
> 2,160
> External Net::HTTP[nl14s0008-vm5.healthcare.nedap.local]: HEAD 0.1 2.0
> 28.4
Though interesting it still doesn''t tell me much so I want to do
something
like this:
> require ''puppet/configurer/downloader''
> Puppet::Configurer::Downloader.class_eval do
> include NewRelic::Agent::MethodTracer
> add_method_tracer :evaluate
> end
However, this is where it goes wrong. At that point, agents start
complaining:
> /usr/lib/ruby/1.8/puppet/indirector.rb:6: uninitialized constant Puppet
> (NameError)
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require''
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require''
> from /usr/lib/ruby/1.8/puppet/ssl/host.rb:1
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require''
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require''
> from /usr/lib/ruby/1.8/puppet/network/http_pool.rb:1
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require''
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require''
> from /usr/lib/ruby/1.8/puppet/configurer.rb:4
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require''
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require''
> from /usr/lib/ruby/1.8/puppet/configurer/downloader.rb:1
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require''
> from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require''
> from /usr/bin/puppet:9
Now, one would think that a ''require puppet'' would fix it but
then
everything breaks with errors like this:
> err: /Stage[main]/Ntp/File[/etc/ntp.conf]: Could not evaluate: Could not
> retrieve information from environment production source(s)
> puppet:///modules/ntp/ntp.conf at
> /etc/puppet/environments/production/modules/ntp/manifests/init.pp:19
This goes on and on and causes failed runs, so we tried stuff like
''require
puppet/util'' or ''require puppet/util/plugin'' but
eventually we always end
up with a error similar to:
> uninitialized constant Puppet (NameError)
It would seem that Puppet code loads a lot of stuff itself instead of
letting Ruby handle it and at this point I''m at a loss. How do I hook
into
Puppet classes and functions in a way that doesn''t break the agent and
allows me / NewRelic to see what is going on?
Kind regards,
--
Daniele Sluijters
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/vTTpu6HJWngJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.