Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processes plugin configuration file not been deployed #851

Open
kazeborja opened this issue Aug 31, 2018 · 2 comments
Open

Processes plugin configuration file not been deployed #851

kazeborja opened this issue Aug 31, 2018 · 2 comments

Comments

@kazeborja
Copy link
Contributor

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.8
  • Distribution: RedHat
  • Module version: v10.0.1

How to reproduce (e.g Puppet code you use)

Configuring any process through the Processes plugin

What are you seeing

No configuration file is created in the configuration directory

What behaviour did you expect instead

A configuration file with the name processes-config.conf to be created in the configuration folder.

Output log

Nothing

Any additional information you'd like to impart

Seems this line of configuration here https://github.com/voxpupuli/puppet-collectd/blob/master/manifests/params.pp#L79 is making Puppet not to deploy the file (in a very silent way). A possible fix will be to drop that line, but I guess something like specifying execution orders makes more sense.

@openglx
Copy link

openglx commented Sep 28, 2018

So this is actually a funny one. I've reproduced the same conditions as the original reporter.
After a few digging around and looking at the /opt/puppetlabs/puppet/cache/state/last_run_report.yaml (Puppet 4.10.12 on CentOS 7.5.1804) it turns out there's a race between collectd::plugin::processes concat creating "${collectd::plugin_conf_dir}/processes-config.conf" and collectd::plugin file { "package_${plugin}.load": } removing any OS-depoyed package.

It only affects systems that have class RedHat because voxpopuli collectd happens to have created the process-config.conf with same name as the name being purged later on.

The race is always rigged because collectd::plugin is set to happen after collectd::plugin::processes so your execution state ends up with the concat first

- !ruby/object:Puppet::Util::Log
  level: :notice
  message: Would have triggered 'refresh' from 1 events
  source: Concat[/etc/collectd.d/processes-config.conf]
  tags:
  - notice
  - concat
  - class
  - collectd::plugin::processes
  - collectd
  (other tags redacted)
  time: '2018-09-28T09:17:33.053564267+00:00'
  file: 
  line: 

and the effective action of absent=>true

  File[package_processes.load]: !ruby/object:Puppet::Resource::Status
    title: package_processes.load
    file: "/etc/puppetlabs/code/environments/production/modules.upstream/collectd/manifests/plugin.pp"
    line: 55
    resource: File[package_processes.load]
    resource_type: File
    containment_path:
    - Stage[main]
    - Collectd::Plugin::Processes
    - Collectd::Plugin[processes]
    - File[package_processes.load]
    evaluation_time: 0.001051163
    tags:
    - file
    - package_processes.load
    - collectd::plugin
    - collectd
    - plugin
    - processes
    - class
    - collectd::plugin::processes
    (other tags redacted)
    time: '2018-09-28T09:17:33.050517664+00:00'
    failed: false
    changed: false
    out_of_sync: true
    skipped: false
    change_count: 0
    out_of_sync_count: 1
    events:
    - !ruby/object:Puppet::Transaction::Event
      audited: false
      property: ensure
      previous_value: :file
      desired_value: :absent
      historical_value: 
      message: current_value file, should be absent (noop)
      name: :file_removed
      status: noop
      time: 2018-09-28 09:17:33.051131026 +00:00
      redacted: 
      corrective_change: true
    corrective_change: true

I just started debugging this so don't have a conclusive patch to send. I suspect the easiest change would be renaming what collectd::plugin::processes create to it doesn't match the OS vendor filename.

@bdelamatre
Copy link

This stopped working awhile back for us as well. It took me awhile to troubleshoot, but I believe I have found the root cause and a solution. After testing various configs I noticed that the concat file was never being created if collectd::plugin { 'processes': is called. I added ordering to concat { "${collectd::plugin_conf_dir}/processes-config.conf": as such:

require         => [
  Collectd::Plugin['processes'],
],

and received this error:

(Concat_file[/etc/collectd.d/processes-config.conf] => File[package_processes.load] => Collectd::Plugin[processes] => Concat[/etc/collectd.d/processes-config.conf] => Concat_file[/etc/collectd.d/processes-config.conf])\nTry the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph

Following the error message into collectd::plugin we see this:

 # Delete default config file created by platform packaging and not matching
  # plugin name
  if ($plugin in $collectd::package_configs) {
    file { "package_${plugin}.load":
      ensure  => absent,
      path    => "${conf_dir}/${collectd::package_configs[$plugin]}",
      notify  => Service[$collectd::service_name],
      require => $flush_require,
    }
  }

On RedHat/CentOS systems this /${collectd::package_configs[$plugin] references on collectd::params

 $package_configs    = {
        ovs_events => 'ovs-events.conf',
        ovs_stats => 'ovs-stats.conf',
        processes => 'processes-config.conf',
        virt => 'libvirt.conf',
      }

Conclusion, collectd::plugin { 'processes': is deleting the file /etc/collect.d/processes-config.conf which it's then later trying to create with concat.

Proposed Solution:
Remove processes-config.conf from the params configuration.

Add the replace parameter (along with the previously added require) to concat on processes.

replace => true,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants