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

All of the json files (client, api, etc.) in /etc/sensu/conf.d remain empty #657

Closed
nagyt234 opened this issue May 23, 2017 · 1 comment
Closed

Comments

@nagyt234
Copy link

Description of problem

  • What did you do?
    I've tried to install sensu using the puppet module:
puppet install sensu/sensu
  • What happened?
    RabbitMQ and Redis are installed. Sensu is installed after I installed the APT key manually (see issue Sensu packages cannot be authenticated #654) but sensu client is not started because of a ruby error (s. below), which I guess caused by the empy /etc/sensu/conf.d/client.json file. As all other files, redis.json, rabbitmq.json and api json are empty, too.
  • What did you expect to happen?
    That sensu-client and sensu-api are also started and the configuration files are fileld up according to the initialization parameters of the class sensu.
  • How can someone reproduce the problem?
    Use the manifest file below.

Command used and debugging output

  • What does your puppet config look like (including any hiera config)
    This is the manifest file in my modul "sensu_server":
class sensu_server {

  case $operatingsystem {
    ubuntu:  {
       case $operatingsystemrelease {
         '16.04': {
            $packages = ["rabbitmq-server", "erlang-nox", "redis-server"]
            $rabbitmqctl_path = "/usr/sbin:/usr/bin:/bin"
          }
         default: { fail("puppet_agent: unsupported Ubuntu release: ${operatingsystemrelease}") }
       }
    }
    default: { fail("puppet_agent: unsupported OS: ${operatingsystem}") }
  }

  package { $packages:
    ensure => installed,
    require => Apt::Source["rabbitmq"],
  }

  # --- RabbitMQ

  apt::source { 'rabbitmq':
    location => 'https://www.rabbitmq.com/debian/',
    release  => 'testing',
    repos    => 'main',
    include  => {
      'deb' => true
    },
    key => {
      'id' => '6B73A36E6026DFCA',
      'server' => 'hkps.pool.sks-keyservers.net',
    },
  }

  service { 'rabbitmq-server':
    ensure     => running,
    enable     => true,
    hasrestart => true,
    require => Package[$packages]
  }

  file { '/etc/rabbitmq/ssl':
    ensure  => directory,
    recurse => true,
    source  => "puppet:///modules/${module_name}/rabbitmq_ssl",
    mode    => 0644,
    owner   => root,
    group   => root,
    notify  => Service['rabbitmq-server'],
    require => Package['rabbitmq-server'],
  }

  file { '/etc/rabbitmq/rabbitmq.config':
    content => file("${module_name}/rabbitmq.config"),
    mode    => 0644,
    owner   => root,
    group   => root,
    notify  => Service['rabbitmq-server'],
    require => Package['rabbitmq-server'],
  }

  exec { 'rabbitmq add vhost':
    path    => $rabbitmqctl_path,
    command => "rabbitmqctl add_vhost /sensu",
    unless  => "rabbitmqctl list_vhosts | grep '^/sensu$' > /dev/null",
    require => Service['rabbitmq-server'],
  }

 exec { 'rabbitmq add user':
    path    => $rabbitmqctl_path,
    command => "rabbitmqctl add_user sensu tcom1959",
    unless  => "rabbitmqctl list_users | grep '^sensu[ \t]' > /dev/null",
    require => Exec['rabbitmq add vhost'],
  }

  exec { 'rabbitmq set permissions':
    path    => $rabbitmqctl_path,
    command => "rabbitmqctl set_permissions -p /sensu sensu '.*' '.*' '.*'",
    unless  => "rabbitmqctl list_user_permissions sensu | grep '^/sensu\t\.\*' > /dev/null",
    require => Exec['rabbitmq add user'],
  }

  # --- redis-server

  service { 'redis-server':
    ensure     => running,
    enable     => true,
    hasrestart => true,
    require => Package[$packages]
  }

  # ---- sensu

 class { 'sensu':
    server                   => true,
    api                      => true,
    client                   => true,

    rabbitmq_host            => 'localhost',
    rabbitmq_port            => 5671,
    rabbitmq_vhost           => '/sensu',
    rabbitmq_user            => 'sensu',
    rabbitmq_password        => 'tcom1959',
    rabbitmq_ssl_private_key => "puppet:///modules/${module_name}/rabbitmq_ssl/key.pem",
    rabbitmq_ssl_cert_chain  => "puppet:///modules/${module_name}/rabbitmq_ssl/cert.pem",

    redis_host               => '127.0.0.1',
    redis_port               => 6379,

    api_bind                 => '0.0.0.0',
    api_host                 => '127.0.0.1',
    api_port                 => 4567,

    subscriptions            => [ "ALL" ],

    require => Service['redis-server'],
  }
}

The fragment of output of the command on the client: puppet agent --onetime --no-daemonize --verbose:

Error: Could not start Service[sensu-client]: Execution of '/bin/systemctl start sensu-client' returned 1: Job for sensu-client.service failed because the control process exited with error code. See "systemctl status sensu-client.service" and "journalctl -xe" for details.
Error: /Stage[main]/Sensu::Client::Service/Service[sensu-client]/ensure: change from stopped to running failed: Could not start Service[sensu-client]: Execution of '/bin/systemctl start sensu-client' returned 1: Job for sensu-client.service failed because the control process exited with error code. See "systemctl status sensu-client.service" and "journalctl -xe" for details.

In /var/log/sensu/sensu-client.log I see the following

/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:359:in `deep_merge': undefined method `each' for nil:NilClass (NoMethodError)
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:131:in `load_file'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:165:in `block in load_directory'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:164:in `each'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings/loader.rb:164:in `load_directory'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:29:in `block in load'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:28:in `each'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:28:in `load'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-settings-9.2.1/lib/sensu/settings.rb:48:in `get'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/daemon.rb:133:in `load_settings'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/daemon.rb:53:in `initialize'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:29:in `initialize'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:17:in `new'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/lib/sensu/client/process.rb:17:in `run'
        from /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-0.26.5/exe/sensu-client:10:in `<top (required)>'
        from /opt/sensu/bin/sensu-client:22:in `load'
        from /opt/sensu/bin/sensu-client:22:in `<main>'
  • Is this a masterless or master based puppet setup?
    It's a master base setup.

Platform and version information

  • Your OS: Ubuntu 16.04 on the puppet client, 12.04 on the puppet server
  • Your Ruby version: 2.3.1p112 on the puppet client, 1.9.3p484 on the puppet server
  • Your version of Puppet: opens source 3.8.5 on the puppet client, 3.7.3 on the puppet server
  • Your version of Sensu: not so far, the package is not installed by this module
  • Your version of this module: 2.2.0

Anything else to add that you think will be helpful?

@nagyt234
Copy link
Author

The problem was caused by the pluginsync settings on the puppet agent. It has to be enabled, see puppet documentation. The weird thing is that no error message appears anywhere about missing (custom) types.

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

No branches or pull requests

1 participant