Sensu Puppet Quickstart

From Kyle's Wiki
Jump to: navigation, search

Contents

Install Puppet Modules

puppet module install example42/redis
puppet module install puppetlabs/rabbitmq
puppet module install sensu/sensu

Generate SSLs

git clone git://github.com/joemiller/joemiller.me-intro-to-sensu.git
cd joemiller.me-intro-to-sensu
./ssl_certs.sh generate
mkdir -p /etc/puppet//files/sensu/
cp *.pem testca/*.pem /etc/puppet//files/sensu/

Sensu Server Puppet Code

  file { '/etc/rabbitmq/ssl/server_key.pem':
    source => 'puppet:///files/sensu/server_key.pem',
  }
  file { '/etc/rabbitmq/ssl/server_cert.pem':
    source => 'puppet:///files/sensu/server_cert.pem',
  }
  file { '/etc/rabbitmq/ssl/cacert.pem':
    source => 'puppet:///files/sensu/cacert.pem',
  }
  class { 'rabbitmq':
    ssl_key => '/etc/rabbitmq/ssl//server_key.pem',
    ssl_cert  => '/etc/rabbitmq/ssl//server_cert.pem',
    ssl_cacert  => '/etc/rabbitmq/ssl//cacert.pem',
    ssl => true,
  }
  rabbitmq_vhost { '/sensu': }
  rabbitmq_user { 'sensu': password => 'bla' }
  rabbitmq_user_permissions { 'sensu@/sensu':
    configure_permission => '.*',
    read_permission      => '.*',
    write_permission     => '.*',
  }
  class {'redis': }
  class {'sensu':
    server => true,
    rabbitmq_password => 'bla',
    rabbitmq_ssl_private_key => "puppet:///files/sensu/client_key.pem",
    rabbitmq_ssl_cert_chain => "puppet:///files/sensu/client_cert.pem",
    rabbitmq_host => 'bla',
  }
  sensu::handler { 'default':
    command => 'mail -s \'sensu alert\' email',
  }

Sensu Client Code

   class { 'sensu':
     rabbitmq_password  => 'bla',
     rabbitmq_host      => 'bla',
     subscriptions      => 'sensu-test',
     rabbitmq_ssl_private_key => "puppet:///files/sensu/client_key.pem",
     rabbitmq_ssl_cert_chain => "puppet:///files/sensu/client_cert.pem",
   }
Personal tools
Namespaces

Variants
Actions
Efforts
Toolbox
Meta